bug-make
[Top][All Lists]
Advanced

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

Possible bug in GNU-make when prerequisite is a pattern that has a prefi


From: Kevin Szabo
Subject: Possible bug in GNU-make when prerequisite is a pattern that has a prefix which is an absolute pathname
Date: Mon, 25 Mar 2002 16:36:15 -0500

Hi Paul!

Hope you are still doing well at Nortel and the your source forge 
effort is continuing.  I think it is a great idea and one of the
really good ways on capitalizing on software reuse within Nortel.

I've recently become deeply immersed in GNU make and I have come
to a roadblock.  Possibly you can help me out?  I looked for a list
of known bugs on www.gnu.org, but didn't find any referenced from
Make's page.

Anyway, here goes:

I believe I have either found a bug, or a shortcoming in GNU MAKE.

It has to do with pattern rules, and specifically, pattern rules with
prerequisites
that are a pattern.

first things first;

% make -v
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for sparc-sun-solaris2.8


Here are two pattern rules, one with relative path names and one with 
absolute path names:

Make3 has relative path names:
--------------------------------------------------
bdir/%.ad : bdir/%.ef 
        @echo 'bdir/%.ad : bdir/%.ef'
        @echo '=> address@hidden@ $$*=$* $$^=$^'

bdir/%.ef :
        @echo 'bdir/%.ef :'
        @echo '=> address@hidden@ $$*=$* $$^=$^'
--------------------------------------------------

% make -f Make3 bdir/foo.ad
bdir/%.ef :
=> address@hidden/foo.ef $*=foo $^=
bdir/%.ad : bdir/%.ef
=> bdir/foo.ad=bdir/foo.ad $*=foo $^=bdir/foo.ef

As you can see, it correctly tries to make bdir/foo.ef


If we try this again with path names that have absolute components,
for some reason MAKE tosses the rules out (since it can't stat the
directory I surmise).  This is a real problem, because the
rule's actions may have been set up to create the directory and then
build the target.

Here's Make4:

--------------------------------------------------
bdir/%.ad : /bdir/%.ef 
        @echo 'bdir/%.ad : bdir/%.ef'
        @echo '=> address@hidden@ $$*=$* $$^=$^'

/bdir/%.ef :
        @echo 'bdir/%.ef :'
        @echo '=> address@hidden@ $$*=$* $$^=$^'
--------------------------------------------------

% make -f Make4 bdir/foo.ad
make: *** No rule to make target `bdir/foo.ad'.  Stop.

Interestingly, it will try to make /bdir/foo.ef if I try that directly:
% make -f Make4 /bdir/foo.ef
bdir/%.ef :
=> address@hidden/bdir/foo.ef $*=foo $^=

(even though there is no /bdir directory!)



I think Make is being too aggressive in tossing out pattern rules.  The
heuristic
(where dependencies that are absolute and can't be STAT'd) may reduce
effort 
but leads to incorrect results.

If this is a feature, please enlighten me because I have read chapter
ten (pg 94+)
a couple of times and can't see that this is the specified (or desired?)
behaviour.

Cheers,
Kevin Szabo




reply via email to

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