|
|
1
1
为了让make最初找到所有dep关系,它必须在初始扫描中展开vars,无论它们处于什么状态。所以呢
|
|
|
2
1
冒着过度杀戮的风险,我会这样写的。 个人准则:
all : minicalc ;@: # ... or ".PHONY: all"
test : mctests ; ls $^ && ./$^
minicalc : minicalc.o io.o main.o # minicalc.o is subtly redundant here.
mctests : minicalc.o io.o mctests.o # ... likewise mctests.o is redundant.
mctests.o : tests/src/main.cpp # Name difference forces an explicit action below.
vpath %.cpp src
CC = ${CXX} # Roundabout fix for MAKE using ${CC} for linking
# ... but cc/gcc cannot handle C++ object files.
CXXFLAGS += -Iinclude -g -Wall -Wextra
mctests.o : CXXFLAGS += -Itests/include
mctests : LDLIBS += -lcpptest # More accurately LDLIBS not LDFLAGS
mctests.o :; ${COMPILE.cpp} -o $@ $^
|
|
|
Jeremy L. · 在变量名中查找子字符串 1 年前 |
|
|
wvxvw · 在Make规则中将源和目标配对 1 年前 |
|
|
thetango · Makefile:多次执行目标 1 年前 |
|
|
Bokambo · make:MakeFile无需执行任何操作 1 年前 |