help-gnu-utils
[Top][All Lists]
Advanced

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

gnu make 3.81: secondary expansion


From: John Freeman
Subject: gnu make 3.81: secondary expansion
Date: Wed, 11 Jun 2008 11:08:21 -0700 (PDT)
User-agent: G2/1.0

Howdy,

I'm trying to build dependency files for the sources in my project.  I
got an initial version working using the tip from the GNU make manual:

%.dep : %.cpp
  ... commands ...

After I got this working, I wanted to make the dependency files
hidden:

DEPENDENCIES:=$(foreach file, $(OBJECTS), $(dir $(file)).$(basename $
(notdir $(file))).dep)

The interesting part of this variable assignment is the addition of
the dot (.) prefix to the file name.

Now, since my sources aren't hidden, I need to change the rule to
build the dependency files.  This was my failed attempt:

.SECONDEXPANSION:
%.dep : $$(patsubst %.dep,%.cpp,$$(subst /.,/,$$@))
  ... commands ...


Makefile:43: *** target pattern contains no `%'.  Stop.


I am using gmake 3.81 from macports on Mac OS 10.4.11.  All the online
solutions for this error I found said it usually has to do with colons
in the file name (on Windows machines).  I don't have that problem.
Printing $(DEPENDENCIES) proves this:

./.plan.dep pttl/.ast.dep pttl/.priority.dep pttl/.translater.dep pttl/
planners/quickplan/.mgraph.dep pttl/planners/quickplan/.print.dep

Also, the following rule works, indicating to me that this has to do
with secondary expansion in some way.

%.dep :
  @echo rule to build $@


Does anyone have any idea what may be causing the problem? Solutions?

Thank you,
John



reply via email to

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