glitch in 4.2 BSD make
Jim Leinweber
jiml at uwslh.UUCP
Fri Sep 12 05:54:44 AEST 1986
In some circumstances, make gets the file names on the generated
commands wrong. I don't know a fix.
Example: in the following sample makefile, "make lint" works, "make all"
works, "make all lint" works, but "make lint all" produces garbled commands.
The problem seems to be an interaction between the default rules for
lex.l -> lex.c -> lex.o and the overdone dependency "lint : ... lex.l lex.c".
% cat bug.mak
CC1NULL = $(CC) $(CFLAGS) -o $* $*.c
SRC = alarmd.c bd_main.c lex.l batchq.c
H = batchq.h batchd.h include.h lex.h
BDO = bd_main.o lex.o
all : alarmd batchd batchq
alarmd : alarmd.c batchq.h ; $(CC1NULL)
batchd : $(BDO) ; $(CC) $(CFLAGS) -o batchd $(BDO) -ll
batchq : batchq.c batchq.h ; $(CC1NULL)
lex.c : lex.l lex.h
$(BDO): batchd.h batchq.h
lint : $(SRC) $H lex.c
lint -achpx bd_*.c lex.c > lint
lint -achpx batch.c >> lint
lint -achpx batchq.c >> lint
% make -n -f bug.mak all lint # this one is correct
cc -o alarmd alarmd.c
cc -c bd_main.c
lex lex.l
mv lex.yy.c lex.c
cc -c lex.c
cc -o batchd bd_main.o lex.o -ll
cc -o batchq batchq.c
lint -achpx bd_*.c lex.c > lint
lint -achpx batch.c >> lint
lint -achpx batchq.c >> lint
% make -n -f bug.mak lint all # this one is wrong
lex lex.l
mv lex.yy.c lex.c
lint -achpx bd_*.c lex.c > lint
lint -achpx batch.c >> lint
lint -achpx batchq.c >> lint
cc -o lex lex.c # should be alarmd
cc -c bd_main.c
cc -c lex.c
cc -o batchd bd_main.o lex.o -ll
cc -o lex lex.c # should be batchq
Jim Leinweber usenet: jiml at uwslh.uucp
State Hygiene Laboratory {seismo, harvard, topaz, ihnp4,...}!
University of Wisconsin uwvax!uwslh!jiml
465 Henry Mall internet: uwslh!jiml at wisc.edu
Madison, Wisconsin, USA 53706 phone: (608) 262-8092
--
James E. Leinweber ...!{seismo,harvard,topaz,ihnp4}!uwvax!uwslh!jiml
Wisconsin State Hygiene Lab (608) 262-8092
University of Wisconsin; 465 Henry Mall; Madison, WI 53706
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list