Merge pull request #615 from AndersHoglund/makefile_clean_rules

Tidy up the Makefile clean rules,
This commit is contained in:
Martin Budden 2016-06-27 18:29:18 +01:00 committed by GitHub
commit fc8a5b4f1c
1 changed files with 23 additions and 11 deletions

View File

@ -667,24 +667,36 @@ $(VALID_TARGETS):
$(MAKE) -j binary hex TARGET=$@ && \ $(MAKE) -j binary hex TARGET=$@ && \
echo "Building $@ succeeded." echo "Building $@ succeeded."
## clean : clean up all temporary / machine-generated files
CLEAN_TARGETS = $(addprefix clean_,$(VALID_TARGETS) )
TARGETS_CLEAN = $(addsuffix _clean,$(VALID_TARGETS) )
## clean : clean up temporary / machine-generated files
clean: clean:
echo "Cleaning $(TARGET)"
rm -f $(CLEAN_ARTIFACTS) rm -f $(CLEAN_ARTIFACTS)
rm -rf $(OBJECT_DIR)/$(TARGET) rm -rf $(OBJECT_DIR)/$(TARGET)
echo "Cleaning $(TARGET) succeeded."
## clean_test : clean up all temporary / machine-generated files (tests) ## clean_test : clean up temporary / machine-generated files (tests)
clean_test: clean_test:
cd src/test && $(MAKE) clean || true cd src/test && $(MAKE) clean || true
## clean_all_targets : clean all valid target platforms ## clean_<TARGET> : clean up one specific target
clean_all: $(CLEAN_TARGETS) :
for clean_target in $(VALID_TARGETS); do \ $(MAKE) -j TARGET=$(subst clean_,,$@) clean
echo "" && \
echo "Cleaning $$clean_target" && \ ## <TARGET>_clean : clean up one specific target (alias for above)
$(MAKE) -j TARGET=$$clean_target clean || \ $(TARGETS_CLEAN) :
break; \ $(MAKE) -j TARGET=$(subst _clean,,$@) clean
echo "Cleaning $$clean_target succeeded."; \
done ## clean_all : clean all valid targets
clean_all:$(CLEAN_TARGETS)
## all_clean : clean all valid targets (alias for above)
all_clean:$(TARGETS_CLEAN)
flash_$(TARGET): $(TARGET_HEX) flash_$(TARGET): $(TARGET_HEX)
stty -F $(SERIAL_DEVICE) raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon stty -F $(SERIAL_DEVICE) raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon