Article View: comp.unix.programmer
Article #3744What I wish make could do...
From: Erik E. Rantapaa
Date: Thu, 28 May 1992 21:28
Date: Thu, 28 May 1992 21:28
71 lines
3224 bytes
3224 bytes
Here are some thoughts I've been having about GNU make but could pertain
to makes all over the world. I would be interested in what y'all would
have to say about them.
[For those of you unfamilar with GNU make, $(shell cmd args...)
expands to the output of the 'cmd args...' in the default shell.]
#0. What about changing the way variable expansion is done so that
% : $(shell SCRIPT %)
... rules ...
will substitute the expansion of % BEFORE expanding $(shell ...).
I realize that this may be undesirable in most cases and perhaps
impossible given the way GNU make implements variable expansion,
but I could see a use for it.
#1. I would like to specify when a target is out of date rather than
being restricted to make's default rules. Has anyone thought of
enhancing make to allow for, say, variable expansion to determine if
a target is out of date? For example, the syntax
x : d1 d2 d3 &$(shell SCRIPT)
would tell make that target x is out of date if any of d1, d2, d3 is
older than x or if the expansion of $(shell SCRIPT) is non-blank.
But, since make doesn't have this feature...
#2. Suppose I have the following declaration in a make file:
.PHONY: x
x : $(shell SCRIPT)
$(rules)
The idea is that the command SCRIPT will determine if x is up to date
and that its output will direct make to execute $(rules) or not.
What behavior should SCRIPT have in order to do this, or, as I suspect,
can't this problem be solved this way?
I have come up with a partial solution, namely:
.PHONY: x all
x :
$(rules)
all : $(shell SCRIPT)
where SCRIPT outputs all those targets which it finds out of date.
However, 'make x' will always execute $(rules) regardless of what SCRIPT
says.
Another solution I don't like is
x :
if SCRIPT; then $(rules) fi
because I would like the rules for a target to be executed only if
the target is determined to be out of date. In particular, I would
like 'make -n x' to possibly return 'Nothing needs to be done for x.'
#3. Somewhere in the make texinfo doc it reads:
``A phony target should not be a dependency of a real target file;
strange things can result from that. As long as you don't do that,
... ''
Pray tell, what kind of strange things can happen?
--
Erik Rantapaa rantapaa@math.umn.edu
Technical Details
Message-ID:
<rantapaa.707088491@s6.math.umn.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!usenet.coe.montana.edu!mintaka.lcs.mit.edu!ai-lab!ai.mit.edu!gnulistsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,3037f8b1a3d13994,start X-Google-Attributes: gidfc89c,public X-Google-Thread: 10f1ff,3037f8b1a3d13994,start X-Google-Attributes: gid10f1ff,public X-Google-ArrivalTime: 1992-05-29 04:06:44 PST Path: arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!usenet.coe.montana.edu!mintaka.lcs.mit.edu!ai-lab!ai.mit.edu!gnulists From: plains!s6.math.umn.edu!rantapaa@uunet.uu.net (Erik E. Rantapaa) Newsgroups: comp.unix.programmer,gnu.utils.bug Subject: What I wish make could do... Message-ID: <rantapaa.707088491@s6.math.umn.edu> Date: 28 May 92 21:28:11 GMT Followup-To: comp.unix.programmer,gnu.utils.bug Organization: University of Minnesota Lines: 71 Approved: info-gnu@prep.ai.mit.edu Nntp-Posting-Host: s6.math.umn.edu Apparently-To: uunet!gnu-utils-bug To: uunet!gnu-utils-bug@uunet.uu.net