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

标签 c unix makefile

我有以下 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.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/

相关文章:

java - 如何在windows eclipse中进行unix导出

makefile - .deps/*.Po : No such file or directory compiler error

c - 共享内存段被删除?

c - 如何使用 cmake 生成包含文件?

objective-c - 返回后使用 NSOperationQueue 延迟释放 malloc'd void*

c - 从文件转换时间并与当前时间进行比较

c - 设置 Eclipse 使用以下参数调用我的程序 "< fileName.txt"

命令提示符程序: how to allow user to enter unix commands?

c++ - 多语言编译中的I/O问题

java - Java 生成文件