improve deps
Stefan Schuermans

Stefan Schuermans commited on 2017-09-24 08:52:39
Showing 2 changed files, with 4 additions and 10 deletions.

... ...
@@ -1,2 +1 @@
1
-deps
2 1
 lib
... ...
@@ -126,19 +126,14 @@ endif
126 126
 .SECONDARY:
127 127
 .SUFFIXES:
128 128
 
129
-all: deps $(TARGET) $(SH_TARGET) $(EX_TARGETS)
129
+all: $(DEPS) $(TARGET) $(SH_TARGET) $(EX_TARGETS)
130 130
 
131 131
 ifneq ($(MAKECMDGOALS),clean)
132
-  include deps
132
+  -include $(DEPS)
133 133
 endif
134 134
 
135
-deps: $(DEPS) $(EX_DEPS)
136
-	cat /dev/null $+ >$@
137
-
138 135
 %.d: %.c
139
-	$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -M -o $@ $<
140
-	sed 's!^$(basename $(notdir $<))!$(dir $<)&!' <$@ >$@.tmp
141
-	mv $@.tmp $@
136
+	$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -MM -MF $@ -MT $(@:.d=.o) $<
142 137
 
143 138
 %.o: %.c
144 139
 	$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -c -o $@ $<
... ...
@@ -168,7 +163,7 @@ ifeq ($(OS),linux)
168 163
 endif
169 164
 
170 165
 clean:
171
-	rm -rf deps $(DEPS) $(OBJS) lib \
166
+	rm -rf $(DEPS) $(OBJS) lib \
172 167
 	       $(EX_DEPS) $(EX_OBJS) $(EX_TARGETS)
173 168
 
174 169
 install: all
175 170