diff --git a/Makefile b/Makefile index e534745..2e26013 100644 --- a/Makefile +++ b/Makefile @@ -52,9 +52,9 @@ $(shell mkdir -p $(BUILD)) CXXFLAGS := $(DEBUG_FLAGS) -fPIC -fmessage-length=0 -std=c++11 -Wall -Wno-unused-function "-DWMBUSMETERS_VERSION=\"$(VERSION)\"" $(BUILD)/%.o: src/%.cc $(wildcard src/%.h) - $(CXX) $(CXXFLAGS) $< -c -o $@ + $(CXX) $(CXXFLAGS) $< -MMD -c -o $@ -METERS_OBJS:=\ +METER_OBJS:=\ $(BUILD)/aes.o \ $(BUILD)/cmdline.o \ $(BUILD)/config.o \ @@ -104,12 +104,12 @@ wmbusmeters_$(VERSION)_$(DEBARCH).deb: @mv $(BUILD)/debian/wmbusmeters_$(VERSION)_$(DEBARCH).deb . @echo Built package $@ -$(BUILD)/wmbusmeters: $(METERS_OBJS) $(BUILD)/main.o - $(CXX) -o $(BUILD)/wmbusmeters $(METERS_OBJS) $(BUILD)/main.o $(DEBUG_LDFLAGS) -lpthread +$(BUILD)/wmbusmeters: $(METER_OBJS) $(BUILD)/main.o + $(CXX) -o $(BUILD)/wmbusmeters $(METER_OBJS) $(BUILD)/main.o $(DEBUG_LDFLAGS) -lpthread -$(BUILD)/testinternals: $(METERS_OBJS) $(BUILD)/testinternals.o - $(CXX) -o $(BUILD)/testinternals $(METERS_OBJS) $(BUILD)/testinternals.o $(DEBUG_LDFLAGS) -lpthread +$(BUILD)/testinternals: $(METER_OBJS) $(BUILD)/testinternals.o + $(CXX) -o $(BUILD)/testinternals $(METER_OBJS) $(BUILD)/testinternals.o $(DEBUG_LDFLAGS) -lpthread clean: rm -rf build/* build_arm/* build_debug/* build_arm_debug/* *~ @@ -159,3 +159,7 @@ update_manufacturers: echo '#endif' >> m.h rm tmpfile mv m.h src/manufacturers.h + + +# Include dependency information generated by gcc in a previous compile. +include $(wildcard $(patsubst %.o,%.d,$(METER_OBJS)))