Skip to content

Commit

Permalink
Merge branch 'dev' into TS101
Browse files Browse the repository at this point in the history
  • Loading branch information
discip authored Jun 16, 2023
2 parents be3e1ea + 5b1c273 commit 0d86d7b
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ LANGUAGE_GROUP_EUR_NAME=European
LANGUAGE_GROUPS=CUSTOM CJK CYRILLIC EUR


# Define for host Python
ifndef HOST_PYTHON
HOST_PYTHON:=python3
endif

# Defines for host tools
ifeq ($(HOST_CC),)
HOST_CC := gcc
Expand Down Expand Up @@ -596,7 +601,7 @@ firmware-%: $(HEXFILE_DIR)/$(model)_%.hex $(HEXFILE_DIR)/$(model)_%.bin $(HEXFIL
$(SIZE) $<

%.dfu : %.bin Makefile
python3 dfuse-pack.py -b $(DEVICE_DFU_ADDRESS)@0:$< -D $(DEVICE_DFU_VID_PID) $@
$(HOST_PYTHON) dfuse-pack.py -b $(DEVICE_DFU_ADDRESS)@0:$< -D $(DEVICE_DFU_VID_PID) $@

$(HEXFILE_DIR)/$(model)_%.elf : \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
Expand Down Expand Up @@ -656,15 +661,16 @@ Core/Gen/Translation.%.cpp $(OUTPUT_DIR)/Core/Gen/translation.files/%.pickle: ..
@test -d Core/Gen || mkdir -p Core/Gen
@test -d $(OUTPUT_DIR)/Core/Gen/translation.files || mkdir -p $(OUTPUT_DIR)/Core/Gen/translation.files
@echo 'Generating translations for language $*'
@python3 ../Translations/make_translation.py \
@$(HOST_PYTHON) ../Translations/make_translation.py \
--macros $(PWD)/Core/Gen/macros.txt \
-o $(PWD)/Core/Gen/Translation.$*.cpp \
--output-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/$*.pickle \
$*

Core/Gen/macros.txt: Makefile
@test -d Core/Gen || mkdir -p Core/Gen
echo "#include <configuration.h>" | $(CC) -dM -E $(CFLAGS) - > $(PWD)/Core/Gen/macros.txt
echo "#include <configuration.h>" | $(CC) -dM -E $(CFLAGS) -MF Core/Gen/macros.tmp - > $(PWD)/Core/Gen/macros.txt


#
# The recipes to produce compressed translation data:
Expand All @@ -688,7 +694,7 @@ $(HOST_OUTPUT_DIR)/brieflz/libbrieflz.so: Core/brieflz/brieflz.c Core/brieflz/de
Core/Gen/Translation_brieflz.%.cpp: $(OUTPUT_DIR)/Core/Gen/translation.files/%.o $(OUTPUT_DIR)/Core/Gen/translation.files/%.pickle $(HOST_OUTPUT_DIR)/brieflz/libbrieflz.so Core/Gen/macros.txt
@test -d $(@D) || mkdir -p $(@D)
@echo Generating BriefLZ compressed translation for $*
@OBJCOPY=$(OBJCOPY) python3 ../Translations/make_translation.py \
@OBJCOPY=$(OBJCOPY) $(HOST_PYTHON) ../Translations/make_translation.py \
--macros $(PWD)/Core/Gen/macros.txt \
-o $(PWD)/Core/Gen/Translation_brieflz.$*.cpp \
--input-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/$*.pickle \
Expand All @@ -698,7 +704,7 @@ Core/Gen/Translation_brieflz.%.cpp: $(OUTPUT_DIR)/Core/Gen/translation.files/%.o
Core/Gen/Translation_brieflz_font.%.cpp: $(OUTPUT_DIR)/Core/Gen/translation.files/%.pickle $(HOST_OUTPUT_DIR)/brieflz/libbrieflz.so Core/Gen/macros.txt
@test -d $(@D) || mkdir -p $(@D)
@echo Generating BriefLZ compressed translation for $*
@python3 ../Translations/make_translation.py \
@$(HOST_PYTHON) ../Translations/make_translation.py \
--macros $(PWD)/Core/Gen/macros.txt \
-o $(PWD)/Core/Gen/Translation_brieflz_font.$*.cpp \
--input-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/$*.pickle \
Expand Down Expand Up @@ -745,7 +751,7 @@ Core/Gen/Translation_multi.$(1).cpp: $(patsubst %,../Translations/translation_%.
@test -d Core/Gen || mkdir -p Core/Gen
@test -d $(OUTPUT_DIR)/Core/Gen/translation.files || mkdir -p $(OUTPUT_DIR)/Core/Gen/translation.files
@echo 'Generating translations for multi-language $(2)'
@python3 ../Translations/make_translation.py \
@$(HOST_PYTHON) ../Translations/make_translation.py \
--macros $(PWD)/Core/Gen/macros.txt \
-o $(PWD)/Core/Gen/Translation_multi.$(1).cpp \
--output-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).pickle \
Expand All @@ -756,7 +762,7 @@ $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).pickle: Core/Gen/Translation
Core/Gen/Translation_brieflz_multi.$(1).cpp: $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).o $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).pickle $(HOST_OUTPUT_DIR)/brieflz/libbrieflz.so Core/Gen/macros.txt
@test -d $$(@D) || mkdir -p $$(@D)
@echo Generating BriefLZ compressed translation for multi-language $(2)
@OBJCOPY=$(OBJCOPY) python3 ../Translations/make_translation.py \
@OBJCOPY=$(OBJCOPY) $(HOST_PYTHON) ../Translations/make_translation.py \
--macros $(PWD)/Core/Gen/macros.txt \
-o $(PWD)/Core/Gen/Translation_brieflz_multi.$(1).cpp \
--input-pickled $(OUTPUT_DIR)/Core/Gen/translation.files/multi.$(1).pickle \
Expand All @@ -771,10 +777,14 @@ endef # multi_lang_rule
$(foreach group_code,$(LANGUAGE_GROUPS),$(eval $(call multi_lang_rule,$(group_code),$(LANGUAGE_GROUP_$(group_code)_NAME),$(LANGUAGE_GROUP_$(group_code)_LANGS))))


clean :
clean:
rm -Rf Core/Gen
rm -Rf $(OUTPUT_DIR_BASE)
rm -Rf $(HEXFILE_DIR)/*
rm -Rf ../Translations/__pycache__

clean-all: clean
rm -Rf $(HEXFILE_DIR)

style:
@for src in $(ALL_SOURCE) $(ALL_INCLUDES); do \
Expand All @@ -794,7 +804,7 @@ check-style:
done
@echo "Style check passed"

.PHONY: style all clean default
.PHONY: style all clean default clean-all
.SECONDARY:

# pull in dependency info for *existing* .o files
Expand Down

0 comments on commit 0d86d7b

Please sign in to comment.