help-make
[Top][All Lists]
Advanced

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

generate a file and then include it


From: Rashed38
Subject: generate a file and then include it
Date: Tue, 27 Mar 2012 14:24:16 -0700 (PDT)

Hi,
 This is what I want to do: 
   1) I have a static makefile. whenever any target is called (e.g. "make
foo"), it first needs to 
       generate on-the-fly another makefile, e.g. "makefile.env", and
include it, 
   2) then based on some variables that are present in "makefile.env",
decide what commands
       to execute for "make foo". 

How can I get this to work? 

I tried several things, and this is what I have right now, and I couldn't
get it to work.
when I issue the first "make foo", it can not include the file, because it's
not present. 
so it creates it, but I think that happens in parallel with the execution of
target "foo".
so, I get the message "MY_VARIABLE is 0", even though the generated
"makefile.env"
has it set to 1. 

* makefile: 
ENV_MAKE          := $(PWD)/makefile.env
$(ENV_MAKE) : 
  @(generate_make.pl -o $@)

include $(ENV_MAKE)

foo : 
ifeq ($(MY_VARIABLE),1)
  @(echo "MY_VARIABLE is 1")
else
  @(echo "MY_VARIABLE is 0")
endif


* makefile.env:
MY_VARIABLE := 1
-- 
View this message in context: 
http://old.nabble.com/generate-a-file-and-then-include-it-tp33544801p33544801.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.




reply via email to

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