Fix Makefile
- Pass INCPATH to CPP - Delete whole build dir
This commit is contained in:
parent
19b21f65d5
commit
bf9677f2ae
7
Makefile
7
Makefile
|
@ -16,17 +16,18 @@ $(BUILD_DIR)/%.c.deps.mk: $(SRC_DIR)/%.c
|
|||
echo include common.mk > $@
|
||||
@printf '%s: ' "$@" >> $@
|
||||
@# SIC: not `read -r`
|
||||
@$(CPP) $(CPPFLAGS) -M $(SRC_DIR)/$*.c | { read target deps; echo "$$deps" ;} >> $@
|
||||
@$(CPP) $(CPPFLAGS) $(INCPATH) -M $(SRC_DIR)/$*.c | { read target deps; echo "$$deps" ;} >> $@
|
||||
@echo ' rm $@' >> $@
|
||||
@echo ' $$(MAKE) -f Makefile $$(MFLAGS) $$(MAKEOVERRIDES) $@' >> $@
|
||||
@printf '%s/%s' "$(BUILD_DIR)" "$(dir $*)" >> $@
|
||||
$(CPP) $(CPPFLAGS) -M $(SRC_DIR)/$*.c >> $@
|
||||
$(CPP) $(CPPFLAGS) $(INCPATH) -M $(SRC_DIR)/$*.c >> $@
|
||||
echo ' $(CC) -c $$< $$(CPPFLAGS) $$(CFLAGS) $$(INCPATH) -o $$@' >> $@
|
||||
|
||||
ifneq ($(BUILD_DIR),)
|
||||
# Avoid `rm /`
|
||||
clean:
|
||||
-rm main $(BUILD_DIR)/*.o $(BUILD_DIR)/*.deps.mk
|
||||
-rm server
|
||||
-rm -r $(BUILD_DIR)
|
||||
endif
|
||||
|
||||
.PHONY: $(shell find $(BUILD_DIR) -name '*.deps.mk')
|
||||
|
|
Loading…
Reference in New Issue