summaryrefslogtreecommitdiff
path: root/makefiles/depend.mk
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2008-09-27 17:52:05 +0000
committerAndreas Baumann <abaumann@yahoo.com>2008-09-27 17:52:05 +0000
commit6b1b9863d8fccfe09c2f72c68e1ebfeea54efbe8 (patch)
tree0c4e761c5b5aad7010c210a4519a2a72760af55d /makefiles/depend.mk
parenteedc9cd68aef078e4584e43d8055d70e1fa07351 (diff)
downloadnagios-plugin-curl-6b1b9863d8fccfe09c2f72c68e1ebfeea54efbe8.tar.gz
nagios-plugin-curl-6b1b9863d8fccfe09c2f72c68e1ebfeea54efbe8.tar.bz2
- added first runnig version
Diffstat (limited to 'makefiles/depend.mk')
-rw-r--r--makefiles/depend.mk30
1 files changed, 30 insertions, 0 deletions
diff --git a/makefiles/depend.mk b/makefiles/depend.mk
new file mode 100644
index 0000000..bd49fe1
--- /dev/null
+++ b/makefiles/depend.mk
@@ -0,0 +1,30 @@
+# provides generic rules for C/C++ dependeny generation using
+# 'makedepend', 'gcc -MM' or similar mechanisms
+#
+# requires:
+# - compilers CC and CCPP
+# - INCLUDEDIRS
+# - OBJS, CPP_OBJS and BIN_OBJS
+#
+# provides:
+# - included dependency files
+#
+# author: Andreas Baumann, abaumann at yahoo dot com
+
+MAKEDEPEND = $(CC) -MM $(INCLUDE_DIRS)
+CCPP_MAKEDEPEND = $(CCPP) -MM $(INCLUDE_DIRS)
+
+%.d : %.c
+ @echo Generating dependencies for $<
+ @$(MAKEDEPEND) $(CFLAGS) $< | \
+ sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@
+
+%.d : %.cpp
+ @echo Generating dependencies for $<
+ @$(CCPP_MAKEDEPEND) $(CCPPFLAGS) $< | \
+ sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@
+
+-include $(OBJS:.o=.d)
+-include $(CPP_OBJS:.o=.d)
+-include $(BIN_OBJS:.o=.d)
+-include $(CPP_BIN_OBJS:.o=.d)