# ===================================================================== # spdx-license-identifier: ISC # glitch top-level makefile # ===================================================================== MAKE := make MAKEID := $(shell ${MAKE} --version | head -n1) MAKEFLAGS += -rR --no-print-directory ARCH := $(shell sed -nE "s/CONFIG_ARCH_(.+)=y/\1/p" .config) .PHONY: all help info run doc clean test valgrind all: Makefile.config @${MAKE} -f Makefile.all help: @echo "info: show current configuration" @echo "all: build kernel image" @echo "run: run kernel image in qemu" @echo "test: run all tests" @echo "valgrind: run all tests in valgrind" info: Makefile.config @echo "- make:" @echo " MAKE: ${MAKE}" @echo " MAKEID: ${MAKEID}" @echo " MAKEFLAGS: ${MAKEFLAGS}" @${MAKE} -f Makefile.all $@ run: Makefile.config @${MAKE} -f Makefile.all $@ doc: doxygen.config doxygen $< clean: @${MAKE} -C lib clean @${MAKE} -C ${ARCH} clean @${MAKE} -C devices clean @${MAKE} -C src clean test: @echo " -> Running tests in src" @make -C src test > /dev/null @echo " -> Running tests in lib" @make -C lib test > /dev/null valgrind: @echo " -> Running valgrind on tests in lib" @make -C lib valgrind &> /dev/null @echo " -> Running valgrind on tests in src" @make -C src valgrind &> /dev/null # configure targets .config: Kconfig @alldefconfig Makefile.config: .config ${ARCH}/toolchain.mk @echo -e '## This is a generated file, manual edits might be lost' > Makefile.config @echo -e '\n## .config' >> Makefile.config @cat .config >> Makefile.config @echo -e '\n## toolchain.mk' >> Makefile.config @cat ${ARCH}/toolchain.mk >> Makefile.config