[Top][All Lists]

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

Re: how to undefine targets?

From: Paul D. Smith
Subject: Re: how to undefine targets?
Date: Wed, 18 Feb 2004 11:10:09 -0500

%% Christopher Bottaro <address@hidden> writes:

  cb> i have a bunch of targets defined in a file thats "included" in a
  cb> lot of my projects.  some projects need to use just a few targets
  cb> from the included file, but then override some of the other
  cb> targets.  is this possible?


  cb> include /path/to/my/file

  cb> # override the install target
  cb> install: blah
  cb>   blah blah

  cb> but its inconsistent.  sometimes it gets overwritten, sometimes it
  cb> doesn't.

It will never get overwritten.  If you try to redefine an explicit rule
make will fail with an error.  You can add prerequisites to the install
rule but you cannot write a new one with a command script.

You can redefine pattern (implicit) rules though.

  cb> is there a "right" way to do this?

One way is to declare your own local install target as a prerequisite of
the master install target:

    include /path/to/my/file

    install: local.install
    local.install: blah
            blah blah

Typically people put the included (default or master file) at the end,
not at the beginning.  Then you have lots of choices.  For example, you
could define a variable to contain your install rules:

    install: blah
    define local.install
            blah blah

    include /path/to/my/file

then in /path/to/my/file you'd say something like:

            <normal install rules>

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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