[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: functions allowed in prerequisite list?
From: |
Paul D. Smith |
Subject: |
Re: functions allowed in prerequisite list? |
Date: |
Tue, 5 Nov 2002 00:06:44 -0500 |
%% gk <address@hidden> writes:
g> * Does make allow functions in the list of prerequisites?
Sure. But, they're evaluated in the same way variables are: when the
makefile is read in. So, you can't use things like patterns (%) or
automatic variables with them.
You _really_ need to read the GNU make manual section on "How 'make'
Reads a Makefile" and internalize the places variables/functions are
immediately expanded, and where they're not.
g> (I do not like the convention %.c has dependency file %.d since
g> this loses trace of the relationship between %.c and %.d)
I don't know what that means.
g> In this example, source file 'foo.xms' will have a related dependency
g> makefile 'foo.xms.mk'
g> The problem is that I want the pattern rule that builds %.xms.mk have the
g> tool 'xms.mkdepend' as a prerequisite
If you have a variable containing all the different kinds of source, why
not just declare it explicitly:
XMS_SOURCES = foo.xms bar.xms baz.xms biz.xms
$(XMS_SOURCES:%=%.mk): xms.mkdepend
or whatever.
g> Here is an explicit rule for what I want:
g> foo.xms.mk : foo.xms /path/to/scripts/xms.mkdepend
g> Is there a way to generalize the above rule for all %.mk files?
No.
g> I am working around this by including makefiles with explicit rules
g> for each source file type.
If you want to use GNU make 3.80, you can probably also do it with $(eval
...).
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist