[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Order of include and variable expansion
From: |
Paul Millar |
Subject: |
Order of include and variable expansion |
Date: |
Sat, 10 Nov 2007 18:52:08 +0100 |
User-agent: |
KMail/1.9.7 |
Hi,
I've a makefile of medium complexity and I'm having some problems with it.
I'm using make v3.81
The main makefile auto-generate a number of extra dependencies and variables
as external makefiles. (These autogenerated additional makefiles contain
their own dependencies, so they're not needlessly updated.)
The main makefile also includes these auto-generated make files (a single
include statement), so that for second (and subsequent) runs, it should
include the extra variable and dependencies.
Two of these extra variables appear as prerequisites for a target (albeit
slightly modified, through a substitution reference). These are phony
targets that trigger some file copying.
If I have the include statement at the bottom of the file, this target behaves
as if the two prerequisites are not present: no files are copied. However,
if I put an @echo rule for this target, the variable expands correctly (but
this is during phase 2).
If I move the include file further up the file (just before the variables are
used) then the second prerequisite starts to work: it expands correctly and
triggers copying some files. The first prerequisite still doesn't expand,
though.
If I define just one of the two prerequisites as phony, either one, then
nothing changes. However, if I then declare both these prerequisites as phony
(either one first) then the second prerequisite stops working and no files
are copied.
I believe what is happening is order of the extra makefiles being included and
of the prerequisites being expanded is difficult to predict. Results
with --warn-undefined-variables suggest this, too, although not completely:
when neither prerequisite expands correctly (no files copied) I see a warning
about the two variables, yet when just one fails I see no warning.
I have a work-around for this, but I was wondering if:
a. is this a bug or a known problem?
b. whether there's anyway of indicating the order in which phase 1 activity
should take place (e.g. do the include first, delay expanding the
prerequisites, that sort of thing).
I can post the makefile somewhere, if that helps.
Cheers,
Paul.
- Order of include and variable expansion,
Paul Millar <=