Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jun 2014 18:14:05 +0100
From:      Dave Hines <freebsd@dph.fluff.org>
To:        freebsd-questions@freebsd.org
Subject:   Problem with FreeBSD 10.0-RELEASE change in "make" behavior
Message-ID:  <20140606171405.GA17486@dph.fluff.org>

next in thread | raw e-mail | index | archive | help
I have a Makefile which builds a library, which used to work using
FreeBSD make but which fails using the default make installed in
FreeBSD 10.0-RELEASE.

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)
	$(RANLIB) $(.TARGET)
	rm -f $(.OODATE)

$(OBJ:.o=.c):
	touch $(.TARGET)

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140606171405.GA17486>