Browse code

make: depends move/rm file fix & optimization

- fix for make failing if the depends were made and a *.h is moved
or deleted
- avoid restarting make when depends change (make the depends at
the same moment when the .o are generated)

Andrei Pelinescu-Onciul authored on 09/03/2010 20:57:25
Showing 1 changed files
... ...
@@ -94,11 +94,9 @@ exec_cmd= $(if $($(quiet)_cmd_$(1)),\
94 94
 #implicit rules
95 95
 %.o:%.c  $(ALLDEP)
96 96
 	$(call exec_cmd,CC)
97
-
98
-%.d: %.c $(ALLDEP)
99
-	@set -e; $(MKDEP) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) $<\
100
-	    |  sed 's#\(\($(*D)/\)\{0,1\}$(*F)\)\.o[ :]*#$*.o $@ : #g' > $@; \
101
-	    test -s $@ || ( rm -f $@; false )
97
+	@$(MKDEP) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) $< \
98
+	|  sed	-e 's/#.*//' -e '/:[ 	]*$$/d' -e '/^[ 	]*$$/d' \
99
+				-e 's#.*:#$@: $$(wildcard #g' -e 's/\([^\\]\)$$/\1)/'> $*.d
102 100
 
103 101
 # use RPATH and SER_LIBS if needed (make install and the module depends
104 102
 # on some ser libs)
... ...
@@ -203,9 +201,6 @@ makecfg.lst:
203 203
 .PHONY: all
204 204
 all: $(NAME) every-module
205 205
 
206
-.PHONY: dep
207
-dep: $(depends)
208
-
209 206
 .PHONY: static
210 207
 static: $(objs)
211 208