makefile中使用shell命令并将结果保存为变量
INCLUDE= $(shell wx-config --cxxflags)
LIBS=$(shell wx-config --libs)
CC=g++
all:
#echo $(INCLUDE)
$(CC) *.cpp $(LIBS) $(INCLUDE) -o test
其中wx-config是命令 -cxxflags 是其参数。
同样可以用
定义变量src_files=$(shell ls *.cpp) 去替换*.cpp.
$(CC) $(src_files) $(LIBS) $(INCLUDE) -o test
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。