help-make
[Top][All Lists]
Advanced

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

Do you know why this wont work


From: Christopher Mary A Contr AFRL/SNZW
Subject: Do you know why this wont work
Date: Wed, 1 Dec 2004 16:54:21 -0500

Hello,


I am using a make file to issue a shell script that needs the target as its input.  I used the Multiple Targets examples in the "info make" that is installed with our Linux (SuSE 9.0) distribution.  I wanted to let the user know which are the valid targets so I hardcoded a list of these.  I later realized that I could build the list of valid targets dynamically based on other information.  I have written two makefiles that exemplify what I mean.  The first one, with the hardcoded list, works, the other does not.  I cannot figure out why the second example is not working.  



Example 1 Makefile - This works fine.  When I type make at the command line, the NOMATCH target is matched and it prints the warning to the user that they need to choose from one two three.  When I issue the command make one, the makefile finds the target one and performs the command compileAll one.  This is the desired action.

========================

MyTargets = one two three

NOMATCH:
                @echo "No matching target.  Please choose from $(MyTargets)"


$(MyTargets):
                @compileAll $@

=========================




Example 2 Makefile - This will not find the target.  The script genTargetList just produces a list of valid target names by using the echo command inside the genTargetList csh script (e.g.  echo one two three).  This sets the MyTargets variable within the makefile to one two three (I can see this by the NOMATCH: target when I just run make at the command line.  It prints Please choose from one two three.)  However, if I issue the command make one, make gives me the error Make: *** No rule to make target 'one'. Stop.

========================

MyTargets = `genTargetList`

NOMATCH:
                @echo "No matching target.  Please choose from $(MyTargets)"


$(MyTargets):
                @compileAll $@

=========================

Any help is appreciated. 

Mary Christopher
Software Engineer, CACI
address@hidden


reply via email to

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