Re: make question (depend on content of a file)

"Colin S. Miller" <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization SunSITE.dk - Supporting Open source
Message-ID <[email protected]>
James wrote:
> The goal is to satisfy both (a) and (b):
> 
> (a) the target(T) depends on a generated file(F) as well as
> on the content of the file (file F contains a list of files).
> (b) parallel make enabled
> 
> content = $(shell cat F)
> 
> T: F $(content)
> 
> F:
>      Rule to generate F
> 
> 
> How do I do it?
> TIA
> 
> James


One way to do this is to
1) make a rule to convert F into a makefile, containing rules to rebuild T
2) Make the import file dependant on F


So your make file will be

#/usr/bin/make -f
.PHONY all
all: myExe

include F.d
F.d: F
   echo -e "T:\tF " > F.d
   tr [:space:] \\040 >> F.d
   echo -e \\n >> F.d

T: F.d
   ...

myExe: T
   ...


Or something like this; it is untested.
The first time you run the makefile,
you will get a warning that F.d doesn't exist,
but it will then be generated.

BTW,
gcc can make the import rule with the -M family of options.


HTH,
Colin S. Miller




-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.