diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/kconfig.mk | 44 |
1 files changed, 44 insertions, 0 deletions
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) |