make(1) question

Oliver Laumann net at tub.UUCP
Tue Aug 14 23:19:26 AEST 1990


What is /bin/make supposed to do with the following Makefile (provided
that foo.c exists)?

% cat Makefile
.DEFAULT:
	echo Ouch.

all:	foo.o

foo.o:	foo.c
	cc -c foo.c
%

Note that the rule for "all" doesn't have commands.

Under all versions of UNIX where I have tested it (lots!), it only
compiles foo.c.  GNU make, on the other hand, compiles foo.c and then
executes the command under the .DEFAULT rule.

The 4.3BSD manual for make(1) says that if a target must be created and
there are neither any explicit commands nor a relevant built-in rule,
then the commands under the .DEFAULT are executed.  So GNU make seems
to be correct.  Is this true?

If so, how can I modify the above Makefile to suppress execution of the
.DEFAULT commands (provided the .DEFAULT rule must be there for other
reasons)?  Add a "dummy" echo command to the "all" rule?  Or an empty
command, i.e. just a tab character?  (We don't have GNU make here.)

Thanks,
--
Oliver Laumann     net at TUB.BITNET     net at tub.cs.tu-berlin.de     net at tub.UUCP



More information about the Comp.unix.questions mailing list