88# To build a "minimal" configuration, use "make-minimal" wrapper.
99
1010BOARD ?= qemu_x86
11- CONF_FILE = prj .conf
11+ CONF_FILE = prj_ $( BOARD ) _merged .conf
1212OUTDIR_PREFIX = $(BOARD )
1313
1414# Default heap size is 16KB, which is on conservative side, to let
@@ -19,7 +19,9 @@ FROZEN_DIR = scripts
1919
2020# Zephyr (generated) config files - must be defined before include below
2121Z_EXPORTS = outdir/$(OUTDIR_PREFIX ) /Makefile.export
22+ ifneq ($(MAKECMDGOALS ) , clean)
2223include $(Z_EXPORTS )
24+ endif
2325
2426include ../py/mkenv.mk
2527include ../py/py.mk
@@ -56,12 +58,12 @@ CFLAGS = $(KBUILD_CFLAGS) $(NOSTDINC_FLAGS) $(ZEPHYRINCLUDE) \
5658
5759include ../py/mkrules.mk
5860
61+ # We use single target here ($(Z_EXPORTS)) for simplicity, but actually
62+ # number of things get generated here: 'initconfig' generates C header for
63+ # Kconfig configuration, 'outputexports' generates make environment with CC,
64+ # etc., and 'lib' generates other headers which may be included by zephyr.h,
65+ # e.g. DTS-related.
5966$(Z_EXPORTS ) : $(CONF_FILE )
60- # We use single target here ($(Z_EXPORTS)) for simplicity, but actually
61- # number of things get generated here: 'initconfig' generates C header for
62- # Kconfig configuration, 'outputexports' generates make environment with CC,
63- # etc., and 'lib' generates other headers which may be included by zephyr.h,
64- # e.g. DTS-related.
6567 $(MAKE ) -f Makefile.zephyr BOARD=$(BOARD ) CONF_FILE=$(CONF_FILE ) initconfig outputexports lib
6668
6769GENERIC_TARGETS = all zephyr run qemu qemugdb flash debug debugserver
@@ -84,14 +86,14 @@ build/genhdr/qstr.i.last: | $(Z_EXPORTS)
8486# If we recreate libmicropython, also cause zephyr.bin relink
8587LIBMICROPYTHON_EXTRA_CMD = -$(RM ) -f outdir/$(OUTDIR_PREFIX ) /zephyr.lnk
8688
87- # Clean Zephyr things too
88- clean : z_clean
89+ # MicroPython's global clean cleans everything, fast
90+ CLEAN_EXTRA = outdir
8991
92+ # Clean Zephyr things in Zephyr way
9093z_clean :
9194 $(MAKE ) -f Makefile.zephyr BOARD=$(BOARD ) clean
9295
93- .PHONY : prj.conf
94- prj.conf : prj_base.conf
96+ $(CONF_FILE ) : prj_base.conf prj_$(BOARD ) .conf
9597 $(PYTHON ) makeprj.py prj_base.conf prj_$(BOARD ) .conf $@
9698
9799test :
0 commit comments