makefile 中定义宏位置需要注意一下

 1 CUR_DIR = $(shell pwd)
 2 
 3 CFLAGS = -g -Wall
 4 GCC = gcc
 5 GXX = g++
 6 
 7 TARGET = exe.out
 8 
 9 SRC_FILES += $(shell find $(CUR_DIR) -name *.cc) \
10           += $(shell find $(CUR_DIR) -name *.cpp)
11 
12 OBJS = fatal-impl.o log.o
13 
14 INCLUDE += -I.
15 RM = rm -f
16 
17 LINK = 
18 CFLAGS = -DNS3_LOG_ENABLE -g -Wall -O0
19 
20 all: $(OBJS) test.o
21     $(GXX) $(CFLAGS) $^ -o $(TARGET) $(LINK)
22 
23 test.o: test.cpp
24     $(GXX) -c $(CFLAGS) $^ -o $@
25     
26 $(OBJS): %.o : %.cc 
27     $(GCC) -c $(CFLAGS) $(INCLUDE) $< -o $@
28 
29 .PHONY : clean
30 clean: 
31     $(RM) $(OBJS)
32     $(RM) $(TARGET)

你可能感兴趣的:(makefile 中定义宏位置需要注意一下)