zephyr/Makefile: Rework dependencies and "clean" target.
Got tired of running rm -rf manually. Make should clean, and should clean fast. Also, fix always-running config-related commands (by having per-board merged configs).
This commit is contained in:
parent
f69ab79ec8
commit
0c75990d6e
|
@ -8,7 +8,7 @@
|
|||
# To build a "minimal" configuration, use "make-minimal" wrapper.
|
||||
|
||||
BOARD ?= qemu_x86
|
||||
CONF_FILE = prj.conf
|
||||
CONF_FILE = prj_$(BOARD)_merged.conf
|
||||
OUTDIR_PREFIX = $(BOARD)
|
||||
|
||||
# Default heap size is 16KB, which is on conservative side, to let
|
||||
|
@ -19,7 +19,9 @@ FROZEN_DIR = scripts
|
|||
|
||||
# Zephyr (generated) config files - must be defined before include below
|
||||
Z_EXPORTS = outdir/$(OUTDIR_PREFIX)/Makefile.export
|
||||
ifneq ($(MAKECMDGOALS), clean)
|
||||
include $(Z_EXPORTS)
|
||||
endif
|
||||
|
||||
include ../py/mkenv.mk
|
||||
include ../py/py.mk
|
||||
|
@ -56,12 +58,12 @@ CFLAGS = $(KBUILD_CFLAGS) $(NOSTDINC_FLAGS) $(ZEPHYRINCLUDE) \
|
|||
|
||||
include ../py/mkrules.mk
|
||||
|
||||
# We use single target here ($(Z_EXPORTS)) for simplicity, but actually
|
||||
# number of things get generated here: 'initconfig' generates C header for
|
||||
# Kconfig configuration, 'outputexports' generates make environment with CC,
|
||||
# etc., and 'lib' generates other headers which may be included by zephyr.h,
|
||||
# e.g. DTS-related.
|
||||
$(Z_EXPORTS): $(CONF_FILE)
|
||||
# We use single target here ($(Z_EXPORTS)) for simplicity, but actually
|
||||
# number of things get generated here: 'initconfig' generates C header for
|
||||
# Kconfig configuration, 'outputexports' generates make environment with CC,
|
||||
# etc., and 'lib' generates other headers which may be included by zephyr.h,
|
||||
# e.g. DTS-related.
|
||||
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE) initconfig outputexports lib
|
||||
|
||||
GENERIC_TARGETS = all zephyr run qemu qemugdb flash debug debugserver
|
||||
|
@ -84,14 +86,14 @@ build/genhdr/qstr.i.last: | $(Z_EXPORTS)
|
|||
# If we recreate libmicropython, also cause zephyr.bin relink
|
||||
LIBMICROPYTHON_EXTRA_CMD = -$(RM) -f outdir/$(OUTDIR_PREFIX)/zephyr.lnk
|
||||
|
||||
# Clean Zephyr things too
|
||||
clean: z_clean
|
||||
# MicroPython's global clean cleans everything, fast
|
||||
CLEAN_EXTRA = outdir
|
||||
|
||||
# Clean Zephyr things in Zephyr way
|
||||
z_clean:
|
||||
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) clean
|
||||
|
||||
.PHONY: prj.conf
|
||||
prj.conf: prj_base.conf
|
||||
$(CONF_FILE): prj_base.conf prj_$(BOARD).conf
|
||||
$(PYTHON) makeprj.py prj_base.conf prj_$(BOARD).conf $@
|
||||
|
||||
test:
|
||||
|
|
Loading…
Reference in New Issue