aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-03-08 22:16:16 +0100
committerKarel Kočí <cynerd@email.cz>2017-03-08 22:16:16 +0100
commit171e8e92686ac65e8f9a2962a975e6863c791a4f (patch)
tree42c8ba7caee8d1e6c67eca533350dd003d47d14f /tools
parentfbe0e4d00ba7e026b8b848cfcd0ed583a71f8069 (diff)
downloadavr-ioe-171e8e92686ac65e8f9a2962a975e6863c791a4f.tar.gz
avr-ioe-171e8e92686ac65e8f9a2962a975e6863c791a4f.tar.bz2
avr-ioe-171e8e92686ac65e8f9a2962a975e6863c791a4f.zip
Shakeout of makefiles and Kconfigs
Diffstat (limited to 'tools')
-rw-r--r--tools/kconfig.mk44
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)