[Top][All Lists]

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

Problem with pattern rule

From: Ashif S. Harji
Subject: Problem with pattern rule
Date: Thu, 7 Jun 2001 02:10:43 -0400 (EDT)

I am having a problem with a pattern rule with gmake.  To generate the
problem, a file called xxx (any file is fine) is needed in the same
directory as the make file and the directories bin and bin2 do not exist. 

I am using gmake version:
>$ gmake -v
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i386-redhat-linux-gnu

Here is the make file:

install : bin2 bin2/xxx bin bin/xxx ;

bin : 
        mkdir bin

bin2 : 
        mkdir bin2

bin2/xxx : xxx
        cp $< $@

#bin/xxx : bin2/xxx
#       cp $< $@

bin/% : bin2/%
        cp $< $@


When I run 'gmake install' I get the following error:

>$ gmake install
mkdir bin2
cp xxx bin2/xxx
mkdir bin
gmake: *** No rule to make target `bin/xxx', needed by `install'.  Stop.

If I run it a second time I get:

>$ gmake install
cp bin2/xxx bin/xxx

So, the pattern rule appears to be correct.  As well, if I uncomment the
explicit rules and run gmake install I get:

>$ gmake install
mkdir bin2
cp xxx bin2/xxx
mkdir bin
cp bin2/xxx bin/xxx

Which is what I expect when using the pattern rule.  Is there an error in
the way I am using the pattern rule?

ashif harji.

reply via email to

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