help-make
[Top][All Lists]
Advanced

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

"optional" prerequisites


From: Asperheim, Eric
Subject: "optional" prerequisites
Date: Wed, 20 Dec 2000 15:05:46 -0800

Hi,

I'm trying to use gmake to create an environment that will make compiling
RTL into gates with Synopsys Design Compiler (DC) tool easy.

One function that I would like from gmake is the ability to have what I call
an "optional" prerequisite. In our DC flow, the user can have optional
file(s) that provide a mechanism for user options. So, I would want some way
to write a rule like this

<target>.db : <required_prereq1> <required_prereq2> <optional_prereq>

<required_prereq> - normal functionality. If the prereq doesn't exist, look
for a rule to create it. 
        If gmake can find a rule to create it - fine. 
        If gmake can't find a way to create the required prereq (explicit,
pattern, implicit rule), complain and die.

<optional_prereq> - optional functionality. If the prereq doesn't exist,
look for a rule to create it. 
        If gmake can find a rule to create it - fine. 
        If gmake can't find a way to create the optional prereq (explicit,
pattern, implicit rule), don't consider this to be a problem and go on your
merry way, i.e. act as if the optional prereq was NOT in the rule.


One solution that works but isn't as clean as I would hope

optional_prereq = (wildcard <target>_opfile1.txt)
<target>.db : <required_prereq1> <required_prereq2> $optional_prereq 

If the optional file exists in the home directory, the wildcard function
will return the name of the file - thus proving that the file exists. So
when the variable is expanded in the above rule, gmake will see 
target>.db : <required_prereq1> <required_prereq2> <target>_opfile1.txt

If the optional file did not exist, gmake will see
target>.db : <required_prereq1> <required_prereq2> 

The problem with this approach is that it makes it tricky to "look" for the
optional file in other areas, using vpath or implicit rule that looks for
files in RCS.


Is there a better way?





reply via email to

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