diff options
author | Alexey Neyman <stilor@att.net> | 2017-04-24 03:08:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-24 03:08:26 (GMT) |
commit | 88fdbac4252744931ebcf80ade547ade525b71f4 (patch) | |
tree | 6c77f523d5c34bbf7ae1df1839f2f4275e505850 | |
parent | 368a0169a27313cca60cf7d7358b6f3ef12122e4 (diff) | |
parent | f98e04388c805a1b97b7a49e0d2da5c9acbcf887 (diff) |
Merge pull request #697 from stilor/makefile-enhancements-orig
Makefile enhancements
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile.in | 144 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rwxr-xr-x | bootstrap | 3 | ||||
-rw-r--r-- | config/backend.in | 26 | ||||
-rw-r--r-- | config/binutils.in | 4 | ||||
-rw-r--r-- | config/binutils/binutils.in | 1 | ||||
-rw-r--r-- | config/cc.in | 2 | ||||
-rw-r--r-- | config/companion_tools.in | 2 | ||||
-rw-r--r-- | config/config.in | 1 | ||||
-rw-r--r-- | config/config.mk | 114 | ||||
-rw-r--r-- | config/configure.in.in | 46 | ||||
-rw-r--r-- | config/debug.in | 2 | ||||
-rw-r--r-- | config/debug/duma.in | 1 | ||||
-rw-r--r-- | config/debug/gdb.in.native | 1 | ||||
-rw-r--r-- | config/debug/ltrace.in | 2 | ||||
-rw-r--r-- | config/debug/strace.in | 2 | ||||
-rw-r--r-- | config/global/build-behave.in | 19 | ||||
-rw-r--r-- | config/global/ct-behave.in | 1 | ||||
-rw-r--r-- | config/global/paths.in | 14 | ||||
-rw-r--r-- | config/kernel.in | 4 | ||||
-rw-r--r-- | config/libc.in | 4 | ||||
-rw-r--r-- | config/target.in | 4 | ||||
-rw-r--r-- | config/toolchain.in | 4 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | ct-ng.in | 1 | ||||
-rw-r--r-- | kconfig/Makefile | 44 | ||||
-rw-r--r-- | kconfig/kconfig.mk | 20 | ||||
-rwxr-xr-x | maintainer/gen-kconfig.sh (renamed from scripts/gen_in_frags.sh) | 83 | ||||
-rw-r--r-- | samples/samples.mk | 14 | ||||
-rw-r--r-- | scripts/saveSample.sh.in | 2 |
31 files changed, 209 insertions, 368 deletions
@@ -9,7 +9,7 @@ config.status !ct-ng.in paths.* !paths.in -config.gen/ +config/gen/ .config # Temporaries diff --git a/Makefile.in b/Makefile.in index 3d2c607..82fcd54 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,6 +35,12 @@ endif # No rR endif # No -Rr endif # No Rr +# Helper: print abbreviation of the command by default, or full command +# if doing 'make V=1'. +__silent = $(if $(V),,@printf ' %-7s %s\n' '$1' '$(if $2,$2,$(strip $<))' && ) +__silent_rm = $(call __silent,RM,$1)rm -f $1 +__silent_rmdir = $(call __silent,RMDIR,$1)rm -rf $1 + # Remove any suffix rules .SUFFIXES: @@ -83,9 +89,6 @@ export curses_hdr := @ac_ct_curses_hdr@ export gettext := @gettext@ export CPU_COUNT := @CPU_COUNT@ -# config options to push down to kconfig -KCONFIG:= @kconfig_options@ - ############################################################################### # Non-configure variables MAN_SECTION := 1 @@ -98,7 +101,7 @@ PROG_NAME := $(shell echo 'ct-ng' |$(sed) -r -e '$(PROG_SED)' ) # Check if Makefile is up to date: Makefile: Makefile.in - @echo "$< did changed: you must re-run './configure'" + @echo "$< changed: you must re-run './configure'" @false # If installing with DESTDIR, check it's an absolute path @@ -142,12 +145,11 @@ install: build real-install clean: $(patsubst %,clean-%,$(TARGETS)) distclean: clean - @echo " RM 'Makefile'" - @rm -f Makefile + $(call __silent_rm,Makefile) mrproper: distclean - @echo " RM 'autostuff'" - @ rm -rf autom4te.cache config.log config.status configure + $(call __silent_rmdir,autom4te.cache) + $(call __silent_rm,config.log config.status configure) uninstall: real-uninstall @@ -162,26 +164,25 @@ build-bin: $(PROG_NAME) \ scripts/crosstool-NG.sh \ scripts/saveSample.sh \ scripts/showConfig.sh - @chmod 755 $^ + $(call __silent,CHMOD,$^)chmod 755 $^ -build-lib: config/configure.in \ - paths.mk \ +build-lib: paths.mk \ paths.sh build-lib-kconfig: - @$(MAKE) -C kconfig + $(call __silent,ENTER,kconfig)$(MAKE) -C kconfig + $(call __silent,LEAVE,kconfig): build-doc: build-man: docs/$(PROG_NAME).1.gz docs/$(PROG_NAME).1.gz: docs/$(PROG_NAME).1 - @echo " GZIP '$@'" - @gzip -c9 $< >$@ + $(call __silent,GZIP)gzip -c9 $< >$@ define sed_it - @echo " SED '$@'" - @$(sed) -r -e 's,@@CT_BINDIR@@,$(bindir),g;' \ + $(call __silent,SED,$@)$(sed) -r \ + -e 's,@@CT_BINDIR@@,$(bindir),g;' \ -e 's,@@CT_LIBDIR@@,$(libdir),g;' \ -e 's,@@CT_DOCDIR@@,$(docdir),g;' \ -e 's,@@CT_MANDIR@@,$(mandir),g;' \ @@ -212,27 +213,10 @@ __paths_vars = install bash awk grep make sed libtool \ # We create a script fragment that is parseable from inside a Makefile, # and one from inside a shell script. paths.mk: FORCE - @echo " GEN '$@'" - @{ $(foreach w,$(__paths_vars),$(if $($w),echo 'export $w=$(subst ','\'',$($w))';)) :; } >$@ + $(call __silent,GEN,$@){ $(foreach w,$(__paths_vars),$(if $($w),echo 'export $w=$(subst ','\'',$($w))';)) :; } >$@ paths.sh: FORCE - @echo " GEN '$@'" - @{ $(foreach w,$(__paths_vars),$(if $($w),echo 'export $w="$(subst ','\'',$($w))"';)) :; } >$@ - -config/configure.in: FORCE - @echo " GEN '$@'" - @{ printf "# Generated file, do not edit\n"; \ - printf "# Default values as found by ./configure\n"; \ - for var in $(KCONFIG); do \ - printf "\n"; \ - printf "config CONFIGURE_$${var%%=*}\n"; \ - if [ "$${var#*=}" = "y" ]; then \ - printf " def_bool y\n"; \ - else \ - printf " bool\n"; \ - fi; \ - done; \ - } >$@ + $(call __silent,GEN,$@){ $(foreach w,$(__paths_vars),$(if $($w),echo 'export $w="$(subst ','\'',$($w))"';)) :; } >$@ FORCE: @@ -240,33 +224,24 @@ FORCE: # Clean rules clean-bin: - @echo " RM '$(PROG_NAME)'" - @rm -f $(PROG_NAME) - @echo " RM 'scripts/scripts.mk'" - @rm -f scripts/scripts.mk - @echo " RM 'scripts/crosstool-NG.sh'" - @rm -f scripts/crosstool-NG.sh - @echo " RM 'scripts/saveSample.sh'" - @rm -f scripts/saveSample.sh - @echo " RM 'scripts/showConfig.sh'" - @rm -f scripts/showConfig.sh + $(call __silent_rm,$(PROG_NAME)) + $(call __silent_rm,scripts/scripts.mk) + $(call __silent_rm,scripts/crosstool-NG.sh) + $(call __silent_rm,scripts/scripts/saveSample.sh) + $(call __silent_rm,scripts/scripts/showConfig.sh) clean-lib: - @echo " RM 'paths'" - @rm -f paths.mk paths.sh - @echo " RM 'config/configure.in'" - @rm -f config/configure.in + $(call __silent_rm,paths.mk paths.sh) clean-lib-kconfig: - @$(MAKE) -C kconfig clean + $(call __silent,ENTER,kconfig)$(MAKE) -C kconfig clean + $(call __silent,LEAVE,kconfig): clean-doc: clean-man: - @echo " RM 'docs/$(PROG_NAME).1'" - @rm -f docs/$(PROG_NAME).1 - @echo " RM 'docs/$(PROG_NAME).1.gz'" - @rm -f docs/$(PROG_NAME).1.gz + $(call __silent_rm,docs/$(PROG_NAME).1) + $(call __silent_rm,docs/$(PROG_NAME).1.gz) #-------------------------------------- # Check for --local setup @@ -287,8 +262,7 @@ else real-install: $(patsubst %,install-%,$(TARGETS)) install-post install-bin: $(DESTDIR)$(bindir) - @echo " INST '$(PROG_NAME)'" - @$(install) -m 755 $(PROG_NAME) "$(DESTDIR)$(bindir)/$(PROG_NAME)" + $(call __silent,INST,$(PROG_NAME))$(install) -m 755 $(PROG_NAME) "$(DESTDIR)$(bindir)/$(PROG_NAME)" # If one is hacking crosstool-NG, the patch set might change between any two # installations of the same VERSION, thus the patches must be removed prior @@ -299,30 +273,22 @@ install-lib: $(DESTDIR)$(libdir) \ install-lib-samples LIB_SUB_DIR := config contrib patches scripts -$(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(libdir) - @echo " INSTDIR '$(patsubst install-lib-%-copy,%,$(@))/'" - @tar cf - --exclude='*.sh.in' $(patsubst install-lib-%-copy,%,$(@)) \ +$(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): install-lib-%-copy: $(DESTDIR)$(libdir) + $(call __silent,INSTDIR,$*)tar cf - --exclude='*.sh.in' --exclude='*.in.in' $* \ |(cd "$(DESTDIR)$(libdir)"; tar xf -) -# We need at least one command to make this rule kick-in. -install-lib-%: install-lib-%-copy - @true - -install-lib-scripts: install-lib-scripts-copy - @chmod a+x $(DESTDIR)$(libdir)/scripts/crosstool-NG.sh - @chmod a+x $(DESTDIR)$(libdir)/scripts/saveSample.sh +# Dependency-only by default. +$(patsubst %,install-lib-%,$(LIB_SUB_DIR)): install-lib-%: install-lib-%-copy install-lib-main: $(DESTDIR)$(libdir) $(patsubst %,install-lib-%,$(LIB_SUB_DIR)) - @echo " INST 'steps.mk'" - @$(install) -m 644 steps.mk "$(DESTDIR)$(libdir)/steps.mk" - @echo " INST 'paths'" - @$(install) -m 644 paths.mk paths.sh "$(DESTDIR)$(libdir)" + $(call __silent,INST,steps.mk)$(install) -m 644 steps.mk "$(DESTDIR)$(libdir)" + $(call __silent,INST,paths.mk)$(install) -m 644 paths.mk "$(DESTDIR)$(libdir)" + $(call __silent,INST,paths.sh)$(install) -m 644 paths.sh "$(DESTDIR)$(libdir)" # Samples need a little love: # - change every occurrence of CT_TOP_DIR to CT_LIB_DIR install-lib-samples: $(DESTDIR)$(libdir) install-lib-main - @echo " INSTDIR 'samples/'" - @for samp_dir in samples/*/; do \ + $(call __silent,INSTDIR,samples)for samp_dir in samples/*/; do \ mkdir -p "$(DESTDIR)$(libdir)/$${samp_dir}"; \ $(sed) -r -e 's:\$$\{CT_TOP_DIR\}:\$$\{CT_LIB_DIR\}:;' \ -e 's:^(CT_WORK_DIR)=.*:\1="\$${CT_TOP_DIR}/.build":;' \ @@ -341,13 +307,11 @@ install-lib-samples: $(DESTDIR)$(libdir) install-lib-main done @$(install) -m 644 samples/samples.mk "$(DESTDIR)$(libdir)/samples/samples.mk" -KCONFIG_FILES := conf mconf nconf kconfig.mk install-lib-kconfig: $(DESTDIR)$(libdir) install-lib-main - @echo " INST 'kconfig/'" - @mkdir -p "$(DESTDIR)$(libdir)/kconfig" - @for f in $(KCONFIG_FILES); do \ - install "kconfig/$${f}" "$(DESTDIR)$(libdir)/kconfig/$${f}"; \ - done + $(call __silent,MKDIR,$@)$(install) -m 755 -d "$(libdir)/kconfig" + $(call __silent,ENTER,kconfig)$(MAKE) -C kconfig install \ + DESTDIR=$(DESTDIR)$(libdir)/kconfig + $(call __silent,LEAVE,kconfig): install-doc: install-doc-$(if $(wildcard docs/MANUAL_ONLINE),message,real) @@ -358,20 +322,16 @@ install-doc-message: @echo " http://crosstool-ng.github.io/docs" @echo "********************************************************************" - install-doc-real: $(DESTDIR)$(docdir) - @echo " INST 'docs/manual/*.md'" - @for doc_file in docs/manual/*.md; do \ + $(call __silent,INST,docs)for doc_file in docs/manual/*.md; do \ $(install) -m 644 "$${doc_file}" "$(DESTDIR)$(docdir)"; \ - done + done install-man: $(DESTDIR)$(mandir)$(MAN_SUBDIR) - @echo " INST '$(PROG_NAME).1.gz'" - @$(install) -m 644 docs/$(PROG_NAME).1.gz "$(DESTDIR)$(mandir)$(MAN_SUBDIR)" + $(call __silent,INST,$(PROG_NAME).1.gz)$(install) -m 644 docs/$(PROG_NAME).1.gz "$(DESTDIR)$(mandir)$(MAN_SUBDIR)" $(sort $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(docdir) $(DESTDIR)$(mandir)$(MAN_SUBDIR)): - @echo " MKDIR '$@/'" - @$(install) -m 755 -d "$@" + $(call __silent,MKDIR,$@)$(install) -m 755 -d "$@" install-post: @echo @@ -384,20 +344,16 @@ install-post: real-uninstall: $(patsubst %,uninstall-%,$(filter-out lib-kconfig,$(TARGETS))) uninstall-bin: - @echo " RM '$(DESTDIR)$(bindir)/$(PROG_NAME)'" - @rm -f "$(DESTDIR)$(bindir)/$(PROG_NAME)" + $(call __silent_rm,$(DESTDIR)$(bindir)/$(PROG_NAME)) uninstall-lib: - @echo " RMDIR '$(DESTDIR)$(libdir)/'" - @rm -rf "$(DESTDIR)$(libdir)" + $(call __silent_rmdir,$(DESTDIR)$(libdir)) uninstall-doc: - @echo " RMDIR '$(DESTDIR)$(docdir)/'" - @rm -rf "$(DESTDIR)$(docdir)" + $(call __silent_rmdir,$(DESTDIR)$(docdir)) uninstall-man: - @echo " RM '$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1.gz'" - @rm -f "$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1"{,.gz} + $(call __silent_rm,$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1.gz) endif # Not --local @@ -46,7 +46,6 @@ A (slightly) ordered set of tasks for crosstool-NG. Written in a cryptic languag [ ] add passthrough to configure, for host/target [ ] Read/spellcheck configs & scripts [ ] 'ct-ng olddefconfig' -[ ] Install config.gen so that it is not rebuilt in the installed configurations [ ] Install a "trap" C++ compiler as ${CT_TARGET}-g++ during pass-1/pass-2 to trap attempts to compile target code with g++ (currently glibc detects host g++ and warns that it uses g++ w/o target triplet) [ ] Somehow it needs to be functional during the configure step - export env var while running in CT_DoExecLog with CFG level, and forward it to host compiler? [ ] elf2flt not compatible with multiple linkers enabled in binutils (ld.bfd + ld.gold) - fix upstream? @@ -4,4 +4,7 @@ set -e printf "Running autoconf...\n" autoconf -Wall --force +printf "Generating kconfig files...\n" +./maintainer/gen-kconfig.sh + printf "Done. You may now run:\n ./configure\n" diff --git a/config/backend.in b/config/backend.in deleted file mode 100644 index 12d278b..0000000 --- a/config/backend.in +++ /dev/null @@ -1,26 +0,0 @@ -# Options specific to crosstool-NG acting as a backend - -config IS_A_BACKEND - string - option env="CT_IS_A_BACKEND" - -config BACKEND - bool - depends on OBSOLETE - default y if IS_A_BACKEND = "y" || IS_A_BACKEND = "Y" - -if BACKEND - -config BACKEND_ARCH - string - option env="CT_BACKEND_ARCH" - -config BACKEND_KERNEL - string - option env="CT_BACKEND_KERNEL" - -config BACKEND_LIBC - string - option env="CT_BACKEND_LIBC" - -endif #if BACKEND diff --git a/config/binutils.in b/config/binutils.in index 99b8b9f..0c6d5c0 100644 --- a/config/binutils.in +++ b/config/binutils.in @@ -36,7 +36,7 @@ endchoice config BINUTILS string -source "config.gen/binutils.in" -source "config.gen/binutils.in.2" +source "config/gen/binutils.in" +source "config/gen/binutils.in.2" endmenu diff --git a/config/binutils/binutils.in b/config/binutils/binutils.in index 1bb674e..c83cbb1 100644 --- a/config/binutils/binutils.in +++ b/config/binutils/binutils.in @@ -314,7 +314,6 @@ config BINUTILS_FOR_TARGET bool prompt "binutils libraries for the target" depends on ! BARE_METAL - depends on ! BACKEND help Some utilities may need binutils libraries to be available on the target, eg. oprofile. diff --git a/config/cc.in b/config/cc.in index 5603738..81f168c 100644 --- a/config/cc.in +++ b/config/cc.in @@ -20,7 +20,7 @@ config CC_CORE_PASS_1_NEEDED config CC_CORE_PASS_2_NEEDED bool -source "config.gen/cc.in" +source "config/gen/cc.in" config CC_SUPPORT_CXX bool diff --git a/config/companion_tools.in b/config/companion_tools.in index 5291f46..e5ef3fc 100644 --- a/config/companion_tools.in +++ b/config/companion_tools.in @@ -10,6 +10,6 @@ config COMP_TOOLS_FOR_HOST tools into the final toolchain (rather than just using them to build it). -source "config.gen/companion_tools.in" +source "config/gen/companion_tools.in" endmenu diff --git a/config/config.in b/config/config.in index 885f722..21b0c7e 100644 --- a/config/config.in +++ b/config/config.in @@ -1,5 +1,4 @@ source "config/configure.in" -source "config/backend.in" source "config/global.in" source "config/target.in" source "config/toolchain.in" diff --git a/config/config.mk b/config/config.mk deleted file mode 100644 index 670ecba..0000000 --- a/config/config.mk +++ /dev/null @@ -1,114 +0,0 @@ -# =========================================================================== -# crosstool-NG genererated config files -# These targets are used from top-level makefile - -#----------------------------------------------------------- -# List all config files, wether sourced or generated - -# The top-level config file to be used be configurators -# We need it to savedefconfig in scripts/saveSample.sh -export KCONFIG_TOP = config/config.in - -# Build the list of all source config files -STATIC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(shell find $(CT_LIB_DIR)/config -type f \( -name '*.in' -o -name '*.in.2' \) 2>/dev/null)) -# ... and how to access them: -$(STATIC_CONFIG_FILES): config - -# Build a list of per-component-type source config files -ARCH_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/arch/*.in))) -ARCH_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/arch/*.in.2))) -KERNEL_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/kernel/*.in))) -KERNEL_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/kernel/*.in.2))) -CC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/cc/*.in))) -CC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/cc/*.in.2))) -BINUTILS_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/binutils/*.in))) -BINUTILS_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/binutils/*.in.2))) -LIBC_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/libc/*.in))) -LIBC_CONFIG_FILES_2 = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/libc/*.in.2))) -DEBUG_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/debug/*.in))) -COMP_TOOLS_CONFIG_FILES = $(patsubst $(CT_LIB_DIR)/%,%,$(sort $(wildcard $(CT_LIB_DIR)/config/companion_tools/*.in))) - -# Build the list of generated config files -GEN_CONFIG_FILES = config.gen/arch.in \ - config.gen/kernel.in \ - config.gen/cc.in \ - config.gen/binutils.in \ - config.gen/libc.in \ - config.gen/debug.in \ - config.gen/companion_tools.in -# ... and how to access them: -# Generated files depends on the gen_in_frags script because it has the -# functions needed to build the genrated files, and thus they might need -# re-generation if it changes. -# They also depends on config.mk (this file) because it has the dependency -# rules, and thus they might need re-generation if the deps change. -$(GEN_CONFIG_FILES): config.gen \ - $(CT_LIB_DIR)/scripts/gen_in_frags.sh \ - $(CT_LIB_DIR)/config/config.mk - -# Helper entry for the configurators -PHONY += config_files -config_files: $(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES) - -# Where to access to the source config files from -config: - @$(CT_ECHO) " LN config" - $(SILENT)ln -s $(CT_LIB_DIR)/config config - -# Where to store the generated config files into -config.gen: - @$(CT_ECHO) " MKDIR config.gen" - $(SILENT)mkdir -p config.gen - -#----------------------------------------------------------- -# Build list of per-component-type items to easily build generated files - -ARCHS = $(patsubst config/arch/%.in,%,$(ARCH_CONFIG_FILES)) -KERNELS = $(patsubst config/kernel/%.in,%,$(KERNEL_CONFIG_FILES)) -CCS = $(patsubst config/cc/%.in,%,$(CC_CONFIG_FILES)) -BINUTILSS = $(patsubst config/binutils/%.in,%,$(BINUTILS_CONFIG_FILES)) -LIBCS = $(patsubst config/libc/%.in,%,$(LIBC_CONFIG_FILES)) -DEBUGS = $(patsubst config/debug/%.in,%,$(DEBUG_CONFIG_FILES)) -COMP_TOOLS= $(patsubst config/companion_tools/%.in,%,$(COMP_TOOLS_CONFIG_FILES)) - -#----------------------------------------------------------- -# The rules for the generated config files - -# WARNING! If a .in file disapears between two runs, that will NOT be detected! - -config.gen/arch.in: $(ARCH_CONFIG_FILES) $(ARCH_CONFIG_FILES_2) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Target Architecture" "ARCH" "config/arch" "Y" $(ARCHS) - -config.gen/kernel.in: $(KERNEL_CONFIG_FILES) $(KERNEL_CONFIG_FILES_2) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Target OS" "KERNEL" "config/kernel" "Y" $(KERNELS) - -config.gen/cc.in: $(CC_CONFIG_FILES) $(CC_CONFIG_FILES_2) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C compiler" "CC" "config/cc" "N" $(CCS) - -config.gen/binutils.in: $(CC_BINUTILS_FILES) $(CC_BINUTILS_FILES_2) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "Binutils" "BINUTILS" "config/binutils" "N" $(BINUTILSS) - -config.gen/libc.in: $(LIBC_CONFIG_FILES) $(LIBC_CONFIG_FILES_2) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh choice "$@" "C library" "LIBC" "config/libc" "Y" $(LIBCS) - -config.gen/debug.in: $(DEBUG_CONFIG_FILES) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh menu "$@" "Debug facilities" "DEBUG" "config/debug" $(DEBUGS) - -config.gen/companion_tools.in: $(COMP_TOOLS_CONFIG_FILES) - @$(CT_ECHO) ' IN $(@)' - $(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh menu "$@" "Companion tools" "COMP_TOOLS" "config/companion_tools" $(COMP_TOOLS) - -#----------------------------------------------------------- -# Cleaning up the mess... - -clean:: - @$(CT_ECHO) " CLEAN config" - $(SILENT)rm -f config 2>/dev/null || true - @$(CT_ECHO) " CLEAN config.gen" - $(SILENT)rm -rf config.gen diff --git a/config/configure.in.in b/config/configure.in.in new file mode 100644 index 0000000..aaebbde --- /dev/null +++ b/config/configure.in.in @@ -0,0 +1,46 @@ +# Default values as found by ./configure + +config CONFIGURE_has_static_link + @KCONFIG_static_link@ + +config CONFIGURE_has_wget + @KCONFIG_wget@ + +config CONFIGURE_has_curl + @KCONFIG_curl@ + +config CONFIGURE_has_stat_flavor_BSD + @KCONFIG_stat_flavor_BSD@ + +config CONFIGURE_has_stat_flavor_GNU + @KCONFIG_stat_flavor_GNU@ + +config CONFIGURE_has_make_3_81_or_newer + @KCONFIG_make_3_81_or_newer@ + +config CONFIGURE_has_libtool_2_4_or_newer + @KCONFIG_libtool_2_4_or_newer@ + +config CONFIGURE_has_libtoolize_2_4_or_newer + @KCONFIG_libtoolize_2_4_or_newer@ + +config CONFIGURE_has_autoconf_2_63_or_newer + @KCONFIG_autoconf_2_63_or_newer@ + +config CONFIGURE_has_autoreconf_2_63_or_newer + @KCONFIG_autoreconf_2_63_or_newer@ + +config CONFIGURE_has_automake_1_15_or_newer + @KCONFIG_automake_1_15_or_newer@ + +config CONFIGURE_has_gnu_m4_1_4_12_or_newer + @KCONFIG_gnu_m4_1_4_12_or_newer@ + +config CONFIGURE_has_cvs + @KCONFIG_cvs@ + +config CONFIGURE_has_svn + @KCONFIG_svn@ + +config CONFIGURE_has_git + @KCONFIG_git@ diff --git a/config/debug.in b/config/debug.in index 9fd99ef..8fc549b 100644 --- a/config/debug.in +++ b/config/debug.in @@ -1,3 +1,3 @@ menu "Debug facilities" -source "config.gen/debug.in" +source "config/gen/debug.in" endmenu diff --git a/config/debug/duma.in b/config/debug/duma.in index 9947ca2..170a694 100644 --- a/config/debug/duma.in +++ b/config/debug/duma.in @@ -1,6 +1,5 @@ # D.U.M.A. - Detect Unintended Memory Access - Memory checker -## depends on ! BACKEND ## depends on ! BARE_METAL ## help D.U.M.A. - Detect Unintended Memory Access diff --git a/config/debug/gdb.in.native b/config/debug/gdb.in.native index 8684c05..e856b5d 100644 --- a/config/debug/gdb.in.native +++ b/config/debug/gdb.in.native @@ -4,7 +4,6 @@ config GDB_NATIVE bool prompt "Native gdb" depends on ! BARE_METAL - depends on ! BACKEND select EXPAT_TARGET select NCURSES_TARGET help diff --git a/config/debug/ltrace.in b/config/debug/ltrace.in index fc5822d..4c62676 100644 --- a/config/debug/ltrace.in +++ b/config/debug/ltrace.in @@ -1,7 +1,5 @@ # ltrace -## depends on ! BACKEND -## ## select LIBELF_TARGET ## ## help ltrace is a program that simply runs the specified command until it exits. diff --git a/config/debug/strace.in b/config/debug/strace.in index 4cf6980..38dd96f 100644 --- a/config/debug/strace.in +++ b/config/debug/strace.in @@ -1,7 +1,5 @@ # strace -## depends on ! BACKEND - choice bool prompt "strace version" diff --git a/config/global/build-behave.in b/config/global/build-behave.in index 9ad5438..d3298ea 100644 --- a/config/global/build-behave.in +++ b/config/global/build-behave.in @@ -2,12 +2,9 @@ comment "Build behavior" -comment "Build options hiden" - depends on BACKEND - config PARALLEL_JOBS int - prompt "Number of parallel jobs" if ! BACKEND + prompt "Number of parallel jobs" default 0 help Number of jobs make will be allowed to run concurently. @@ -20,7 +17,7 @@ config PARALLEL_JOBS config LOAD string - prompt "Maximum allowed load" if ! BACKEND + prompt "Maximum allowed load" default "" help Specifies that no new jobs should be started if there are others jobs @@ -33,7 +30,7 @@ config LOAD config USE_PIPES bool - prompt "Use -pipe" if ! BACKEND + prompt "Use -pipe" default y help Use gcc's option -pipe to use pipes rather than temp files when building @@ -83,7 +80,6 @@ choice bool prompt "Shell to use as CONFIG_SHELL" default CONFIG_SHELL_BASH - depends on ! BACKEND config CONFIG_SHELL_SH bool @@ -141,13 +137,10 @@ config CONFIG_SHELL_CUSTOM endchoice -# Do not put this into the choice above, because the choice -# is not available in BACKEND-mode, while we do want this to -# be set even in BACKEND-mode. config CONFIG_SHELL_CUSTOM_PATH string - prompt "Path to custom shell" if ! BACKEND - depends on CONFIG_SHELL_CUSTOM || BACKEND + prompt "Path to custom shell" + depends on CONFIG_SHELL_CUSTOM default "/bin/sh" # Ditto. @@ -157,4 +150,4 @@ config CONFIG_SHELL default "/bin/sh" if CONFIG_SHELL_SH default "/bin/ash" if CONFIG_SHELL_ASH default "${bash}" if CONFIG_SHELL_BASH - default CONFIG_SHELL_CUSTOM_PATH if CONFIG_SHELL_CUSTOM || BACKEND + default CONFIG_SHELL_CUSTOM_PATH if CONFIG_SHELL_CUSTOM diff --git a/config/global/ct-behave.in b/config/global/ct-behave.in index a57c798..42171e4 100644 --- a/config/global/ct-behave.in +++ b/config/global/ct-behave.in @@ -63,7 +63,6 @@ config ALLOW_BUILD_AS_ROOT_SURE config DEBUG_CT bool prompt "Debug crosstool-NG" - depends on ! BACKEND help Say 'y' here to get some options regarding debugging crosstool-NG. diff --git a/config/global/paths.in b/config/global/paths.in index 5313d0d..39e15f3 100644 --- a/config/global/paths.in +++ b/config/global/paths.in @@ -4,7 +4,7 @@ comment "Paths" config LOCAL_TARBALLS_DIR string - prompt "Local tarballs directory" if ! BACKEND + prompt "Local tarballs directory" default "${HOME}/src" help If you have previously downloaded the tarballs, enter the PATH where @@ -12,8 +12,8 @@ config LOCAL_TARBALLS_DIR config SAVE_TARBALLS bool - prompt "Save new tarballs" if ! BACKEND - depends on LOCAL_TARBALLS_DIR != "" || BACKEND + prompt "Save new tarballs" + depends on LOCAL_TARBALLS_DIR != "" default y help If you say 'y' here, new downloaded tarballs will be saved in the @@ -21,7 +21,7 @@ config SAVE_TARBALLS config WORK_DIR string - prompt "Working directory" if ! BACKEND + prompt "Working directory" default "${CT_TOP_DIR}/.build" help Set this to the directory where all build actions will be done. @@ -46,7 +46,7 @@ config BUILD_TOP_DIR config PREFIX_DIR string - prompt "Prefix directory" if ! BACKEND + prompt "Prefix directory" default "${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" help This is the path the toolchain will run from. @@ -55,7 +55,6 @@ config RM_RF_PREFIX_DIR bool prompt "| Remove the prefix dir prior to building" default y - depends on !BACKEND help If you say 'y' here, then PREFIX_DIR (above) will be eradicated prior to the toolchain is built. @@ -69,9 +68,6 @@ config RM_RF_PREFIX_DIR it into a directory with pre-install, unrelated programs, it would be damageable to remove that directory. In this case, you may want to say 'n' here. - - Note that when acting as a backend, this option is not available, and - is forced to 'n'. config REMOVE_DOCS bool diff --git a/config/kernel.in b/config/kernel.in index 64b69c6..c04f2cb 100644 --- a/config/kernel.in +++ b/config/kernel.in @@ -22,7 +22,7 @@ config KERNEL config KERNEL_VERSION string -source "config.gen/kernel.in" +source "config/gen/kernel.in" comment "Common kernel options" @@ -37,6 +37,6 @@ config SHARED_LIBS You might not want shared libraries if you're building for a target that don't support it (maybe some nommu targets, for example, or bare metal). -source "config.gen/kernel.in.2" +source "config/gen/kernel.in.2" endmenu diff --git a/config/libc.in b/config/libc.in index 0566212..708c3b6 100644 --- a/config/libc.in +++ b/config/libc.in @@ -19,7 +19,7 @@ config LIBC_VERSION So if you want to be able to re-build your toolchain later, you will have to save your C library tarball by yourself. -source "config.gen/libc.in" +source "config/gen/libc.in" config LIBC_SUPPORT_THREADS_ANY bool @@ -123,7 +123,7 @@ config LIBC_XLDD for the native ldd. Please see the help, by running it with '--help' for more explanations. -source "config.gen/libc.in.2" +source "config/gen/libc.in.2" endif # ! LIBC_none diff --git a/config/target.in b/config/target.in index af010c0..7e4e837 100644 --- a/config/target.in +++ b/config/target.in @@ -5,7 +5,7 @@ menu "Target options" config ARCH string -source "config.gen/arch.in" +source "config/gen/arch.in" config ARCH_SUFFIX string @@ -392,6 +392,6 @@ config ARCH_FLOAT default "soft" if ARCH_FLOAT_SW default "softfp" if ARCH_FLOAT_SOFTFP -source "config.gen/arch.in.2" +source "config/gen/arch.in.2" endmenu diff --git a/config/toolchain.in b/config/toolchain.in index c712f39..1b2a289 100644 --- a/config/toolchain.in +++ b/config/toolchain.in @@ -20,7 +20,7 @@ config USE_SYSROOT config SYSROOT_NAME string - prompt "sysroot directory name" if ! BACKEND + prompt "sysroot directory name" depends on USE_SYSROOT default "sysroot" help @@ -33,7 +33,7 @@ config SYSROOT_NAME config SYSROOT_DIR_PREFIX string - prompt "sysroot prefix dir (READ HELP)" if ! BACKEND + prompt "sysroot prefix dir (READ HELP)" depends on USE_SYSROOT default "" help diff --git a/configure.ac b/configure.ac index d10bf71..869226c 100644 --- a/configure.ac +++ b/configure.ac @@ -65,10 +65,9 @@ AC_DEFUN( AC_DEFUN( [ACX_SET_KCONFIG_OPTION], [AS_IF( - [test -n "$$1"], - [kconfig_options="$kconfig_options has_$1=y"], - [kconfig_options="$kconfig_options has_$1"]) - ]) + [test -n "$$1"], + [AC_SUBST([KCONFIG_$1], ["def_bool y"])], + [AC_SUBST([KCONFIG_$1], ["bool"])])]) # Check if a given program is available with a particular version. # ACX_PROG_VERSION(VAR, HELP, PROG, SRCH, VERSION_CHECK[, CONFIG_OPT]) @@ -466,5 +465,5 @@ AS_IF( #-------------------------------------------------------------------- # Finally, generate the output file(s) #-------------------------------------------------------------------- -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile config/configure.in]) AC_OUTPUT @@ -111,7 +111,6 @@ help-clean:: @echo ' clean - Remove generated files' @echo ' distclean - Remove generated files, configuration and build directories' -include $(CT_LIB_DIR)/config/config.mk include $(CT_LIB_DIR)/kconfig/kconfig.mk include $(CT_LIB_DIR)/steps.mk include $(CT_LIB_DIR)/samples/samples.mk diff --git a/kconfig/Makefile b/kconfig/Makefile index ee838aa..4a33ac8 100644 --- a/kconfig/Makefile +++ b/kconfig/Makefile @@ -2,7 +2,12 @@ # Hmmm! Cheesy build! # Or: where I can unveil my make-fu... :-] -all: conf mconf nconf +__silent = $(if $(V),,@printf ' %-7s %s\n' '$1' '$(if $2,$2,$(strip $<))' && ) +__silent_rm = $(call __silent,RM,$1)rm -f $1 + +PROGS = conf mconf nconf + +all: $(PROGS) @true # Just be silent, you fscking son of a fscking beach... # Build flags @@ -64,8 +69,7 @@ DEPS += $(nconf_DEP) # Build the dependency for C files %.dep: %.c - @echo " DEP '$@'" - @$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@ + $(call __silent,DEP,$@)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@ # Generate the grammar parser zconf.tab.o: zconf.tab.c zconf.hash.c zconf.lex.c @@ -73,39 +77,39 @@ zconf.tab.dep: zconf.tab.c zconf.hash.c zconf.lex.c .PRECIOUS: zconf.tab.c zconf.tab.c: zconf.y - @echo " BISON '$@'" - @bison -l -b zconf -p zconf $< + $(call __silent,BISON)bison -l -b zconf -p zconf $< zconf.hash.c: zconf.gperf - @echo " GPERF '$@'" - @$(gperf) -C < $< > $@ + $(call __silent,GPERF)$(gperf) -C < $< > $@ zconf.lex.c: zconf.l - @echo " LEX '$@'" - @flex -L -Pzconf -o$@ $< + $(call __silent,LEX)flex -L -Pzconf -o$@ $< # Build C files %.o: %.c - @echo " CC '$@'" - @$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< + $(call __silent,CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< # Actual link mconf: $(COMMON_OBJ) $(LX_OBJ) $(mconf_OBJ) - @echo " LD '$@'" - @$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS) + $(call __silent,LD,$@)$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS) nconf: $(COMMON_OBJ) $(nconf_OBJ) - @echo " LD '$@'" - @$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS) + $(call __silent,LD,$@)$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS) conf: $(COMMON_OBJ) $(conf_OBJ) - @echo " LD '$@'" - @$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS) + $(call __silent,LD,$@)$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS) + +#----------------------------------------------------------- +# Installation +install: $(patsubst %,install-%,$(PROGS)) install-kconfig.mk + +install-%: % + $(call __silent,INSTALL,$<)install $< $(DESTDIR)/$< #----------------------------------------------------------- # Cleaning up the mess... clean: - @echo " RM 'kconfig'" - @rm -f conf mconf nconf $(ALL_OBJS) $(ALL_DEPS) - @rm -f rm -f zconf.tab.c zconf.hash.c zconf.lex.c lex.backup + $(call __silent,RM,objs)rm -f $(ALL_OBJS) $(ALL_DEPS) + $(call __silent_rm,$(PROGS)) + $(call __silent_rm,zconf.tab.c zconf.hash.c zconf.lex.c lex.backup) diff --git a/kconfig/kconfig.mk b/kconfig/kconfig.mk index 3d330b4..c82e502 100644 --- a/kconfig/kconfig.mk +++ b/kconfig/kconfig.mk @@ -5,31 +5,27 @@ #----------------------------------------------------------- # The configurators rules -configurators = menuconfig nconfig oldconfig savedefconfig defconfig -PHONY += $(configurators) - -$(configurators): config_files - -export CT_IS_A_BACKEND:=$(CT_IS_A_BACKEND) -export CT_BACKEND_ARCH:=$(CT_BACKEND_ARCH) -export CT_BACKEND_KERNEL:=$(CT_BACKEND_KERNEL) -export CT_BACKEND_LIBC:=$(CT_BACKEND_LIBC) +# Top file of crosstool-NG configuration +export KCONFIG_TOP = $(CT_LIB_DIR)/config/config.in # We need CONF for savedefconfig in scripts/saveSample.sh export CONF := $(CT_LIB_DIR)/kconfig/conf MCONF := $(CT_LIB_DIR)/kconfig/mconf NCONF := $(CT_LIB_DIR)/kconfig/nconf +# Used by conf/mconf/nconf to find the .in files +export srctree=$(CT_LIB_DIR) + menuconfig: - @$(CT_ECHO) " CONF $(KCONFIG_TOP)" + @$(CT_ECHO) " CONF $@" $(SILENT)$(MCONF) $(KCONFIG_TOP) nconfig: - @$(CT_ECHO) " CONF $(KCONFIG_TOP)" + @$(CT_ECHO) " CONF $@" $(SILENT)$(NCONF) $(KCONFIG_TOP) oldconfig: .config - @$(CT_ECHO) " CONF $(KCONFIG_TOP)" + @$(CT_ECHO) " CONF $@" $(SILENT)$(CONF) --silent$@ $(KCONFIG_TOP) savedefconfig: .config diff --git a/scripts/gen_in_frags.sh b/maintainer/gen-kconfig.sh index 9fbb871..364844d 100755 --- a/scripts/gen_in_frags.sh +++ b/maintainer/gen-kconfig.sh @@ -1,15 +1,19 @@ -#!/bin/sh +#!/bin/bash + set -e -# This scripts generates either a choice or a menuconfig -# with the specified entries. +# Accept overrides from command line if needed +sed=${SED:-sed} +grep=${GREP:-grep} + +# Generate either a choice or a menuconfig with the specified entries. # # Usage: # generate a choice: -# gen_in_frags.sh choice <out-file> <label> <config-prefix> <base-dir> <conditionals> entry [entry...] +# gen_choice <out-file> <label> <config-prefix> <base-dir> # # generate a menuconfig: -# gen_in_frags.sh menu <out-file> <label> <config-prefix> <base-dir> entry [entry...] +# gen_menu <out-file> <label> <config-prefix> <base-dir> # # where: # out-file @@ -29,19 +33,17 @@ set -e # base directory containing config files # eg. config/arch, config/kernel... # -# conditionals (valid only for choice) -# generate backend conditionals if Y/y, don't if anything else -# if 'Y' (or 'y'), a dependency on the backen mode will be added -# to each entry -# -# entry [entry...] -# a list of entry/ies toadd to the choice/menuconfig -# eg.: -# arm mips sh x86... -# linux cygwin mingw32 solaris... -# ... -# -#------------------------------------------------------------------------------ + +# Helper: find the base names of all *.in files in a given directory +get_components() { + local dir="${1}" + local f b + + for f in ${dir}/*.in; do + b=${f#${dir}/} + echo ${b%.in} + done +} # Generate a choice # See above for usage @@ -50,8 +52,6 @@ gen_choice() { local label="${2}" local cfg_prefix="${3}" local base_dir="${4}" - local cond="${5}" - shift 5 local file entry _entry # Generate the part-1 @@ -63,15 +63,12 @@ gen_choice() { printf ' bool\n' printf ' prompt "%s"\n' "${label}" printf '\n' - for entry in "${@}"; do + for entry in `get_components ${base_dir}`; do file="${base_dir}/${entry}.in" _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') printf 'config %s_%s\n' "${cfg_prefix}" "${_entry}" printf ' bool\n' printf ' prompt "%s"\n' "${entry}" - if [ "${cond}" = "Y" -o "${cond}" = "y" ]; then - printf ' depends on %s_%s_AVAILABLE\n' "${cfg_prefix}" "${_entry}" - fi "${sed}" -r -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null "${sed}" -r -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null if "${grep}" -E '^## help' ${file} >/dev/null 2>&1; then @@ -82,21 +79,19 @@ gen_choice() { done printf 'endchoice\n' - for entry in "${@}"; do + printf '\n' + printf 'config %s\n' "${cfg_prefix}" + for entry in `get_components ${base_dir}`; do file="${base_dir}/${entry}.in" _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') - printf '\n' - if [ "${cond}" = "Y" -o "${cond}" = "y" ]; then - printf 'config %s_%s_AVAILABLE\n' "${cfg_prefix}" "${_entry}" - printf ' bool\n' - printf ' default y if' - printf ' BACKEND_%s = "%s"' "${cfg_prefix}" "${entry}" - printf ' || BACKEND_%s = ""' "${cfg_prefix}" - printf ' || ! BACKEND\n' - fi - printf 'if %s_%s\n' "${cfg_prefix}" "${_entry}" - printf 'config %s\n' "${cfg_prefix}" printf ' default "%s" if %s_%s\n' "${entry}" "${cfg_prefix}" "${_entry}" + done + + printf '\n' + for entry in `get_components ${base_dir}`; do + file="${base_dir}/${entry}.in" + _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') + printf 'if %s_%s\n' "${cfg_prefix}" "${_entry}" printf 'source "%s"\n' "${file}" printf 'endif\n' done @@ -105,7 +100,7 @@ gen_choice() { exec >"${out_file}.2" printf '# %s second part options\n' "${label}" printf '# Generated file, do not edit!!!\n' - for entry in "${@}"; do + for entry in `get_components ${base_dir}`; do file="${base_dir}/${entry}.in" _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') if [ -f "${file}.2" ]; then @@ -125,7 +120,6 @@ gen_menu() { local label="${2}" local cfg_prefix="${3}" local base_dir="${4}" - shift 4 local file entry _entry # Generate the menuconfig @@ -133,7 +127,7 @@ gen_menu() { printf '# %s menu\n' "${label}" printf '# Generated file, do not edit!!!\n' printf '\n' - for entry in "${@}"; do + for entry in `get_components ${base_dir}`; do file="${base_dir}/${entry}.in" _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') printf 'menuconfig %s_%s\n' "${cfg_prefix}" "${_entry}" @@ -156,6 +150,11 @@ gen_menu() { done } -type="${1}" -shift -"gen_${type}" "${@}" +mkdir -p config/gen +gen_choice config/gen/arch.in "Target Architecture" "ARCH" "config/arch" +gen_choice config/gen/kernel.in "Target OS" "KERNEL" "config/kernel" +gen_choice config/gen/cc.in "Compiler" "CC" "config/cc" +gen_choice config/gen/binutils.in "Binutils" "BINUTILS" "config/binutils" +gen_choice config/gen/libc.in "C library" "LIBC" "config/libc" +gen_menu config/gen/debug.in "Debug facilities" "DEBUG" "config/debug" +gen_menu config/gen/companion_tools.in "Companion tools" "COMP_TOOLS" "config/companion_tools" diff --git a/samples/samples.mk b/samples/samples.mk index 5c8f130..ce7e7c9 100644 --- a/samples/samples.mk +++ b/samples/samples.mk @@ -48,7 +48,7 @@ show-config: .config # Prints the details of a sample PHONY += $(patsubst %,show-%,$(CT_SAMPLES)) -$(patsubst %,show-%,$(CT_SAMPLES)): show-%: config_files +$(patsubst %,show-%,$(CT_SAMPLES)): show-%: @KCONFIG_CONFIG=$$(pwd)/.config.sample \ $(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \ $(KCONFIG_TOP) >/dev/null @@ -72,7 +72,7 @@ list-samples-pre: FORCE @echo 'Status Sample name' PHONY += $(patsubst %,list-%,$(CT_SAMPLES)) -$(patsubst %,list-%,$(CT_SAMPLES)): list-%: config_files +$(patsubst %,list-%,$(CT_SAMPLES)): list-%: @KCONFIG_CONFIG=$$(pwd)/.config.sample \ $(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \ $(KCONFIG_TOP) >/dev/null @@ -87,7 +87,7 @@ list-samples-short: FORCE # Check one sample PHONY += $(patsubst %,check-%,$(CT_SAMPLES)) -$(patsubst %,check-%,$(CT_SAMPLES)): check-%: config_files +$(patsubst %,check-%,$(CT_SAMPLES)): check-%: @export KCONFIG_CONFIG=$$(pwd)/.config.sample; \ CT_NG_SAMPLE=$(call sample_dir,$*)/crosstool.config; \ $(CONF) -s --defconfig=$${CT_NG_SAMPLE} $(KCONFIG_TOP) &>/dev/null; \ @@ -119,7 +119,7 @@ wiki-samples-pre: FORCE wiki-samples-post: FORCE $(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -W $(CT_SAMPLES) -$(patsubst %,wiki-%,$(CT_SAMPLES)): wiki-%: config_files +$(patsubst %,wiki-%,$(CT_SAMPLES)): wiki-%: $(SILENT)KCONFIG_CONFIG=$$(pwd)/.config.sample \ $(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \ $(KCONFIG_TOP) >/dev/null @@ -146,8 +146,8 @@ endef # How we do recall one sample PHONY += $(CT_SAMPLES) -$(CT_SAMPLES): config_files - @$(CT_ECHO) " CONF $(KCONFIG_TOP)" +$(CT_SAMPLES): + @$(CT_ECHO) " CONF $@" $(SILENT)$(CONF) --defconfig=$(call sample_dir,$@)/crosstool.config $(KCONFIG_TOP) @echo @echo '***********************************************************' @@ -225,7 +225,7 @@ endif # MAKECMDGOALS contains a build sample rule endif # MAKECMDGOALS != "" # Build a single sample -$(patsubst %,build-%,$(CT_SAMPLES)): build-%: config_files +$(patsubst %,build-%,$(CT_SAMPLES)): build-%: $(call build_sample,$*) # Cross samples (build==host) diff --git a/scripts/saveSample.sh.in b/scripts/saveSample.sh.in index 2e413bd..2eb1f40 100644 --- a/scripts/saveSample.sh.in +++ b/scripts/saveSample.sh.in @@ -86,7 +86,7 @@ fi # Now, actually save the defconfig export KCONFIG_CONFIG="$(pwd)/.defconfig" -${CONF} --savedefconfig="${samp_dir}/crosstool.config" "${KCONFIG_TOP}" +srctree="${CT_LIB_DIR}" ${CONF} --savedefconfig="${samp_dir}/crosstool.config" "${KCONFIG_TOP}" rm -f .defconfig # Fill-in the reported-by info |