#!/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' ],
}
--- /dev/null
+# 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:
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 \
@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
+++ /dev/null
-# 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: