gpt4 book ai didi

c - 如果没有以下 make 文件,我该如何手动操作?

转载 作者:太空宇宙 更新时间:2023-11-03 23:21:53 26 4
gpt4 key购买 nike

我有以下 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 和存档(ar) 的情况下重写make 文件吗?实际上,我想通过手动编译每个文件(easyperf.ctest.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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com