]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Preliminary support for Kconfig integration kconfig
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 10 Mar 2011 23:00:33 +0000 (00:00 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 10 Mar 2011 23:00:33 +0000 (00:00 +0100)
snippets/base.omk

index 62a1cc9e4376baf68823f66f8d335ff2d5145e23..257bb859cee1a64a301307f5edf97af3f414b3a8 100644 (file)
@@ -267,6 +267,7 @@ default-config:
        @echo "# This file should not be altered manually" >> "$(CONFIG_FILE)-default"
        @echo "# Overrides should be stored in file $(notdir $(CONFIG_FILE))" >> "$(CONFIG_FILE)-default"
        @echo >> "$(CONFIG_FILE)-default"
+       @echo > $(OUTPUT_DIR)/Kconfig
        @$(MAKE) $(NO_PRINT_DIRECTORY) -C $(OUTPUT_DIR) \
                RELATIVE_DIR="" SOURCES_DIR=$(OUTPUT_DIR) \
                -f $(OUTPUT_DIR)/Makefile default-config-pass
@@ -278,7 +279,19 @@ default-config-pass-local:
        @echo "# Config for $(RELATIVE_DIR)" >> "$(CONFIG_FILE)-default"
        @$(foreach x, $(default_CONFIG), echo '$(x)' | \
                sed -e 's/^[^=]*=x$$/#\0/' >> "$(CONFIG_FILE)-default" ; )
-
+       @$(foreach x, $(default_CONFIG), $(call gen_kconfig,$(x)))
+
+config_name = $(shell x='$(1)'; xx=$${x%%\=*}; echo $${xx\#CONFIG_})
+config_val = $(shell x='$(1)'; echo $${x\#*=})
+
+define gen_kconfig
+$(if $(patsubst %=x,,$(1)),\
+  ( echo config $(config_name); \
+    echo "     bool \"$(config_name) in $(RELATIVE_DIR)"; \
+    echo "     default $(config_val)"; \
+    echo \
+  ) >> $(OUTPUT_DIR)/Kconfig; )
+endef
 
 omkize:
        $(Q)if ! grep -q MAKERULES_DIR Makefile; then \