[Top][All Lists]

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

possible bug in documentation for make

From: Daniela Rütting
Subject: possible bug in documentation for make
Date: Sat, 25 Oct 2008 22:42:55 +0200


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
ifeq (,$(O))
O = -O
CXXFLAGS = -W -Wall $(O)
but this didn’t 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
ifeq (,$(O))
ifndef OPTIM
OPTIM = $(O)
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 wasn’t told in 
the documentation.

2nd problem:
In most cases, of course, the order of processing the prerequisites doesn’t 
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 djgpp’s ’redir’ program to 
create a logfile (’sml.log’), to which the various compiler, assembler and 
linker messages are appended successively (redir’s 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 prerequisite‚’sim.d’, coming last. Prerequisites are 
processed from right to left!
Although this causes no problem, it’s a bit puzzling, and I can’t find anything 
about it in the documentation. I’d 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 

Bernhard Strowitzki

Psssst! Schon vom neuen WEB.DE MultiMessenger gehört? 
Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123

Attachment: makefile
Description: Binary data

Attachment: makelog.log
Description: Binary data

reply via email to

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