help-make
[Top][All Lists]
Advanced

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

Re: makefile help


From: Paul Smith
Subject: Re: makefile help
Date: Tue, 29 Sep 2009 09:38:34 -0400

On Tue, 2009-09-29 at 07:56 +0200, Michael Chicken wrote:
> ie. I would like to be able to enter "make USA" or "make Mexico" and
> have that automatically define REG_UNITED STATES or REG_MEXICO when
> compiling. 
> 
> I've tried to check the MAKECMDGOALS variable, but I still get a "No
> rule to make target "USA". Stop" error.

Any command line option given to make must either be a variable
assignment (in the form <var>=<value>) or a target to build, such as
"foo".

When you say "make USA", make is going to look for a target "USA".
Since you didn't define such a target, you get the above error.

One option is to use target-specific variables, like this:

        USA:    REG_DEFINE=-DREG_UNITED_STATES
        Mexico: REG_DEFINE=-DREG_MEXICO

        USA Mexico: $(OUT_FILE)
        .PHONY: USA Mexico

Read about target-specific variables in the GNU make manual.


BTW, your makefile confuses me a lot.  You seem to have about 6
different definitions for the "load" and "clean" targets.  There can be
only one single-colon recipe for a given target.  Don't you get lots of
warnings from make about this?  Or, did you leave out some parts of your
makefile environment?





reply via email to

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