1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/config/config.mk Sat Oct 18 18:37:28 2008 +0000
1.3 @@ -0,0 +1,176 @@
1.4 +# ===========================================================================
1.5 +# crosstool-NG genererated config files
1.6 +# These targets are used from top-level makefile
1.7 +
1.8 +#-----------------------------------------------------------
1.9 +# List all config files, source and generated
1.10 +
1.11 +# The top-level config file to be used be configurators
1.12 +KCONFIG_TOP = config/config.in
1.13 +
1.14 +# Build the list of all source config files
1.15 +STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f -name '*.in' 2>/dev/null))
1.16 +# ... and how to access them:
1.17 +$(STATIC_CONFIG_FILES): config
1.18 +
1.19 +# Build a list of per-component-type source config files
1.20 +ARCH_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in))
1.21 +KERNEL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in))
1.22 +CC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in))
1.23 +LIBC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in))
1.24 +DEBUG_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in))
1.25 +TOOL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/tools/*.in))
1.26 +
1.27 +# Build the list of generated config files
1.28 +GEN_CONFIG_FILES = config.gen/arch.in \
1.29 + config.gen/kernel.in \
1.30 + config.gen/cc.in \
1.31 + config.gen/libc.in \
1.32 + config.gen/tools.in \
1.33 + config.gen/debug.in
1.34 +# ... and how to access them:
1.35 +# Generated files depends on config.mk (this file) because it has the
1.36 +# functions needed to build the genrated files, and thus they might
1.37 +# need re-generation if config.mk changes
1.38 +$(GEN_CONFIG_FILES): config.gen \
1.39 + $(CT_LIB_DIR)/config/config.mk
1.40 +
1.41 +# Helper entry for the configurators
1.42 +PHONY += config_files
1.43 +config_files: $(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
1.44 +
1.45 +# Where to access to the source config files from
1.46 +config:
1.47 + @$(ECHO) " LN config"
1.48 + $(SILENT)ln -s $(CT_LIB_DIR)/config config
1.49 +
1.50 +# Where to store the generated config files into
1.51 +config.gen:
1.52 + @$(ECHO) " MKDIR config.gen"
1.53 + $(SILENT)mkdir -p config.gen
1.54 +
1.55 +#-----------------------------------------------------------
1.56 +# Build list of per-component-type items to easily build generated files
1.57 +
1.58 +ARCHS = $(patsubst config/arch/%.in,%,$(ARCH_CONFIG_FILES))
1.59 +KERNELS = $(patsubst config/kernel/%.in,%,$(KERNEL_CONFIG_FILES))
1.60 +CCS = $(patsubst config/cc/%.in,%,$(CC_CONFIG_FILES))
1.61 +LIBCS = $(patsubst config/libc/%.in,%,$(LIBC_CONFIG_FILES))
1.62 +DEBUGS = $(patsubst config/debug/%.in,%,$(DEBUG_CONFIG_FILES))
1.63 +TOOLS = $(patsubst config/tools/%.in,%,$(TOOL_CONFIG_FILES))
1.64 +
1.65 +#-----------------------------------------------------------
1.66 +# Helper functions to ease building generated config files
1.67 +
1.68 +# The function 'build_gen_choice_in' builds a choice-menu of a list of
1.69 +# components in the given list, also adding source-ing of associazted
1.70 +# config files:
1.71 +# $1 : destination file
1.72 +# $2 : name for the entries family (eg. Architecture, kernel...)
1.73 +# $3 : prefix for the choice entries (eg. ARCH, KERNEL...)
1.74 +# $4 : base directory containing config files
1.75 +# $5 : list of config entries (eg. for architectures: "alpha arm ia64"...,
1.76 +# and for kernels: "bare-metal linux"...)
1.77 +# Example to build the kernels generated config file:
1.78 +# $(call build_gen_choice_in,config.gen/kernel.in,Target OS,KERNEL,config/kernel,$(KERNELS))
1.79 +define build_gen_choice_in
1.80 + @$(ECHO) ' IN $(1)'
1.81 + $(SILENT)(echo "# $(2) menu"; \
1.82 + echo "# Generated file, do not edit!!!"; \
1.83 + echo ""; \
1.84 + echo "choice"; \
1.85 + echo " bool"; \
1.86 + echo " prompt \"$(2)\""; \
1.87 + echo ""; \
1.88 + for entry in $(5); do \
1.89 + file="$(4)/$${entry}.in"; \
1.90 + _entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
1.91 + echo "config $(3)_$${_entry}"; \
1.92 + echo " bool"; \
1.93 + printf " prompt \"$${entry}"; \
1.94 + if grep -E '^# +EXPERIMENTAL$$' $${file} >/dev/null 2>&1; then \
1.95 + echo " (EXPERIMENTAL)\""; \
1.96 + echo " depends on EXPERIMENTAL"; \
1.97 + else \
1.98 + echo "\""; \
1.99 + fi; \
1.100 + done; \
1.101 + echo ""; \
1.102 + echo "endchoice"; \
1.103 + for entry in $(5); do \
1.104 + file="$(4)/$${entry}.in"; \
1.105 + _entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
1.106 + echo ""; \
1.107 + echo "if $(3)_$${_entry}"; \
1.108 + echo "config $(3)"; \
1.109 + echo " default \"$${entry}\" if $(3)_$${_entry}"; \
1.110 + echo "source $${file}"; \
1.111 + echo "endif"; \
1.112 + done; \
1.113 + ) >$(1)
1.114 +endef
1.115 +
1.116 +# The function 'build_gen_menu_in' builds a menuconfig for each component in
1.117 +# the given list, source-ing the associated files conditionnaly:
1.118 +# $1 : destination file
1.119 +# $2 : name of entries family (eg. Tools, Debug...)
1.120 +# $3 : prefix for the menu entries (eg. TOOL, DEBUG)
1.121 +# $4 : base directory containing config files
1.122 +# $5 : list of config entries (eg. for tools: "libelf sstrip"..., and for
1.123 +# debug: "dmalloc duma gdb"...)
1.124 +# Example to build the tools generated config file:
1.125 +# $(call build_gen_menu_in,config.gen/tools.in,Tools,TOOL,config/tools,$(TOOLS))
1.126 +define build_gen_menu_in
1.127 + @$(ECHO) ' IN $(1)'
1.128 + $(SILENT)(echo "# $(2) facilities menu"; \
1.129 + echo "# Generated file, do not edit!!!"; \
1.130 + echo ""; \
1.131 + for entry in $(5); do \
1.132 + file="$(4)/$${entry}.in"; \
1.133 + _entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
1.134 + echo "menuconfig $(3)_$${_entry}"; \
1.135 + echo " bool"; \
1.136 + printf " prompt \"$${entry}"; \
1.137 + if grep -E '^# +EXPERIMENTAL$$' $${file} >/dev/null 2>&1; then \
1.138 + echo " (EXPERIMENTAL)\""; \
1.139 + echo " depends on EXPERIMENTAL"; \
1.140 + else \
1.141 + echo "\""; \
1.142 + fi; \
1.143 + echo "if $(3)_$${_entry}"; \
1.144 + echo "source $${file}"; \
1.145 + echo "endif"; \
1.146 + echo ""; \
1.147 + done; \
1.148 + ) >$(1)
1.149 +endef
1.150 +
1.151 +#-----------------------------------------------------------
1.152 +# The rules for the generated config files
1.153 +
1.154 +config.gen/arch.in: $(ARCH_CONFIG_FILES)
1.155 + $(call build_gen_choice_in,$@,Target Architecture,ARCH,config/arch,$(ARCHS))
1.156 +
1.157 +config.gen/kernel.in: $(KERNEL_CONFIG_FILES)
1.158 + $(call build_gen_choice_in,$@,Target OS,KERNEL,config/kernel,$(KERNELS))
1.159 +
1.160 +config.gen/cc.in: $(CC_CONFIG_FILES)
1.161 + $(call build_gen_choice_in,$@,C compiler,CC,config/cc,$(CCS))
1.162 +
1.163 +config.gen/libc.in: $(LIBC_CONFIG_FILES)
1.164 + $(call build_gen_choice_in,$@,C library,LIBC,config/libc,$(LIBCS))
1.165 +
1.166 +config.gen/tools.in: $(TOOL_CONFIG_FILES)
1.167 + $(call build_gen_menu_in,$@,Tools,TOOL,config/tools,$(TOOLS))
1.168 +
1.169 +config.gen/debug.in: $(DEBUG_CONFIG_FILES)
1.170 + $(call build_gen_menu_in,$@,Debug,DEBUG,config/debug,$(DEBUGS))
1.171 +
1.172 +#-----------------------------------------------------------
1.173 +# Cleaning up the mess...
1.174 +
1.175 +clean::
1.176 + @$(ECHO) " CLEAN config"
1.177 + $(SILENT)rm -f config 2>/dev/null || true
1.178 + @$(ECHO) " CLEAN config.gen"
1.179 + $(SILENT)rm -rf config.gen
2.1 --- a/ct-ng.in Fri Oct 17 14:26:53 2008 +0000
2.2 +++ b/ct-ng.in Sat Oct 18 18:37:28 2008 +0000
2.3 @@ -92,6 +92,7 @@
2.4 @echo ' clean - Remove generated files'
2.5 @echo ' distclean - Remove generated files, configuration and build directories'
2.6
2.7 +include $(CT_LIB_DIR)/config/config.mk
2.8 include $(CT_LIB_DIR)/kconfig/kconfig.mk
2.9 include $(CT_LIB_DIR)/steps.mk
2.10 include $(CT_LIB_DIR)/samples/samples.mk
3.1 --- a/kconfig/kconfig.mk Fri Oct 17 14:26:53 2008 +0000
3.2 +++ b/kconfig/kconfig.mk Sat Oct 18 18:37:28 2008 +0000
3.3 @@ -8,180 +8,24 @@
3.4 #-----------------------------------------------------------
3.5 # Some static /configuration/
3.6
3.7 -KCONFIG_TOP = config/config.in
3.8 +# The place where the kconfig stuff lies
3.9 obj = kconfig
3.10 -PHONY += clean help oldconfig menuconfig defoldconfig
3.11 -
3.12 -#-----------------------------------------------------------
3.13 -# List all config files, source and generated
3.14 -
3.15 -# Build the list of all source config files
3.16 -STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f -name '*.in' 2>/dev/null))
3.17 -# ... and how to access them:
3.18 -$(STATIC_CONFIG_FILES): config
3.19 -
3.20 -# Build a list of per-component-type source config files
3.21 -ARCH_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/arch/*.in))
3.22 -KERNEL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/kernel/*.in))
3.23 -CC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/cc/*.in))
3.24 -LIBC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/libc/*.in))
3.25 -DEBUG_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/debug/*.in))
3.26 -TOOL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(wildcard $(CT_LIB_DIR)/config/tools/*.in))
3.27 -
3.28 -# Build the list of generated config files
3.29 -GEN_CONFIG_FILES = config.gen/arch.in \
3.30 - config.gen/kernel.in \
3.31 - config.gen/cc.in \
3.32 - config.gen/libc.in \
3.33 - config.gen/tools.in \
3.34 - config.gen/debug.in
3.35 -# ... and how to access them:
3.36 -# Generated files depends on kconfig.mk (this file) because it has the
3.37 -# functions needed to build the genrated files, and thus they might
3.38 -# need re-generation if kconfig.mk changes
3.39 -$(GEN_CONFIG_FILES): config.gen \
3.40 - $(CT_LIB_DIR)/kconfig/kconfig.mk
3.41 -
3.42 -# KCONFIG_TOP should already be in STATIC_CONFIG_FILES, anyway...
3.43 -CONFIG_FILES = $(sort $(KCONFIG_TOP) $(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES))
3.44 -
3.45 -# Where to access to the source config files from
3.46 -config:
3.47 - @$(ECHO) " LN config"
3.48 - $(SILENT)ln -s $(CT_LIB_DIR)/config config
3.49 -
3.50 -# Where to store the generated config files into
3.51 -config.gen:
3.52 - @$(ECHO) " MKDIR config.gen"
3.53 - $(SILENT)mkdir -p config.gen
3.54 -
3.55 -#-----------------------------------------------------------
3.56 -# Build list of per-component-type items to easily build generated files
3.57 -
3.58 -ARCHS = $(patsubst config/arch/%.in,%,$(ARCH_CONFIG_FILES))
3.59 -KERNELS = $(patsubst config/kernel/%.in,%,$(KERNEL_CONFIG_FILES))
3.60 -CCS = $(patsubst config/cc/%.in,%,$(CC_CONFIG_FILES))
3.61 -LIBCS = $(patsubst config/libc/%.in,%,$(LIBC_CONFIG_FILES))
3.62 -DEBUGS = $(patsubst config/debug/%.in,%,$(DEBUG_CONFIG_FILES))
3.63 -TOOLS = $(patsubst config/tools/%.in,%,$(TOOL_CONFIG_FILES))
3.64 -
3.65 -#-----------------------------------------------------------
3.66 -# Helper functions to ease building generated config files
3.67 -
3.68 -# The function 'build_gen_choice_in' builds a choice-menu of a list of
3.69 -# components in the given list, also adding source-ing of associazted
3.70 -# config files:
3.71 -# $1 : destination file
3.72 -# $2 : name for the entries family (eg. Architecture, kernel...)
3.73 -# $3 : prefix for the choice entries (eg. ARCH, KERNEL...)
3.74 -# $4 : base directory containing config files
3.75 -# $5 : list of config entries (eg. for architectures: "alpha arm ia64"...,
3.76 -# and for kernels: "bare-metal linux"...)
3.77 -# Example to build the kernels generated config file:
3.78 -# $(call build_gen_choice_in,config.gen/kernel.in,Target OS,KERNEL,config/kernel,$(KERNELS))
3.79 -define build_gen_choice_in
3.80 - @$(ECHO) ' IN $(1)'
3.81 - $(SILENT)(echo "# $(2) menu"; \
3.82 - echo "# Generated file, do not edit!!!"; \
3.83 - echo ""; \
3.84 - echo "choice"; \
3.85 - echo " bool"; \
3.86 - echo " prompt \"$(2)\""; \
3.87 - echo ""; \
3.88 - for entry in $(5); do \
3.89 - file="$(4)/$${entry}.in"; \
3.90 - _entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
3.91 - echo "config $(3)_$${_entry}"; \
3.92 - echo " bool"; \
3.93 - printf " prompt \"$${entry}"; \
3.94 - if grep -E '^# +EXPERIMENTAL$$' $${file} >/dev/null 2>&1; then \
3.95 - echo " (EXPERIMENTAL)\""; \
3.96 - echo " depends on EXPERIMENTAL"; \
3.97 - else \
3.98 - echo "\""; \
3.99 - fi; \
3.100 - done; \
3.101 - echo ""; \
3.102 - echo "endchoice"; \
3.103 - for entry in $(5); do \
3.104 - file="$(4)/$${entry}.in"; \
3.105 - _entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
3.106 - echo ""; \
3.107 - echo "if $(3)_$${_entry}"; \
3.108 - echo "config $(3)"; \
3.109 - echo " default \"$${entry}\" if $(3)_$${_entry}"; \
3.110 - echo "source $${file}"; \
3.111 - echo "endif"; \
3.112 - done; \
3.113 - ) >$(1)
3.114 -endef
3.115 -
3.116 -# The function 'build_gen_menu_in' builds a menuconfig for each component in
3.117 -# the given list, source-ing the associated files conditionnaly:
3.118 -# $1 : destination file
3.119 -# $2 : name of entries family (eg. Tools, Debug...)
3.120 -# $3 : prefix for the menu entries (eg. TOOL, DEBUG)
3.121 -# $4 : base directory containing config files
3.122 -# $5 : list of config entries (eg. for tools: "libelf sstrip"..., and for
3.123 -# debug: "dmalloc duma gdb"...)
3.124 -# Example to build the tools generated config file:
3.125 -# $(call build_gen_menu_in,config.gen/tools.in,Tools,TOOL,config/tools,$(TOOLS))
3.126 -define build_gen_menu_in
3.127 - @$(ECHO) ' IN $(1)'
3.128 - $(SILENT)(echo "# $(2) facilities menu"; \
3.129 - echo "# Generated file, do not edit!!!"; \
3.130 - echo ""; \
3.131 - for entry in $(5); do \
3.132 - file="$(4)/$${entry}.in"; \
3.133 - _entry=$$(echo "$${entry}" |sed -r -s -e 's/[-.+]/_/g;'); \
3.134 - echo "menuconfig $(3)_$${_entry}"; \
3.135 - echo " bool"; \
3.136 - printf " prompt \"$${entry}"; \
3.137 - if grep -E '^# +EXPERIMENTAL$$' $${file} >/dev/null 2>&1; then \
3.138 - echo " (EXPERIMENTAL)\""; \
3.139 - echo " depends on EXPERIMENTAL"; \
3.140 - else \
3.141 - echo "\""; \
3.142 - fi; \
3.143 - echo "if $(3)_$${_entry}"; \
3.144 - echo "source $${file}"; \
3.145 - echo "endif"; \
3.146 - echo ""; \
3.147 - done; \
3.148 - ) >$(1)
3.149 -endef
3.150 -
3.151 -#-----------------------------------------------------------
3.152 -# The rules for the generated config files
3.153 -
3.154 -config.gen/arch.in: $(ARCH_CONFIG_FILES)
3.155 - $(call build_gen_choice_in,$@,Target Architecture,ARCH,config/arch,$(ARCHS))
3.156 -
3.157 -config.gen/kernel.in: $(KERNEL_CONFIG_FILES)
3.158 - $(call build_gen_choice_in,$@,Target OS,KERNEL,config/kernel,$(KERNELS))
3.159 -
3.160 -config.gen/cc.in: $(CC_CONFIG_FILES)
3.161 - $(call build_gen_choice_in,$@,C compiler,CC,config/cc,$(CCS))
3.162 -
3.163 -config.gen/libc.in: $(LIBC_CONFIG_FILES)
3.164 - $(call build_gen_choice_in,$@,C library,LIBC,config/libc,$(LIBCS))
3.165 -
3.166 -config.gen/tools.in: $(TOOL_CONFIG_FILES)
3.167 - $(call build_gen_menu_in,$@,Tools,TOOL,config/tools,$(TOOLS))
3.168 -
3.169 -config.gen/debug.in: $(DEBUG_CONFIG_FILES)
3.170 - $(call build_gen_menu_in,$@,Debug,DEBUG,config/debug,$(DEBUGS))
3.171
3.172 #-----------------------------------------------------------
3.173 # The configurators rules
3.174
3.175 -menuconfig: $(obj)/mconf $(CONFIG_FILES)
3.176 +PHONY += oldconfig menuconfig defoldconfig
3.177 +
3.178 +menuconfig: $(obj)/mconf config_files
3.179 + @$(ECHO) " MCONF $(KCONFIG_TOP)"
3.180 $(SILENT)$< $(KCONFIG_TOP)
3.181
3.182 -oldconfig: $(obj)/conf .config $(CONFIG_FILES)
3.183 +oldconfig: $(obj)/conf .config config_files
3.184 + @$(ECHO) " CONF $(KCONFIG_TOP)"
3.185 $(SILENT)$< -s $(KCONFIG_TOP)
3.186
3.187 -defoldconfig: $(obj)/conf .config $(CONFIG_FILES)
3.188 +defoldconfig: $(obj)/conf .config config_files
3.189 + @$(ECHO) " CONF $(KCONFIG_TOP)"
3.190 $(SILENT)yes "" |$< -s $(KCONFIG_TOP)
3.191
3.192 #-----------------------------------------------------------
3.193 @@ -223,20 +67,20 @@
3.194 mconf_OBJ = $(patsubst %.c,%.o,$(mconf_SRC))
3.195
3.196 # Cheesy auto-dependencies
3.197 -DEPS = $(patsubst %.c,%.d,$(sort $(conf_SRC) $(mconf_SRC)))
3.198 +DEPS = $(patsubst %.c,%.dep,$(sort $(conf_SRC) $(mconf_SRC)))
3.199 +-include $(DEPS)
3.200
3.201 # This is not very nice, as they will get rebuild even if (dist)cleaning... :-(
3.202 # Should look into the Linux kernel Kbuild to see how they do that...
3.203 # To really make me look into this, keep the annoying "DEP xxx" messages.
3.204 # Also see the comment for the "%.o: %c" rule below
3.205 -%.d: %.c $(CT_LIB_DIR)/kconfig/kconfig.mk
3.206 +%.dep: %.c $(CT_LIB_DIR)/kconfig/kconfig.mk $(CT_NG)
3.207 $(SILENT)if [ ! -d $(obj)/lxdialog ]; then \
3.208 $(ECHO) " MKDIR $(obj)"; \
3.209 mkdir -p $(obj)/lxdialog; \
3.210 fi
3.211 @$(ECHO) " DEP $@"
3.212 $(SILENT)$(HOST_CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |sed -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@
3.213 --include $(DEPS)
3.214
3.215 # Each .o must depend on the corresponding .c (obvious, isn't it?),
3.216 # but *can not* depend on kconfig/, because kconfig can be touched
3.217 @@ -270,7 +114,3 @@
3.218 @$(ECHO) " CLEAN kconfig"
3.219 $(SILENT)rm -f kconfig/{,m}conf $(conf_OBJ) $(mconf_OBJ) $(DEPS)
3.220 $(SILENT)rmdir --ignore-fail-on-non-empty kconfig{/lxdialog,} 2>/dev/null || true
3.221 - @$(ECHO) " CLEAN config"
3.222 - $(SILENT)rm -f config 2>/dev/null || true
3.223 - @$(ECHO) " CLEAN config.gen"
3.224 - $(SILENT)rm -rf config.gen