Subject: portable .PHONY

From: Steve Robbins <[email-masked]>
Date: Mon, 26 Apr 1999 16:30:43 -0400 (EDT)

Hi,

Could someone familiar with make (hi Paul!) remind me of the most portable
way of writing an "always do" rule?

The issue is that our makefiles generate a few scripts that have
${moduledir} embedded in them; FvwmCascade, FvwmTalk, and FvwmTile, to
name three. 

By default moduledir has the version number embedded in it.  But, the
Makefile rules for these scripts have no dependency, which means that mine
always have the WRONG version number.  

Even worse: the installer can do "make moduledir=/blah". 

So there is nothing we can depend on.  These scripts must be generated
each time.  How do we do that?

--
Steve Robbins                              <[email-masked]>

First, we take Manhattan, then we take Berlin.

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: [email-masked] (Paul D. Smith)
Date: 27 Apr 1999 01:45:40 -0400

%% Steve Robbins <[email-masked]> writes:

  sr> Could someone familiar with make (hi Paul!) remind me of the most
  sr> portable way of writing an "always do" rule?

Use the ol' FORCE hack:

  foo: FORCE
          ...do some cool stuff...
  FORCE:

as long as the file FORCE doesn't exist, you're golden.  This is due to
a special dispensation by standard make: if there are no dependencies or
command script, and the target doesn't exist, make pretends it's been
updated whenever it's seen--so it's always newer than targets that
depend on it.

.PHONY is safer, since you don't have to worry about some joker creating
a file FORCE.  Also, it's slightly more effecient.

But it's obviously a whole lot less portable :)

  sr> The issue is that our makefiles generate a few scripts that have
  sr> ${moduledir} embedded in them; FvwmCascade, FvwmTalk, and FvwmTile, to
  sr> name three. 

  sr> Even worse: the installer can do "make moduledir=/blah". 

  sr> So there is nothing we can depend on.  These scripts must be generated
  sr> each time.  How do we do that?

Hmm.  Well, except for the second point you can have the script target
depend on both the source (foo.in) _and_ the Makefile; then whenever the
makefile changes the script will too.

That doesn't help for command-line overrides, though.  Forcing the file
to update every time is OK w/ me.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email-masked]>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]