make bug sunos4.0.3?
Peter van Eijk
pve at cs.utwente.nl
Mon Apr 8 18:27:01 AEST 1991
I have a problem with the sunos 4.03 version of `make(1)'. This problem
does not appear in HP/UX 7.0, and i remember not having this problem on
earlier sunossen (no such machines anymore->can't check). The problem
appears on sparcs as well as sun-3s. It appears to be related to `double
colon rules'.
Let me first explain the problem, then why i want something like that,
then why i think it is a bug and not an undocumented feature, and then
some final questions.
If i have the following files (makefile and foo.k), in particular the
file `foo.c' should not exist.
--makefile--
bar :: foo.k
cp foo.k foo.c
bar :: foo.o
cc -o bar foo.o
#if the following line is not commented out, the bug hides itself.
#bogus: foo.c
--foo.k (will be copied to foo.c)--
main() {}
---end of foo.k --
make produces the output:
cp foo.k foo.c
make: Fatal error: Don't know how to make target `foo.o'
What make *should* have done, and indeed does if an out of date `foo.c'
exists is:
cp foo.k foo.c
cc -sun4 -c foo.c
cc -o bar foo.o
Strangely enough, the same results from uncommenting the last rule.....
In other, similar makefiles, make just forgets to make the .o file.
What is the intended effect? Make first checks double colon rule #1, sees
that bar does not exist (or is out of date of course w.r.t. foo.k), calls
the rule. Then, and not earlier than that, make should check the dates of
rule #2. bar still doesn't exist, so foo.o should be created from foo.c
(which exists by this time) using first the implicit .c.o rule, and then
the second double colon rule. make does not seem to be aware of the
existence of foo.c, unless it appears in an unrelated place in the
makefile!!!
Why do i want to do something like this? This example is of course a model
of the real thing. In the real world `cp' is a program generator,
producing a number of .c files. The generator never overwrites a file with
an identical copy of it, so that we can avoid superfluous recompilations
of generated files. Now how do you record this in a makefile in a
succinct way? First you want to do one thing, and only then you want to
check some dependencies.
Why is this a bug and not an undocumented feature? If it were a feature,
the behaviour should not be different if we change a semantically
irrelevant thing in the makefile, in our case the bogus line that
references foo.c.
People may argue that the behaviour i require `make' to have is not
documented in this way, but in fact this behaviour is just not documented
precisely.
Now what i really want to know is: can anybody do better w.r.t. makefiles
for this problem? is this bug also in sunos4.1.? other solutions for
generator based makefiles?
--
Peter van Eijk University of Twente Dept Informatica / TIOS
P.O. Box 217; 7500 AE Enschede The Netherlands
tel +31-53-893789 fax -333815 home +31-74-435813 email pve at cs.utwente.nl
Cancel my subscription to the resurrection.
More information about the Comp.unix.wizards
mailing list