aboutsummaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-10-20 12:09:14 +0000
committerRoy Marples <roy@marples.name>2008-10-20 12:09:14 +0000
commit9c76b077d681914d462c1fe1fb53ef23eb4eb449 (patch)
treec85b11d3b91c85c80004dfb63b30ef587b7e268f /mk
parent0a39145a5e80274599c4d42ab2901c3b6ec0c979 (diff)
Enable use of .depend on gmake. Also, generate extra dependencies for our shared libraries.
Diffstat (limited to 'mk')
-rw-r--r--mk/depend.mk12
-rw-r--r--mk/lib.mk5
-rw-r--r--mk/prog.mk2
3 files changed, 14 insertions, 5 deletions
diff --git a/mk/depend.mk b/mk/depend.mk
index bec382e5..2ae6e1e8 100644
--- a/mk/depend.mk
+++ b/mk/depend.mk
@@ -1,8 +1,5 @@
-# This only works for make implementations that always include a .depend if
-# it exists. Only GNU make does not do this.
-
+# Generate .depend
# Copyright 2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
CLEANFILES+= .depend
IGNOREFILES+= .depend
@@ -10,4 +7,9 @@ IGNOREFILES+= .depend
.depend: ${SRCS}
${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}
diff --git a/mk/lib.mk b/mk/lib.mk
index a5ce0a88..e8b2eb7d 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -56,6 +56,11 @@ check test::
clean:
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}/os.mk
include ${MK}/depend.mk
diff --git a/mk/prog.mk b/mk/prog.mk
index 288327e8..c44b380e 100644
--- a/mk/prog.mk
+++ b/mk/prog.mk
@@ -33,6 +33,8 @@ ${PROG}: ${SCRIPTS} ${OBJS}
clean:
rm -f ${CLEANFILES}
+extra_depend:
+
include ${MK}/sys.mk
include ${MK}/os.mk
include ${MK}/depend.mk