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

[转自]makefile中使用shell命令并将结果保存为变量_blog