From 87b54385aa3b89234c8c85e4bf6a0da0d13b7a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 12 Jul 2019 10:54:47 +0200 Subject: [PATCH] [scripts] Enable to call "make PLATFORM=blackbox compare" without precising the building directory --- Makefile | 10 +++++++++- ion/src/blackbox/compare.cpp | 6 +++--- scripts/defaults.mak | 9 --------- scripts/targets.blackbox.mak | 5 +++++ scripts/targets.device.mak | 2 +- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index cb31471a8..70157d1ca 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,14 @@ $(addprefix $$(BUILD_DIR)/,$(strip $(2))): $(addprefix $$(BUILD_DIR)/,$(strip $( endif endef +# Define rules for targets +# Those can be built directly with make executable.extension as a shortcut. + +define rules_for_targets +.PHONY: $(1)$(2) +$(1)$(2): $$(BUILD_DIR)/$(1)$(2) +endef + .PHONY: info info: @echo "EPSILON_VERSION = $(EPSILON_VERSION)" @@ -82,7 +90,7 @@ all_objs = $(call object_for,$(all_src)) executables = epsilon epsilon.on-boarding epsilon.on-boarding.update epsilon.on-boarding.beta test -extensions = $(EXE) +extensions = .$(EXE) #define platform generic targets all_epsilon_common_src = $(ion_src) $(liba_src) $(kandinsky_src) $(epsilon_src) $(app_src) $(escher_src) $(libaxx_src) $(poincare_src) $(python_src) $(ion_device_dfu_relocated_src) diff --git a/ion/src/blackbox/compare.cpp b/ion/src/blackbox/compare.cpp index c98e8a747..e49323698 100644 --- a/ion/src/blackbox/compare.cpp +++ b/ion/src/blackbox/compare.cpp @@ -7,12 +7,12 @@ * To use it, first create the two epsilon versions to compare, in a library * format: * git checkout first_hash - * make -j8 PLATFORM=blackbox clean build/release/blackbox/libepsilon_first.o + * make -j8 PLATFORM=blackbox clean libepsilon_first.o * git checkout second_hash - * make -j8 PLATFORM=blackbox clean build/release/blackbox/libepsilon_second.o + * make -j8 PLATFORM=blackbox clean libepsilon_second.o * * To compare the versions on a given scenario: - * make -j8 PLATFORM=blackbox build/release/blackbox/compare + * make -j8 PLATFORM=blackbox compare * ./build/release/blackbox/compare < path/to/scenario * To fuzz over scenarios that are in a folder named "tests": * make -j8 PLATFORM=blackbox TOOLCHAIN=afl compare_fuzz diff --git a/scripts/defaults.mak b/scripts/defaults.mak index 334984d84..edf1cae33 100644 --- a/scripts/defaults.mak +++ b/scripts/defaults.mak @@ -41,12 +41,3 @@ else MODE = release endif BUILD_DIR = build/$(MODE)/$(PLATFORM) - -# Define rules for targets -# Those can be built directly with make executable.extension as a shortcut. - -define rules_for_targets -.PHONY: $(1).$(2) -$(1).$(2): $$(BUILD_DIR)/$(1).$(2) -endef - diff --git a/scripts/targets.blackbox.mak b/scripts/targets.blackbox.mak index dfd19fe82..512a4d937 100644 --- a/scripts/targets.blackbox.mak +++ b/scripts/targets.blackbox.mak @@ -1,5 +1,10 @@ # Compare +executables += libepsilon_first libepsilon_second +extensions += .o + +$(eval $(call rules_for_targets,compare,)) + # TODO: find a way to use rules define by rule_for instead of redeclaring them (we can't use them now because of the different basenames of the object and the source) $(BUILD_DIR)/ion/src/blackbox/library_%.o: SFLAGS += -D EPSILON_LIB_PREFIX=$(*F) diff --git a/scripts/targets.device.mak b/scripts/targets.device.mak index 8c3446c94..af1ac8c60 100644 --- a/scripts/targets.device.mak +++ b/scripts/targets.device.mak @@ -1,7 +1,7 @@ include scripts/targets.device.$(MODEL).mak executables += flasher.light flasher.verbose bench.ram bench.flash -extensions += dfu hex bin +extensions += .dfu .hex .bin $(BUILD_DIR)/%.dfu: $(BUILD_DIR)/%.$(EXE) @echo "DFUSE $@"