]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Added a possibility of generating global config files.
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 26 Jun 2006 14:17:00 +0000 (14:17 +0000)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 26 Jun 2006 14:17:00 +0000 (14:17 +0000)
darcs-hash:20060626141703-f2ef6-9a9f1b402e1c57010d4221015c2f42a9be9b78b2.gz

rulesdef.py
snippets/config_h [new file with mode: 0644]
snippets/linux
snippets/localconfig [deleted file]

index e48b972a2af3c08c2eabd5ffc61464e1f8ec5b1e..c42a9a1b7df17bd3afce3d2c38a36fe05788df47 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 rules = {
-    'sysless': [ 'base', 'gcc', 'localconfig', 'sysless', 'localeval' ],
-    'linux':   [ 'linux-setup', 'base', 'localconfig', 'linux' ],
-    'rtems':   [ 'rtems-setup', 'base', 'localconfig', 'rtems' ],
+    'sysless': [ 'base', 'gcc', 'config_h', 'sysless', 'localeval' ],
+    'linux':   [ 'linux-setup', 'base', 'config_h', 'linux' ],
+    'rtems':   [ 'rtems-setup', 'base', 'config_h', 'rtems' ],
     }
diff --git a/snippets/config_h b/snippets/config_h
new file mode 100644 (file)
index 0000000..c9f097c
--- /dev/null
@@ -0,0 +1,54 @@
+# LOCAL_CONFIG_H   .. name of local config.h file generated from values
+#                     of options defined in the current directory
+# config_include_HEADERS .. names of global config files (possibly
+#                     with subdirectories)
+# xxx_DEFINES      .. list of config directives to be included in
+#                     config header file of the name <somedir>/xxx.h
+
+# Syntax: $(call BUILD_CONFIG_H_template,<header_file_path>,<list_of_options_to_export>,<header_barrier>)
+define BUILD_CONFIG_H_template
+
+$(1) : $(wildcard $(CONFIG_FILE)) $(wildcard $(CONFIG_FILE)-default)
+       @$(QUIET_CMD_ECHO) "  CONFGEN $$@ in `pwd`"
+       @if [ ! -d `dirname $(1).tmp` ] ; then \
+               mkdir `dirname $(1).tmp` ; fi
+       @echo "/* Automatically generated from */" > "$(1).tmp"
+       @echo "/* config file: $$< */" >> "$(1).tmp"
+       @echo "#ifndef $(3)" >> "$(1).tmp"
+       @echo "#define $(3)" >> "$(1).tmp"
+       @( $(foreach x, $(shell echo '$($(2))' | sed -e 's/\<\([^ =]*\)\(=[^ ]\+\|\)\>/\1/g' ), \
+               echo '$(x).$($(x))' ; ) echo ; ) | \
+               sed -e '/^[^.]*\.n$$$$/d' -e '/^[^.]*\.$$$$/d' -e 's/^\([^.]*\)\.[ym]$$$$/\1.1/' | \
+               sed -n -e 's/^\([^.]*\)\.\(.*\)$$$$/#define \1 \2/p' \
+                 >> "$(1).tmp"
+       @echo "#endif /*$(3)*/" >> "$(1).tmp"
+       @if cmp --quiet "$(1).tmp" "$(1)" ; then \
+       echo rm "$(1).tmp" ; \
+       else mv "$(1).tmp" "$(1)" ; \
+       echo Updated configuration "$(1)" ; fi
+
+endef
+
+ifdef LOCAL_CONFIG_H
+
+$(eval $(call BUILD_CONFIG_H_template,$(LOCAL_CONFIG_H),default_CONFIG,_LOCAL_CONFIG_H) )
+
+endif
+
+# Special rules for configuration exported headers
+
+#FIXME: The directory for headers should not be specified here.
+$(foreach confh,$(config_include_HEADERS),$(eval $(call BUILD_CONFIG_H_template,$(addprefix $(USER_INCLUDE_DIR)/,$(confh)),$(basename $(notdir $(confh)))_DEFINES,\
+_$(basename $(notdir $(confh)))_H \
+)))
+
+define clean_config_h
+       @$(foreach confh,$(addprefix $(USER_INCLUDE_DIR)/,$(config_include_HEADERS)),\
+           if [ -e $(confh) ] ; then touch -t 200001010101 $(confh) ; fi ; \
+       )
+endef
+
+
+# Local Variables:
+# mode:makefile
+# End:
index 1bec9564d42588c446db9c210f9c8695d823547d..e0182d8a8f50d55d0af28adee0359fe045790a14 100644 (file)
@@ -689,13 +689,6 @@ $(foreach src,$(filter %.cxx,$(KERN_SOURCES)),$(eval $(call COMPILE_cc_o_kern_te
 
 endif
 
-# Special rules for configuration exported headers
-
-$(foreach confh,$(config_include_HEADERS),$(eval $(call BUILD_CONFIG_H_template,$(addprefix $(USER_INCLUDE_DIR)/,$(confh)),$(basename $(notdir $(confh)))_DEFINES,\
-_$(basename $(notdir $(confh)))_H \
-)))
-
-
 clean-local: clean-custom
        @echo Cleaning in $(KERN_OBJS_DIR) and $(USER_OBJS_DIR)
        @rm -f $(KERN_OBJS_DIR)/*.o $(USER_OBJS_DIR)/*.o $(USER_OBJS_DIR)/*.lo \
@@ -708,9 +701,7 @@ clean-local: clean-custom
        @if [ -e $(KERN_LIB_DIR)/kernel.mk ] ; then \
            touch -t 200001010101 $(KERN_LIB_DIR)/kernel.mk ; \
        fi
-       @$(foreach confh,$(addprefix $(USER_INCLUDE_DIR)/,$(config_include_HEADERS)),\
-           if [ -e $(confh) ] ; then touch -t 200001010101 $(confh) ; fi ; \
-       )
+       $(clean_config_h)
 
 default: $(check-dir) include-pass library-pass binary-pass utils-pass kernel-lib-pass kernel-pass
 
diff --git a/snippets/localconfig b/snippets/localconfig
deleted file mode 100644 (file)
index 332b18b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# LOCAL_CONFIG_H   .. name of local config.h file generated from values
-#                     of options defined in the current directory
-
-ifdef LOCAL_CONFIG_H
-
-$(LOCAL_CONFIG_H) : $(wildcard $(CONFIG_FILE)) $(wildcard $(CONFIG_FILE)-default)
-       @echo LOCAL_CONFIG_H=`pwd`/$(LOCAL_CONFIG_H)
-       @echo "/* Automatically generated from */" > "$(LOCAL_CONFIG_H).tmp"
-       @echo "/* config file : $< */" >> "$(LOCAL_CONFIG_H).tmp"
-       @echo "#ifndef _LOCAL_CONFIG_H" >> "$(LOCAL_CONFIG_H).tmp"
-       @echo "#define _LOCAL_CONFIG_H" >> "$(LOCAL_CONFIG_H).tmp"
-       @( $(foreach x, $(shell echo $(default_CONFIG) | sed -e 's/\<\([^ ]*\)=[^ ]\>/\1/g' ), \
-               echo $(x).$($(x)) ; ) echo ; ) | \
-               sed -n -e 's/^\(.*\)\.[ym]$$/#define \1 1/p' \
-                 >> "$(LOCAL_CONFIG_H).tmp"
-       @echo "#endif /*_LOCAL_CONFIG_H*/" >> "$(LOCAL_CONFIG_H).tmp"
-       @if cmp --quiet "$(LOCAL_CONFIG_H).tmp" "$(LOCAL_CONFIG_H)" ; then \
-       echo rm "$(LOCAL_CONFIG_H).tmp" ; \
-       else mv "$(LOCAL_CONFIG_H).tmp" "$(LOCAL_CONFIG_H)" ; \
-       echo Updated configuration "$(LOCAL_CONFIG_H)" ; fi
-
-endif
-
-# Local Variables:
-# mode:makefile
-# End: