From 171e8e92686ac65e8f9a2962a975e6863c791a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 8 Mar 2017 22:16:16 +0100 Subject: Shakeout of makefiles and Kconfigs --- tools/kconfig.mk | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tools/kconfig.mk (limited to 'tools') diff --git a/tools/kconfig.mk b/tools/kconfig.mk new file mode 100644 index 0000000..c07bbfa --- /dev/null +++ b/tools/kconfig.mk @@ -0,0 +1,44 @@ +# vim:ts=4:sw=4:sts=4:noexpandtab + +ifndef TOOL_PATH +$(error Before including kconfig.mk you have to define path to tools in variable TOOL_PATH) +endif +ifndef CONFIG +$(error Before including kconfig.mk you have to define variable CONFIG contaning name of configuration file) +endif + +$(CONFIG): + @echo Please generate configuration first using config or menuconfig target + @exit 1 + +# We don't wont pass any variable to Kconfig. This is workaround for that. +# So include of this file should be last line in Makefile +MAKEOVERRIDES = + +callconfig = $(Q)\ + [ ! -f "$(CONFIG)" ] || mv "$(CONFIG)" config; \ + IOEROOT="$(IOEROOT)" $(MAKE) -f "$(TOOL_PATH)/kconfig/GNUmakefile" --no-print-directory \ + TOPDIR=. SRCDIR="$(TOOL_PATH)/kconfig" $(1); \ + [ ! -f config ] || mv config "$(CONFIG)"; \ + [ ! -f config.old ] || mv config.old "$(CONFIG).old" +# Note about this file moving madness: +# avr-ioe is using Kconfig for configuration and it is not prepared too well for +# nested projects (at least I don't know way). This unfortunately means that to +# have configuration in parent project, We have to move it every time we are +# generating it. Also upper projects can't use Kconfig for its self configuration. + +.PHONY: oldconfig +oldconfig: $(deps_config) + $(call callconfig, oldconfig) + +.PHONY: config +config: $(deps_config) + $(call callconfig, config) + +.PHONY: menuconfig +menuconfig: $(deps_config) + $(call callconfig, menuconfig) + +.PHONY: allyesconfig +allyesconfig: $(deps_config) + $(call callconfig, allyesconfig) -- cgit v1.2.3