help-make
[Top][All Lists]
Advanced

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

Double Colon Problem


From: Jeff A. Phelps
Subject: Double Colon Problem
Date: Tue, 13 Nov 2001 14:41:10 -0500

I posted a message to gnu.utils.help to get help with a
double colon/phony target problem, but nobody responded.
So, now I'm going to try here. The simplified version of what I
want is to get the following Makefile to print "package and servlet"
and then "servlet" when I issue the command: make foo.servlet.

#begin Makefile

%.package %.servlet::
        echo "package and servlet"

%.servlet::
        echo "servlet"

#end Makefile

make foo.servlet always just produces "package and servlet". I
never get "servlet". What am I doing wrong? I've played with
.SUFFIXES and .PHONY but neither have worked for me so
far. I'd appreciate any insight as to why this doesn't work (and what
to do to fix it) since I've read the manual, the O'reilly book, etc. and
figure I must be missing some subtlety (or maybe its not so subtle and
I'm just having a brain-fart.) Thanks.

Jeff


Also, here is the original message I posted to usenet:
---------------------------------------------------------------------------

Hi All,

In my Java project hierarchy I sometimes want to create a brand new
basic vanilla package, and sometimes I want to create a new package
that is servlet oriented. I'm trying to use a double-colon target to achieve
this, but my second target never has it's commands executed. Here's a
dumbed-down version of my Makefile:

%.package %.servlet::
        echo "do common stuff for creating a package or servlet"

%.servlet::
        echo "do extra stuff for creating a servlet"

foobar::
        echo hello

foobar::
        echo world

In a directory only containing the Makefile, I get the following during
execution:

asimov% make foo.package
common stuff for creating a package or servlet
asimov% make foo.servlet
common stuff for creating a package or servlet
asimov% make foobar
hello
world

I'm never getting the "do extra stuff for creating a servlet" message, which
is what I want.

Here's my pertinent working environment:

asimov% uname -a
Linux asimov 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT 2001 i686 unknown
asimov% make -v
GNU Make version 3.79.1, by ...

I only work with makefiles every couple of years so I may be
doing something foolish, but this seems like it should work; especially,
since the foobar target works as expected. Any enlightenment would
be greatly appreciated.

Jeff

P.S. I get the exact same result when running under cygwin on my
       Win2000 machine:
          clarke% uname -a
          Windows_NT CLARKE 5 00 586
          clarke% make -v
          GNU Make version 3.79.1, by ...




reply via email to

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