Problem with FreeBSD 10.0-RELEASE change in "make" behavior

Dave Hines freebsd at
Fri Jun 6 17:58:11 UTC 2014

I have a Makefile which builds a library, which used to work using
FreeBSD make but which fails using the default make installed in

It appears that library dependancy line which correctly causes out
of date .o files to be re-created, will not always cause the commands
following it to be executed.

eg. using the following Makefile:

make		# This correctly builds the .c, .o & library files
touch x.c	# update x.o so the library needs updating
make  		# This updates x.o, but does not update the library

Is this change in how make works intended ? - and if so how should I
be making a library now ?

Thanks -- Dave Hines.

---------------------- Test Makefile follows ----------------------
# Test Makefile which works with old FreeBSD make, but fails
# with the make installed by default in FreeBSD 10.0-RELEASE

# Demonstrate using "make; touch x.c; make", and note that although
# x.o is updated by the second "make", none of the commands following
# the library dependancy are executed, so the libray itself is not
# updated.

OBJ=    x.o y.o
LIB=    lib.a

$(LIB): $(LIB)($(OBJ))
	ar cru $(.TARGET) $(.OODATE)
	rm -f $(.OODATE)

	touch $(.TARGET)

	rm -f $(LIB) $(OBJ) $(OBJ:.o=.c)

More information about the freebsd-questions mailing list