我想尝试GCC整个程序优化.为此,我必须立即将所有C文件传递给编译器前端.但是,我使用makefile来自动化我的构建过程,而且在makefile魔术方面我不是专家.
如果我想使用一次GCC调用来编译(甚至链接),我该如何修改makefile?
供参考 - 我的makefile如下所示:
LIBS = -lkernel32 -luser32 -lgdi32 -lopengl32
CFLAGS = -Wall
OBJ = 64bitmath.o \
monotone.o \
node_sort.o \
planesweep.o \
triangulate.o \
prim_combine.o \
welding.o \
test.o \
main.o
%.o : %.c
gcc -c $(CFLAGS) $< -o $@
test: $(OBJ)
gcc -o $@ $^ $(CFLAGS) $(LIBS)
Run Code Online (Sandbox Code Playgroud)
Ale*_*x B 59
LIBS = -lkernel32 -luser32 -lgdi32 -lopengl32
CFLAGS = -Wall
# Should be equivalent to your list of C files, if you don't build selectively
SRC=$(wildcard *.c)
test: $(SRC)
gcc -o $@ $^ $(CFLAGS) $(LIBS)
Run Code Online (Sandbox Code Playgroud)