help-gnu-utils
[Top][All Lists]
Advanced

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

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


From: Colin S. Miller
Subject: Re: make question (depend on content of a file)
Date: Wed, 03 Sep 2008 21:00:08 +0100
User-agent: Icedove 1.5.0.14eol (X11/20080724)

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.


reply via email to

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