Enable use of .depend on gmake. Also, generate extra dependencies for our shared libraries.

This commit is contained in:
Roy Marples 2008-10-20 12:09:14 +00:00
parent 0a39145a5e
commit 9c76b077d6
3 changed files with 14 additions and 5 deletions

View File

@ -1,8 +1,5 @@
# This only works for make implementations that always include a .depend if # Generate .depend
# it exists. Only GNU make does not do this.
# Copyright 2008 Roy Marples <roy@marples.name> # Copyright 2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
CLEANFILES+= .depend CLEANFILES+= .depend
IGNOREFILES+= .depend IGNOREFILES+= .depend
@ -10,4 +7,9 @@ IGNOREFILES+= .depend
.depend: ${SRCS} .depend: ${SRCS}
${CC} ${CPPFLAGS} -MM ${SRCS} > .depend ${CC} ${CPPFLAGS} -MM ${SRCS} > .depend
depend: .depend depend: .depend extra_depend
# Nasty hack for gmake which does not automatically include .depend
# if it exists, unlike every other make implementation.
INC_DEPEND= $(shell if test -e .depend; then echo ".depend"; else echo ""; fi)
include ${INC_DEPEND}

View File

@ -56,6 +56,11 @@ check test::
clean: clean:
rm -f ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK} ${CLEANFILES} rm -f ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK} ${CLEANFILES}
extra_depend:
@TMP=depend.$$$$; \
${SED} -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.So:/' .depend > $${TMP}; \
mv $${TMP} .depend
include ${MK}/sys.mk include ${MK}/sys.mk
include ${MK}/os.mk include ${MK}/os.mk
include ${MK}/depend.mk include ${MK}/depend.mk

View File

@ -33,6 +33,8 @@ ${PROG}: ${SCRIPTS} ${OBJS}
clean: clean:
rm -f ${CLEANFILES} rm -f ${CLEANFILES}
extra_depend:
include ${MK}/sys.mk include ${MK}/sys.mk
include ${MK}/os.mk include ${MK}/os.mk
include ${MK}/depend.mk include ${MK}/depend.mk