summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2000-07-07 19:42:07 +0000
committerleo2000-07-07 19:42:07 +0000
commit4f58d285588e75ed357e588b2bf584068be6a5a9 (patch)
treec48a333456c471f8f66e30fa1a96d0b49126adba
parent8b2fedb2e9f901d146af77e0f539213f56ce1455 (diff)
Better way of creating .d files, awk is not needed anymore
Removed 'make' warnings if .d files are missing git-svn-id: http://svn.leocad.org/trunk@79 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rw-r--r--Makefile6
-rwxr-xr-xdepend.sh7
2 files changed, 7 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index f7e78af..4c0b610 100644
--- a/Makefile
+++ b/Makefile
@@ -46,16 +46,16 @@ bin:
### include the C/C++ include
### dependencies
-include $(OBJ:.o=.d)
+-include $(OBJ:.o=.d)
### calculate C/C++ include
### dependencies
%.d: %.c
- @./depend.sh $@ $(CC) $(CFLAGS) $(CPPFLAGS) -w $<
+ @./depend.sh $@ $(@D) $(CC) $(CFLAGS) $(CPPFLAGS) -w $<
@[ -s $@ ] || rm -f $@
%.d: %.cpp
- @./depend.sh $@ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -w $<
+ @./depend.sh $@ $(@D) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -w $<
@[ -s $@ ] || rm -f $@
diff --git a/depend.sh b/depend.sh
index f1da434..bfc887c 100755
--- a/depend.sh
+++ b/depend.sh
@@ -1,10 +1,11 @@
#!/bin/sh
DEP=$1
-CC=$2
-shift 2
+DIR=$2
+CC=$3
+shift 3
-echo -n "$DEP" | awk '{ ORS = ""; print $1 " "; sub (".d", ".o"); print $1 " "; }' > $DEP
+echo -n "$DEP $DIR/" > $DEP
( $CC -MM $* || exit 1 ) >> $DEP
#sed -e 's@^\(.*\)\.o:@\1.d \1.o:@'