1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 12:00:59 +00:00

Makefile: Add GENERATE_CODE function

Fixes #281
This commit is contained in:
Saleem Rashid 2017-12-24 12:33:18 +00:00 committed by Pavol Rusnak
parent d564805baa
commit 7092951a40
2 changed files with 18 additions and 8 deletions

View File

@ -94,19 +94,29 @@ CFLAGS += -DSCM_REVISION='"$(shell git rev-parse HEAD | sed 's:\(..\):\\x\1:g')"
CFLAGS += -DUSE_ETHEREUM=1 CFLAGS += -DUSE_ETHEREUM=1
CFLAGS += -DUSE_NEM=1 CFLAGS += -DUSE_NEM=1
define GENERATE_CODE
# $(1) - Basename for script and output header file
# $(2) - Dependencies
# $(3) - Additional output files
$(1).h $(3): $(1).py $(2)
$(PYTHON) $(1).py
# Serialize build for parallel Make
$(1).h: $(3)
clean::
rm -f $(1).h $(3)
endef
$(eval $(call GENERATE_CODE,nem_mosaics,nem_mosaics.json,nem_mosaics.c))
$(eval $(call GENERATE_CODE,bl_data,../bootloader/bootloader.bin))
coins_count.h: coins-gen.py coins.json coins_count.h: coins-gen.py coins.json
$(PYTHON) $< count > $@ $(PYTHON) $< count > $@
coins_array.h: coins-gen.py coins.json coins_array.h: coins-gen.py coins.json
$(PYTHON) $< array > $@ $(PYTHON) $< array > $@
nem_mosaics.c nem_mosaics.h: nem_mosaics.py nem_mosaics.json
$(PYTHON) $<
bl_data.h: bl_data-gen.py ../bootloader/bootloader.bin
$(PYTHON) $<
clean:: clean::
rm -f coins_count.h coins_array.h rm -f coins_count.h coins_array.h
rm -f nem_mosaics.c nem_mosaics.h
rm -f bl_data.h