|
From: | John Graham-Cumming |
Subject: | Re: Request for help in setting a variable in GNU Make. |
Date: | Thu, 06 Apr 2006 09:25:27 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104 |
Louie McCrady wrote:
objectFiles = $(patsubst %.cpp,%.o,$(wildcard *.cpp)) sourceFiles = "hello" myprog.exe : $(objectFiles) @echo "all sources to be compiled : $(sourceFiles)" %.o : %.cpp @echo "Adding $< to the list to be compiled" set sourceFiles += $< @echo "sanity check: --- $(sourceFiles) --- $@ --- $< ---"
If you want to be really evil (i.e. break lots of Paul's rules) you can do this:
OBJS := $(wildcard *.cpp) OBJS := $(OBJS:.cpp=.o) .PHONY: all all: $(OBJS) @echo $(SRCS) is the list of CPP files to recompile %.o : %.cpp $(eval SRCS += $<) John. -- John Graham-Cumming address@hidden Home: http://www.jgc.org/ Blog: http://www.jgc.org/blog/ POPFile: http://getpopfile.org/ GNU Make Standard Library: http://gmsl.sf.net/ GNU Make Debugger: http://gmd.sf.net/ Fast, Parallel Builds: http://www.electric-cloud.com/ Sign up for my Spam and Anti-spam Newsletter at http://www.jgc.org/
[Prev in Thread] | Current Thread | [Next in Thread] |