.LIBPATTERNS = lib%.so lib%.a
+DEPFLAGS=-MT $@ -MMD -MP -MF $*.d
+
%.o: %.c
@echo " [CC] $<"
- $(Q) $(CC) -c $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) $(DEFS_$@) $(WFLAGS) $(WCFLAGS) $(CFLAGS) $(CFLAGS_$@) $< -o $@
+ $(Q) $(CC) $(DEPFLAGS) -c $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) $(DEFS_$@) $(WFLAGS) $(WCFLAGS) $(CFLAGS) $(CFLAGS_$@) $< -o $@
%.o: %.cpp
@echo " [CXX] $<"
$(Q) $(RM) $@
$(Q) $(AR) rsv $@ $(OBJECTS) > /dev/null
-%.d: %.c
- @echo " [DEP] $<"
- $(Q) $(MKDIR_P) $(dir $@); \
- set -e; \
- FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \
- DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \
- $(CC) -MM $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) -o $@ $<; \
- sed -i "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" $@; \
- DEPLIST=`sed 's/ \\\\//;s/.*://;' < $@`; \
- echo $$DEPLIST | fmt -1 | sed 's/ //g;s/\(.*\)/\1:/' >> $@; \
- [ -s $@ ] || $(RM) $@
+%.d: ;
+.PRECIOUS: %.d
%.mo: %.po
@echo " [MSGFMT] $<"