24 lines
416 B
Makefile
24 lines
416 B
Makefile
|
|
OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc))
|
|
DEPS := $(OBJS:.o=.dep)
|
|
|
|
all: $(DEPS) $(OBJS)
|
|
|
|
%.o: %.cc
|
|
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
|
|
|
|
# Make dependency files
|
|
%.dep: %.cc
|
|
@set -e; rm -f $@; \
|
|
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
|
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
|
rm -f $@.$$$$
|
|
|
|
clean:
|
|
-$(RM) -f *.o *.dep
|
|
|
|
# Include dependency files
|
|
ifndef clean
|
|
-include $(DEPS)
|
|
endif
|