dependencies.mk 458 Bytes
Newer Older
phlo's avatar
phlo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
# auto-dependency generation
#
# see http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#combine
DEPFLAGS = -MT $@ -MMD -MP -MF $*.d
MAKE_C = $(CC) $(DEPFLAGS) $(CFLAGS) $(CXXFLAGS) -c $<
MAKE_CXX = $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c $<

%.o: %.c
%.o: %.c %.d
	$(MAKE_C)

%.o: %.cc
%.o: %.cc %.d
	$(MAKE_CXX)

%.o: %.cpp
%.o: %.cpp %.d
	$(MAKE_CXX)

%.o: %.cxx
%.o: %.cxx %.d
	$(MAKE_CXX)

%.d: ;
.PRECIOUS: %.d

include $(wildcard *.d)