mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[scripts] Enable to build targets without specifying the building
directory
This commit is contained in:
14
Makefile
14
Makefile
@@ -81,6 +81,8 @@ objs = $(call object_for,$(src))
|
||||
# but allows correct yet optimal incremental builds.
|
||||
-include $(objs:.o=.d)
|
||||
|
||||
executables = epsilon test
|
||||
|
||||
#define platform generic targets
|
||||
|
||||
$(BUILD_DIR)/epsilon.$(EXE): $(objs) $(call object_for,$(ion_device_dfu_relocated_src) $(epsilon_src))
|
||||
@@ -91,17 +93,7 @@ $(BUILD_DIR)/test.$(EXE): $(BUILD_DIR)/quiz/src/tests_symbols.o $(objs) $(call o
|
||||
# We include them before the standard ones to give them precedence.
|
||||
-include scripts/targets.$(PLATFORM).mak
|
||||
|
||||
# Define rules for executables
|
||||
# Those can be built directly with make executable.exe as a shortcut. They also
|
||||
# depends on $(objs)
|
||||
|
||||
executables = epsilon test
|
||||
define rules_for_executable
|
||||
.PHONY: $(1).$$(EXE)
|
||||
$(1).$$(EXE): $$(BUILD_DIR)/$(1).$$(EXE)
|
||||
endef
|
||||
|
||||
$(foreach executable,$(executables),$(eval $(call rules_for_executable,$(executable))))
|
||||
$(foreach executable,$(executables),$(eval $(call rules_for_targets,$(executable),$(EXE))))
|
||||
|
||||
# Define standard compilation rules
|
||||
|
||||
|
||||
@@ -35,3 +35,12 @@ ifeq ("$(origin V)", "command line")
|
||||
endif
|
||||
|
||||
BUILD_DIR = build/$(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
|
||||
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
%.dfu: %.$(EXE)
|
||||
executables += flasher.light flasher.verbose bench.RAM bench.flash
|
||||
extensions = dfu hex bin
|
||||
|
||||
$(foreach extension,$(extensions),$(foreach executable,$(executables),$(eval $(call rules_for_targets,$(executable),$(extension)))))
|
||||
|
||||
$(BUILD_DIR)/%.dfu: $(BUILD_DIR)/%.$(EXE)
|
||||
@echo "DFUSE $@"
|
||||
$(Q) $(PYTHON) scripts/device/elf2dfu.py $< $@
|
||||
|
||||
%.hex: %.$(EXE)
|
||||
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.$(EXE)
|
||||
@echo "OBJCOPY $@"
|
||||
$(Q) $(OBJCOPY) -O ihex $< $@
|
||||
|
||||
%.bin: %.$(EXE)
|
||||
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.$(EXE)
|
||||
@echo "OBJCOPY $@"
|
||||
$(Q) $(OBJCOPY) -O binary $< $@
|
||||
# We pad the device binary files because there was a bug in an older version of
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
executables += test_external_flash
|
||||
|
||||
$(BUILD_DIR)/test_external_flash.$(EXE): LDSCRIPT = ion/test/external_flash_tests.ld
|
||||
$(BUILD_DIR)/test_external_flash.$(EXE): $(BUILD_DIR)/quiz/src/external_flash_tests_symbols.o $(runner_objs) $(call object_for,$(tests_external_flash)) $(call object_for,$(ion_device_dfu_relocated_src))
|
||||
|
||||
Reference in New Issue
Block a user