help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Request for help in setting a variable in GNU Make.


From: Greg Chicares
Subject: Re: Request for help in setting a variable in GNU Make.
Date: Thu, 06 Apr 2006 02:47:37 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

On 2006-4-6 0:04 UTC, Louie McCrady wrote:
> In the example below I'm having trouble defining or setting the variable
> "sourceFiles".  I want it to contain a list of all the .cpp files that
> are newer than my target, or have missing .o files, or have other
> dependencies that have been touched.

I think I'd use
        $(MAKE) -n
then capture the output and parse out the '*.cpp' files.
Something like this (not extensively tested):

what_to_make = \
  $(shell $(MAKE) -n \
    |sed -e 's/ /\n/g' \
    |sed -e '/\.cpp$$/!d' \
  )

.PHONY: what
what:
        g++ $(what_to_make)

Well, it doesn't handle the nothing-to-build case elegantly.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]