zephyr/scripts/Makefile.gen

35 lines
1.1 KiB
Makefile

# vim: filetype=make
#
# Special rules to generate a file that can be included into a source file.
# ---------------------------------------------------------------------------
generated_inc_files = $(foreach f,$(generate_inc_file),$(notdir $(f)).inc)
generated_inc_gz_files = \
$(foreach f,$(generate_inc_gz_file),$(notdir $(f)).gz.inc)
$(notdir %).gz.inc: $(generate_inc_gz_file)
$(Q)${ZEPHYR_BASE}/scripts/file2hex.py --gzip --file $* > $@
$(notdir %).inc: $(generate_inc_file)
$(Q)${ZEPHYR_BASE}/scripts/file2hex.py --file $* > $@
PHONY += embed_inc_files
embed_inc_files: $(generated_inc_files)
PHONY += embed_inc_gz_files
embed_inc_gz_files: $(generated_inc_gz_files)
_embed_inc_files:
$(Q)$(MAKE) -C $(SRC) embed_inc_files Q=$(Q)
_embed_inc_gz_files:
$(Q)$(MAKE) -C $(SRC) embed_inc_gz_files Q=$(Q)
_remove_gen_files:
$(Q)rm -f $(SRC)/*.inc
PHONY += _embed_inc_files _embed_inc_gz_files _remove_gen_files
all: _embed_inc_files _embed_inc_gz_files
flash: _embed_inc_files _embed_inc_gz_files
run: _embed_inc_files _embed_inc_gz_files
pristine: _remove_gen_files