2024-02-09 19:50:42 -08:00
|
|
|
# Use SHORT_BOARD_NAME for BUNDLE_NAME if it's empty.
|
|
|
|
# BUNDLE_NAME is usually more specific - it points to a variant of a board.
|
2024-02-05 17:15:36 -08:00
|
|
|
ifeq (,$(BUNDLE_NAME))
|
|
|
|
BUNDLE_NAME = $(SHORT_BOARD_NAME)
|
|
|
|
endif
|
|
|
|
|
2024-02-09 19:50:42 -08:00
|
|
|
# If we're running on Windows, we need to call the .exe of hex2dfu
|
2024-02-01 05:33:16 -08:00
|
|
|
ifneq (,$(findstring NT,$(UNAME_S)))
|
|
|
|
H2D = ../misc/encedo_hex2dfu/hex2dfu.exe
|
|
|
|
else
|
|
|
|
H2D = ../misc/encedo_hex2dfu/hex2dfu.bin
|
|
|
|
endif
|
|
|
|
|
2024-02-09 19:50:42 -08:00
|
|
|
# DFU and DBIN are uploaded as artifacts, so it's easier to have them in the deliver/ directory
|
|
|
|
# than to try uploading them from the rusefi.snapshot.<BUNDLE_NAME> directory
|
2024-02-05 17:15:36 -08:00
|
|
|
DFU = $(DELIVER)/$(PROJECT).dfu
|
|
|
|
DBIN = $(DELIVER)/$(PROJECT).bin
|
2024-03-31 17:53:02 -07:00
|
|
|
FIRMWARE_BIN_OUT = $(FOLDER)/$(PROJECT).bin
|
2024-02-01 05:33:16 -08:00
|
|
|
|
2024-02-09 19:50:42 -08:00
|
|
|
# If provided with a git reference and the LTS flag, use a folder name including the ref
|
|
|
|
# This weird if statement structure is because Make doesn't have &&
|
2024-02-05 17:15:36 -08:00
|
|
|
ifeq ($(LTS),true)
|
|
|
|
ifneq (,$(REF))
|
|
|
|
FOLDER = rusefi.$(REF).$(BUNDLE_NAME)
|
|
|
|
else
|
|
|
|
FOLDER = rusefi.snapshot.$(BUNDLE_NAME)
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
FOLDER = rusefi.snapshot.$(BUNDLE_NAME)
|
|
|
|
endif
|
|
|
|
|
|
|
|
DELIVER = deliver
|
|
|
|
ARTIFACTS = ../artifacts
|
|
|
|
|
|
|
|
BUNDLE_FULL_NAME = rusefi_bundle_$(BUNDLE_NAME)
|
|
|
|
|
|
|
|
CONSOLE_FOLDER = $(FOLDER)/console
|
|
|
|
DRIVERS_FOLDER = $(FOLDER)/drivers
|
|
|
|
|
|
|
|
UPDATE_FOLDER_SOURCES = \
|
|
|
|
$(RUSEFI_CONSOLE_SETTINGS) \
|
|
|
|
$(INI_FILE) \
|
|
|
|
../misc/console_launcher/readme.html
|
|
|
|
# ../misc/console_launcher/rusefi_updater.exe
|
2024-02-09 19:50:42 -08:00
|
|
|
# Uncomment and put a backslash after readme.html to put rusefi_updater.exe in the bundle
|
2024-02-05 17:15:36 -08:00
|
|
|
|
|
|
|
FOLDER_SOURCES = \
|
|
|
|
../java_console/bin
|
|
|
|
|
2024-02-09 19:50:42 -08:00
|
|
|
# Custom board builds don't include the simulator
|
2024-03-03 06:29:04 -08:00
|
|
|
ifneq ($(BUNDLE_SIMULATOR),false)
|
2024-02-23 16:12:41 -08:00
|
|
|
SIMULATOR_OUT = ../simulator/build/rusefi_simulator.exe
|
2024-02-05 17:15:36 -08:00
|
|
|
endif
|
|
|
|
|
2024-02-23 16:12:41 -08:00
|
|
|
UPDATE_CONSOLE_FOLDER_SOURCES = \
|
|
|
|
$(CONSOLE_OUT) \
|
|
|
|
$(AUTOUPDATE_OUT)
|
|
|
|
|
2024-02-05 17:15:36 -08:00
|
|
|
CONSOLE_FOLDER_SOURCES = \
|
|
|
|
../misc/console_launcher/rusefi_autoupdate.exe \
|
|
|
|
../misc/console_launcher/rusefi_console.exe \
|
|
|
|
../misc/install/openocd \
|
|
|
|
../misc/install/STM32_Programmer_CLI \
|
|
|
|
$(wildcard ../java_console/*.dll) \
|
|
|
|
../firmware/ext/openblt/Host/libopenblt.dll \
|
|
|
|
../firmware/ext/openblt/Host/libopenblt.so \
|
|
|
|
../firmware/ext/openblt/Host/libopenblt.dylib \
|
|
|
|
../firmware/ext/openblt/Host/openblt_jni.dll \
|
|
|
|
../firmware/ext/openblt/Host/libopenblt_jni.so \
|
|
|
|
../firmware/ext/openblt/Host/libopenblt_jni.dylib \
|
2024-02-23 16:12:41 -08:00
|
|
|
$(SIMULATOR_OUT)
|
2024-02-05 17:15:36 -08:00
|
|
|
|
2024-02-21 16:01:07 -08:00
|
|
|
BOOTLOADER_BIN = bootloader/blbuild/openblt_$(PROJECT_BOARD).bin
|
|
|
|
BOOTLOADER_HEX = bootloader/blbuild/openblt_$(PROJECT_BOARD).hex
|
|
|
|
|
2024-02-09 19:50:42 -08:00
|
|
|
# We need to put different things in the bundle depending on some meta-info flags
|
2024-02-01 05:33:16 -08:00
|
|
|
ifeq ($(USE_OPENBLT),yes)
|
2024-03-31 17:50:16 -07:00
|
|
|
BOOTLOADER_HEX_OUT = $(BOOTLOADER_HEX)
|
|
|
|
BOOTLOADER_BIN_OUT = $(FOLDER)/openblt.bin
|
2024-02-05 17:15:36 -08:00
|
|
|
SREC_TARGET = $(FOLDER)/rusefi_update.srec
|
2024-02-01 05:33:16 -08:00
|
|
|
else
|
2024-03-31 17:56:24 -07:00
|
|
|
FIRMWARE_OUTPUTS = $(FOLDER)/$(PROJECT).hex
|
2024-02-05 17:15:36 -08:00
|
|
|
BINSRC = $(BUILDDIR)/$(PROJECT).bin
|
2024-02-01 05:33:16 -08:00
|
|
|
ifeq ($(INCLUDE_ELF),yes)
|
2024-03-31 17:56:24 -07:00
|
|
|
FIRMWARE_OUTPUTS += $(FOLDER)/$(PROJECT).elf $(FOLDER)/$(PROJECT).map $(FOLDER)/$(PROJECT).list
|
2024-02-01 05:33:16 -08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2024-02-05 17:15:36 -08:00
|
|
|
ST_DRIVERS = $(DRIVERS_FOLDER)/silent_st_drivers2.exe
|
|
|
|
|
2024-02-09 19:50:42 -08:00
|
|
|
# We're kinda doing things backwards from the normal Make way.
|
|
|
|
# We're listing some files we want to get copied from the bundle,
|
|
|
|
# and these commands turn them into their destination path within the bundle.
|
2024-02-05 17:15:36 -08:00
|
|
|
UPDATE_FOLDER_TARGETS = $(addprefix $(FOLDER)/,$(notdir $(UPDATE_FOLDER_SOURCES)))
|
|
|
|
UPDATE_CONSOLE_FOLDER_TARGETS = $(addprefix $(CONSOLE_FOLDER)/,$(notdir $(UPDATE_CONSOLE_FOLDER_SOURCES)))
|
|
|
|
|
2024-03-31 18:19:06 -07:00
|
|
|
MOST_COMMON_BUNDLE_FILES = \
|
|
|
|
$(UPDATE_FOLDER_TARGETS) \
|
|
|
|
$(UPDATE_CONSOLE_FOLDER_TARGETS)
|
|
|
|
|
2024-02-05 17:15:36 -08:00
|
|
|
UPDATE_BUNDLE_FILES = \
|
2024-03-31 17:56:24 -07:00
|
|
|
$(FIRMWARE_OUTPUTS) \
|
2024-03-31 17:50:16 -07:00
|
|
|
$(BOOTLOADER_BIN_OUT) \
|
2024-03-31 17:53:02 -07:00
|
|
|
$(FIRMWARE_BIN_OUT) \
|
2024-02-05 17:15:36 -08:00
|
|
|
$(SREC_TARGET) \
|
2024-03-31 18:19:06 -07:00
|
|
|
$(MOST_COMMON_BUNDLE_FILES)
|
2024-02-05 17:15:36 -08:00
|
|
|
|
|
|
|
FOLDER_TARGETS = $(addprefix $(FOLDER)/,$(notdir $(FOLDER_SOURCES)))
|
|
|
|
CONSOLE_FOLDER_TARGETS = $(addprefix $(CONSOLE_FOLDER)/,$(notdir $(CONSOLE_FOLDER_SOURCES)))
|
|
|
|
|
2024-03-31 18:19:06 -07:00
|
|
|
FULL_BUNDLE_CONTENT = \
|
2024-02-05 17:15:36 -08:00
|
|
|
$(ST_DRIVERS) \
|
|
|
|
$(FOLDER_TARGETS) \
|
|
|
|
$(CONSOLE_FOLDER_TARGETS)
|
|
|
|
|
2024-03-31 18:19:06 -07:00
|
|
|
BUNDLE_FILES = \
|
|
|
|
$(UPDATE_BUNDLE_FILES) \
|
|
|
|
$(FULL_BUNDLE_CONTENT)
|
|
|
|
|
2024-03-24 10:44:55 -07:00
|
|
|
$(SIMULATOR_OUT): $(CONFIG_FILES) .FORCE
|
2024-03-21 19:08:12 -07:00
|
|
|
$(MAKE) -C ../simulator -r OS="Windows_NT" SUBMAKE=yes
|
2024-02-06 16:37:06 -08:00
|
|
|
|
2024-03-23 18:25:28 -07:00
|
|
|
# make Windows simulator a prerequisite so that we don't try compiling them concurrently
|
2024-03-24 10:44:55 -07:00
|
|
|
../simulator/build/rusefi_simulator: $(CONFIG_FILES) .FORCE | $(SIMULATOR_OUT)
|
2024-03-21 19:08:12 -07:00
|
|
|
$(MAKE) -C ../simulator -r OS="Linux" SUBMAKE=yes
|
2024-03-11 18:52:08 -07:00
|
|
|
|
2024-02-22 05:33:12 -08:00
|
|
|
$(BOOTLOADER_HEX) $(BOOTLOADER_BIN): .bootloader-sentinel ;
|
|
|
|
|
2024-02-09 19:50:42 -08:00
|
|
|
# We pass SUBMAKE=yes to the bootloader Make instance so it knows not to try to build configs,
|
|
|
|
# as that would result in two simultaneous config generations, which causes issues.
|
2024-03-24 10:44:55 -07:00
|
|
|
.bootloader-sentinel: $(CONFIG_FILES) .FORCE
|
2024-03-02 07:16:20 -08:00
|
|
|
BOARD_DIR=../$(BOARD_DIR) BOARD_META_PATH=../$(BOARD_META_PATH) TGT_SENTINEL=../$(TGT_SENTINEL) $(MAKE) -C bootloader -r SUBMAKE=yes
|
2024-02-22 05:33:12 -08:00
|
|
|
@touch $@
|
2024-02-03 17:06:33 -08:00
|
|
|
|
2024-02-01 05:33:16 -08:00
|
|
|
$(BUILDDIR)/$(PROJECT).map: $(BUILDDIR)/$(PROJECT).elf
|
|
|
|
|
2024-02-05 17:15:36 -08:00
|
|
|
$(SREC_TARGET): $(BUILDDIR)/rusefi.srec
|
2024-02-20 13:48:26 -08:00
|
|
|
ln -rfs $< $@
|
|
|
|
|
2024-03-31 17:56:24 -07:00
|
|
|
$(FIRMWARE_OUTPUTS): $(FOLDER)/%: $(BUILDDIR)/% | $(FOLDER)
|
2024-02-05 17:15:36 -08:00
|
|
|
ln -rfs $< $@
|
2024-02-01 05:33:16 -08:00
|
|
|
|
2024-03-31 17:50:16 -07:00
|
|
|
$(BOOTLOADER_BIN_OUT): $(FOLDER)/openblt%: bootloader/blbuild/openblt_$(PROJECT_BOARD)% | $(FOLDER)
|
2024-02-05 17:15:36 -08:00
|
|
|
ln -rfs $< $@
|
|
|
|
|
2024-03-31 17:53:02 -07:00
|
|
|
$(FIRMWARE_BIN_OUT) $(FOLDER)/$(PROJECT).dfu: $(FOLDER)/%: $(DELIVER)/% | $(FOLDER)
|
2024-02-05 17:15:36 -08:00
|
|
|
ln -rfs $< $@
|
2024-02-01 05:33:16 -08:00
|
|
|
|
2024-02-09 19:50:42 -08:00
|
|
|
# The DFU is currenly not included in the bundle, so these prerequisites are listed as order-only to avoid building it.
|
|
|
|
# If you want it, you can build it with `make rusefi.snapshot.$BUNDLE_NAME/rusefi.dfu`
|
2024-02-21 19:14:38 -08:00
|
|
|
$(DFU) $(DBIN): .h2d-sentinel ;
|
|
|
|
|
2024-03-31 17:50:16 -07:00
|
|
|
.h2d-sentinel: $(BUILDDIR)/$(PROJECT).hex $(BOOTLOADER_HEX_OUT) $(BINSRC) | $(DELIVER)
|
2024-02-01 05:33:16 -08:00
|
|
|
ifeq ($(USE_OPENBLT),yes)
|
2024-02-05 17:15:36 -08:00
|
|
|
$(H2D) -i $(BOOTLOADER_HEX) -i $(BUILDDIR)/$(PROJECT).hex -C 0x1C -o $(DFU) -b $(DBIN)
|
2024-02-01 05:33:16 -08:00
|
|
|
else
|
2024-02-05 17:15:36 -08:00
|
|
|
$(H2D) -i $(BUILDDIR)/$(PROJECT).hex -C 0x1C -o $(DFU)
|
|
|
|
cp $(BUILDDIR)/$(PROJECT).bin $(DBIN)
|
2024-02-01 05:33:16 -08:00
|
|
|
endif
|
2024-02-21 19:14:38 -08:00
|
|
|
@touch $@
|
2024-02-01 05:33:16 -08:00
|
|
|
|
2024-03-31 03:59:18 -07:00
|
|
|
OBFUSCATED_SREC = $(FOLDER)/rusefi-obfuscated.srec
|
|
|
|
|
2024-03-18 18:31:05 -07:00
|
|
|
OBFUSCATED_OUT = \
|
|
|
|
$(FOLDER)/rusefi-obfuscated.bin \
|
2024-03-31 03:59:18 -07:00
|
|
|
$(OBFUSCATED_SREC)
|
2024-03-18 18:31:05 -07:00
|
|
|
|
|
|
|
$(OBFUSCATED_OUT): .obfuscated-sentinel
|
|
|
|
|
|
|
|
.obfuscated-sentinel: $(BUILDDIR)/$(PROJECT).bin
|
|
|
|
[ -z "$(POST_BUILD_SCRIPT)" ] || bash $(POST_BUILD_SCRIPT) $(BUILDDIR)/$(PROJECT).bin $(OBFUSCATED_OUT)
|
|
|
|
@touch $@
|
2024-03-07 15:58:38 -08:00
|
|
|
|
2024-02-05 17:15:36 -08:00
|
|
|
$(ST_DRIVERS): | $(DRIVERS_FOLDER)
|
|
|
|
wget https://rusefi.com/build_server/st_files/silent_st_drivers2.exe -P $(dir $@)
|
2024-02-01 05:33:16 -08:00
|
|
|
|
2024-03-31 17:43:35 -07:00
|
|
|
$(DELIVER) $(ARTIFACTS) $(FOLDER) $(CONSOLE_FOLDER) $(DRIVERS_FOLDER):
|
2024-02-05 17:15:36 -08:00
|
|
|
mkdir -p $@
|
|
|
|
|
2024-03-07 15:58:38 -08:00
|
|
|
$(ARTIFACTS)/$(BUNDLE_FULL_NAME).zip: $(BUNDLE_FILES) | $(ARTIFACTS)
|
2024-02-05 17:15:36 -08:00
|
|
|
zip -r $@ $(BUNDLE_FILES)
|
|
|
|
|
2024-03-18 18:31:05 -07:00
|
|
|
$(ARTIFACTS)/$(BUNDLE_FULL_NAME)_obfuscated_public.zip: $(OBFUSCATED_OUT) $(BUNDLE_FILES) | $(ARTIFACTS)
|
2024-03-31 17:50:16 -07:00
|
|
|
zip -r $@ $(FULL_BUNDLE_CONTENT) $(MOST_COMMON_BUNDLE_FILES) $(OBFUSCATED_SREC)
|
2024-03-07 15:58:38 -08:00
|
|
|
|
2024-02-09 19:50:42 -08:00
|
|
|
# The autopdate zip doesn't have a folder with the bundle contents
|
2024-03-07 15:58:38 -08:00
|
|
|
$(ARTIFACTS)/$(BUNDLE_FULL_NAME)_autoupdate.zip: $(UPDATE_BUNDLE_FILES) | $(ARTIFACTS)
|
2024-02-05 17:15:36 -08:00
|
|
|
cd $(FOLDER) && zip -r ../$@ $(subst $(FOLDER)/,,$(UPDATE_BUNDLE_FILES))
|
|
|
|
|
2024-03-31 18:26:30 -07:00
|
|
|
$(ARTIFACTS)/$(BUNDLE_FULL_NAME)_obfuscated_public_autoupdate.zip: $(OBFUSCATED_OUT) $(BUNDLE_FILES) | $(ARTIFACTS)
|
|
|
|
cd $(FOLDER) && zip -r ../$@ $(subst $(FOLDER)/,,$(MOST_COMMON_BUNDLE_FILES)) $(subst $(FOLDER)/,,$(OBFUSCATED_SREC))
|
|
|
|
|
2024-03-24 15:02:34 -07:00
|
|
|
.PHONY: bundle bundles autoupdate obfuscated bin hex dfu map elf list srec bootloader
|
|
|
|
|
|
|
|
bundle: $(ARTIFACTS)/$(BUNDLE_FULL_NAME).zip
|
|
|
|
autoupdate: $(ARTIFACTS)/$(BUNDLE_FULL_NAME)_autoupdate.zip
|
2024-03-31 21:30:45 -07:00
|
|
|
obfuscated: $(ARTIFACTS)/$(BUNDLE_FULL_NAME)_obfuscated_public.zip $(ARTIFACTS)/$(BUNDLE_FULL_NAME)_obfuscated_public_autoupdate.zip
|
2024-03-24 15:02:34 -07:00
|
|
|
bundles: bundle autoupdate
|
|
|
|
|
|
|
|
bootloader: $(BOOTLOADER_BIN)
|
|
|
|
|
|
|
|
bin: $(DBIN)
|
|
|
|
hex: $(BUILDDIR)/$(PROJECT).hex
|
|
|
|
dfu: $(DFU)
|
|
|
|
srec: $(BUILDDIR)/rusefi.srec
|
|
|
|
elf: $(BUILDDIR)/$(PROJECT).elf
|
|
|
|
map: $(BUILDDIR)/$(PROJECT).map
|
|
|
|
list: $(BUILDDIR)/$(PROJECT).list
|
2024-03-01 12:15:05 -08:00
|
|
|
|
2024-02-19 15:31:47 -08:00
|
|
|
CLEAN_BUNDLE_HOOK:
|
2024-02-06 16:37:06 -08:00
|
|
|
@echo Cleaning Bundle
|
|
|
|
$(MAKE) -C ../simulator clean
|
2024-02-19 15:31:47 -08:00
|
|
|
BOARD_DIR=../$(BOARD_DIR) BOARD_META_PATH=../$(BOARD_META_PATH) $(MAKE) -C bootloader clean
|
|
|
|
rm -rf $(FOLDER)
|
2024-03-01 12:31:49 -08:00
|
|
|
rm -rf $(DELIVER)
|
2024-03-02 15:33:31 -08:00
|
|
|
rm -f .*-sentinel
|
2024-02-06 16:37:06 -08:00
|
|
|
@echo Done Cleaning Bundle
|
2024-02-05 17:15:36 -08:00
|
|
|
|
2024-02-09 19:50:42 -08:00
|
|
|
# We need to use secondary expansion on these rules to find the target file in the source file list.
|
2024-02-05 17:15:36 -08:00
|
|
|
PERCENT = %
|
|
|
|
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
$(FOLDER_TARGETS) $(UPDATE_FOLDER_TARGETS): $(FOLDER)/%: $$(filter $$(PERCENT)$$*,$(FOLDER_SOURCES) $(UPDATE_FOLDER_SOURCES)) | $(FOLDER)
|
|
|
|
ln -rfs $< $@
|
|
|
|
|
|
|
|
$(CONSOLE_FOLDER_TARGETS) $(UPDATE_CONSOLE_FOLDER_TARGETS): $(CONSOLE_FOLDER)/%: $$(filter $$(PERCENT)$$*,$(CONSOLE_FOLDER_SOURCES) $(UPDATE_CONSOLE_FOLDER_SOURCES)) | $(CONSOLE_FOLDER)
|
|
|
|
ln -rfs $< $@
|