<bug-make@gnu.org>. Hello, I found two problems which I think are bugs in the documentation for make: 1) Limitations of redefining a variable inside a conditional are not clear. 2) The order, in which prerequisites are processed, is not clear. I refer to: Edition 0.55, last updated 04 April 2000, of `The GNU Make Manual', for `make', Version 3.79. I use: GNU Make version 3.79.1, Built for i386-pc-msdosdjgpp (not the newest version, I presume, but maybe no one mentioned the problem yet?)
1st problem: In an attempt to reduce tedious typing when defining a variable from the command line, I tried: ifeq (max,$(O)) O = -O3 -fomit-frame-pointer -fno-unroll-loops endif ifeq (,$(O)) O = -O endif CXXFLAGS = -W -Wall $(O) but this didnt work. After typing make O=max the value max was passed straight to the compiler instead of being changed to -O3 -fomit-frame-pointer -fno-unroll-loops. I had to use the more complex sequence ifeq (max,$(O)) OPTIM = -O3 -fomit-frame-pointer -fno-unroll-loops endif ifeq (,$(O)) OPTIM = -O endif ifndef OPTIM OPTIM = $(O) endif CXXFLAGS = -W -Wall $(OPTIM) It seems as if it is not possible to change the value of a variable inside an ifeq conditional that test against that very variable, but I wasnt told in the documentation. 2nd problem: In most cases, of course, the order of processing the prerequisites doesnt matter, but I have to struggle with the limitations of the DOS shell command.com. (Therefore several quirky ways to split long command lines in target sicher of the appended makefile.) I use djgpps redir program to create a logfile (sml.log), to which the various compiler, assembler and linker messages are appended successively (redirs option -ea). So, an existing logfile, containing junk from earlier compilations, has to be removed _before_ any other action takes place. I achive this by putting the phony target klar first in the prerequisite list of target all. Phony target tst, showing the final results of compilation, is put last, behind the real target. So far, everything works fine. The prerequisites are processed from left to right (as one would expect). However, when updating the makefile itself (target makefile), the order seems to be the reverse. Command echoing (given in the appended file makelog.log) shows re-generation of vid.d first, followed by schirm.d etc., the first prerequisitesim.d, coming last. Prerequisites are processed from right to left! Although this causes no problem, its a bit puzzling, and I cant find anything about it in the documentation. Id like to suggest that one or two sentences about this be added to the (otherwise very good, not to say exhaustive!) documentation. (Or maybe make itself can be changed to a more consistent behaviour?) Greetings Bernhard Strowitzki ____________________________________________________________________ Psssst! Schon vom neuen WEB.DE MultiMessenger gehört? Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123
makefile
Description: Binary data
makelog.log
Description: Binary data
_______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make