我有以下 make 文件,它运行完美:
CFLAGS=-O2 -g -Wall
RANLIB=ranlib
all: test libeasyperf.a
libeasyperf.a: easyperf.o
$(AR) rc $@ $^
$(RANLIB) $@
test: easyperf.o test.o
$(CC) -o $@ $^ -lm
clean:
rm -f *.o test libeasyperf.a
我们可以在没有 ranlib
和 archive (ar
) 的情况下重写 make 文件吗?实际上我想通过手动编译每个文件(easyperf.c
,test.c
)来运行./test
,而不用Makefile执行所有这些操作。
可能吗?
最佳答案
gcc -O2 -g -Wall -c test.c -o test.o
gcc -O2 -g -Wall -c easyperf.c -o easyperf.o
gcc -O2 -g -o test easyperf.o test.o -lm
./test
关于c - 如果没有以下 make 文件,我该如何手动执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37130775/