Merge pull request #697 from stilor/makefile-enhancements-orig

Makefile enhancements
This commit is contained in:
Alexey Neyman 2017-04-23 20:08:26 -07:00 committed by GitHub
commit 88fdbac425
31 changed files with 209 additions and 368 deletions

2
.gitignore vendored
View File

@ -9,7 +9,7 @@ config.status
!ct-ng.in !ct-ng.in
paths.* paths.*
!paths.in !paths.in
config.gen/ config/gen/
.config .config
# Temporaries # Temporaries

View File

@ -35,6 +35,12 @@ endif # No rR
endif # No -Rr 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 # Remove any suffix rules
.SUFFIXES: .SUFFIXES:
@ -83,9 +89,6 @@ export curses_hdr := @ac_ct_curses_hdr@
export gettext := @gettext@ export gettext := @gettext@
export CPU_COUNT := @CPU_COUNT@ export CPU_COUNT := @CPU_COUNT@
# config options to push down to kconfig
KCONFIG:= @kconfig_options@
############################################################################### ###############################################################################
# Non-configure variables # Non-configure variables
MAN_SECTION := 1 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: # Check if Makefile is up to date:
Makefile: Makefile.in Makefile: Makefile.in
@echo "$< did changed: you must re-run './configure'" @echo "$< changed: you must re-run './configure'"
@false @false
# If installing with DESTDIR, check it's an absolute path # If installing with DESTDIR, check it's an absolute path
@ -142,12 +145,11 @@ install: build real-install
clean: $(patsubst %,clean-%,$(TARGETS)) clean: $(patsubst %,clean-%,$(TARGETS))
distclean: clean distclean: clean
@echo " RM 'Makefile'" $(call __silent_rm,Makefile)
@rm -f Makefile
mrproper: distclean mrproper: distclean
@echo " RM 'autostuff'" $(call __silent_rmdir,autom4te.cache)
@ rm -rf autom4te.cache config.log config.status configure $(call __silent_rm,config.log config.status configure)
uninstall: real-uninstall uninstall: real-uninstall
@ -162,26 +164,25 @@ build-bin: $(PROG_NAME) \
scripts/crosstool-NG.sh \ scripts/crosstool-NG.sh \
scripts/saveSample.sh \ scripts/saveSample.sh \
scripts/showConfig.sh scripts/showConfig.sh
@chmod 755 $^ $(call __silent,CHMOD,$^)chmod 755 $^
build-lib: config/configure.in \ build-lib: paths.mk \
paths.mk \
paths.sh paths.sh
build-lib-kconfig: build-lib-kconfig:
@$(MAKE) -C kconfig $(call __silent,ENTER,kconfig)$(MAKE) -C kconfig
$(call __silent,LEAVE,kconfig):
build-doc: build-doc:
build-man: docs/$(PROG_NAME).1.gz build-man: docs/$(PROG_NAME).1.gz
docs/$(PROG_NAME).1.gz: docs/$(PROG_NAME).1 docs/$(PROG_NAME).1.gz: docs/$(PROG_NAME).1
@echo " GZIP '$@'" $(call __silent,GZIP)gzip -c9 $< >$@
@gzip -c9 $< >$@
define sed_it define sed_it
@echo " SED '$@'" $(call __silent,SED,$@)$(sed) -r \
@$(sed) -r -e 's,@@CT_BINDIR@@,$(bindir),g;' \ -e 's,@@CT_BINDIR@@,$(bindir),g;' \
-e 's,@@CT_LIBDIR@@,$(libdir),g;' \ -e 's,@@CT_LIBDIR@@,$(libdir),g;' \
-e 's,@@CT_DOCDIR@@,$(docdir),g;' \ -e 's,@@CT_DOCDIR@@,$(docdir),g;' \
-e 's,@@CT_MANDIR@@,$(mandir),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, # We create a script fragment that is parseable from inside a Makefile,
# and one from inside a shell script. # and one from inside a shell script.
paths.mk: FORCE paths.mk: FORCE
@echo " GEN '$@'" $(call __silent,GEN,$@){ $(foreach w,$(__paths_vars),$(if $($w),echo 'export $w=$(subst ','\'',$($w))';)) :; } >$@
@{ $(foreach w,$(__paths_vars),$(if $($w),echo 'export $w=$(subst ','\'',$($w))';)) :; } >$@
paths.sh: FORCE paths.sh: FORCE
@echo " GEN '$@'" $(call __silent,GEN,$@){ $(foreach w,$(__paths_vars),$(if $($w),echo 'export $w="$(subst ','\'',$($w))"';)) :; } >$@
@{ $(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; \
} >$@
FORCE: FORCE:
@ -240,33 +224,24 @@ FORCE:
# Clean rules # Clean rules
clean-bin: clean-bin:
@echo " RM '$(PROG_NAME)'" $(call __silent_rm,$(PROG_NAME))
@rm -f $(PROG_NAME) $(call __silent_rm,scripts/scripts.mk)
@echo " RM 'scripts/scripts.mk'" $(call __silent_rm,scripts/crosstool-NG.sh)
@rm -f scripts/scripts.mk $(call __silent_rm,scripts/scripts/saveSample.sh)
@echo " RM 'scripts/crosstool-NG.sh'" $(call __silent_rm,scripts/scripts/showConfig.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
clean-lib: clean-lib:
@echo " RM 'paths'" $(call __silent_rm,paths.mk paths.sh)
@rm -f paths.mk paths.sh
@echo " RM 'config/configure.in'"
@rm -f config/configure.in
clean-lib-kconfig: clean-lib-kconfig:
@$(MAKE) -C kconfig clean $(call __silent,ENTER,kconfig)$(MAKE) -C kconfig clean
$(call __silent,LEAVE,kconfig):
clean-doc: clean-doc:
clean-man: clean-man:
@echo " RM 'docs/$(PROG_NAME).1'" $(call __silent_rm,docs/$(PROG_NAME).1)
@rm -f docs/$(PROG_NAME).1 $(call __silent_rm,docs/$(PROG_NAME).1.gz)
@echo " RM 'docs/$(PROG_NAME).1.gz'"
@rm -f docs/$(PROG_NAME).1.gz
#-------------------------------------- #--------------------------------------
# Check for --local setup # Check for --local setup
@ -287,8 +262,7 @@ else
real-install: $(patsubst %,install-%,$(TARGETS)) install-post real-install: $(patsubst %,install-%,$(TARGETS)) install-post
install-bin: $(DESTDIR)$(bindir) install-bin: $(DESTDIR)$(bindir)
@echo " INST '$(PROG_NAME)'" $(call __silent,INST,$(PROG_NAME))$(install) -m 755 $(PROG_NAME) "$(DESTDIR)$(bindir)/$(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 # 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 # installations of the same VERSION, thus the patches must be removed prior
@ -299,30 +273,22 @@ install-lib: $(DESTDIR)$(libdir) \
install-lib-samples install-lib-samples
LIB_SUB_DIR := config contrib patches scripts LIB_SUB_DIR := config contrib patches scripts
$(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(libdir) $(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): install-lib-%-copy: $(DESTDIR)$(libdir)
@echo " INSTDIR '$(patsubst install-lib-%-copy,%,$(@))/'" $(call __silent,INSTDIR,$*)tar cf - --exclude='*.sh.in' --exclude='*.in.in' $* \
@tar cf - --exclude='*.sh.in' $(patsubst install-lib-%-copy,%,$(@)) \
|(cd "$(DESTDIR)$(libdir)"; tar xf -) |(cd "$(DESTDIR)$(libdir)"; tar xf -)
# We need at least one command to make this rule kick-in. # Dependency-only by default.
install-lib-%: install-lib-%-copy $(patsubst %,install-lib-%,$(LIB_SUB_DIR)): 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
install-lib-main: $(DESTDIR)$(libdir) $(patsubst %,install-lib-%,$(LIB_SUB_DIR)) install-lib-main: $(DESTDIR)$(libdir) $(patsubst %,install-lib-%,$(LIB_SUB_DIR))
@echo " INST 'steps.mk'" $(call __silent,INST,steps.mk)$(install) -m 644 steps.mk "$(DESTDIR)$(libdir)"
@$(install) -m 644 steps.mk "$(DESTDIR)$(libdir)/steps.mk" $(call __silent,INST,paths.mk)$(install) -m 644 paths.mk "$(DESTDIR)$(libdir)"
@echo " INST 'paths'" $(call __silent,INST,paths.sh)$(install) -m 644 paths.sh "$(DESTDIR)$(libdir)"
@$(install) -m 644 paths.mk paths.sh "$(DESTDIR)$(libdir)"
# Samples need a little love: # Samples need a little love:
# - change every occurrence of CT_TOP_DIR to CT_LIB_DIR # - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
install-lib-samples: $(DESTDIR)$(libdir) install-lib-main install-lib-samples: $(DESTDIR)$(libdir) install-lib-main
@echo " INSTDIR 'samples/'" $(call __silent,INSTDIR,samples)for samp_dir in samples/*/; do \
@for samp_dir in samples/*/; do \
mkdir -p "$(DESTDIR)$(libdir)/$${samp_dir}"; \ mkdir -p "$(DESTDIR)$(libdir)/$${samp_dir}"; \
$(sed) -r -e 's:\$$\{CT_TOP_DIR\}:\$$\{CT_LIB_DIR\}:;' \ $(sed) -r -e 's:\$$\{CT_TOP_DIR\}:\$$\{CT_LIB_DIR\}:;' \
-e 's:^(CT_WORK_DIR)=.*:\1="\$${CT_TOP_DIR}/.build":;' \ -e 's:^(CT_WORK_DIR)=.*:\1="\$${CT_TOP_DIR}/.build":;' \
@ -341,13 +307,11 @@ install-lib-samples: $(DESTDIR)$(libdir) install-lib-main
done done
@$(install) -m 644 samples/samples.mk "$(DESTDIR)$(libdir)/samples/samples.mk" @$(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 install-lib-kconfig: $(DESTDIR)$(libdir) install-lib-main
@echo " INST 'kconfig/'" $(call __silent,MKDIR,$@)$(install) -m 755 -d "$(libdir)/kconfig"
@mkdir -p "$(DESTDIR)$(libdir)/kconfig" $(call __silent,ENTER,kconfig)$(MAKE) -C kconfig install \
@for f in $(KCONFIG_FILES); do \ DESTDIR=$(DESTDIR)$(libdir)/kconfig
install "kconfig/$${f}" "$(DESTDIR)$(libdir)/kconfig/$${f}"; \ $(call __silent,LEAVE,kconfig):
done
install-doc: install-doc-$(if $(wildcard docs/MANUAL_ONLINE),message,real) 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 " http://crosstool-ng.github.io/docs"
@echo "********************************************************************" @echo "********************************************************************"
install-doc-real: $(DESTDIR)$(docdir) install-doc-real: $(DESTDIR)$(docdir)
@echo " INST 'docs/manual/*.md'" $(call __silent,INST,docs)for doc_file in docs/manual/*.md; do \
@for doc_file in docs/manual/*.md; do \
$(install) -m 644 "$${doc_file}" "$(DESTDIR)$(docdir)"; \ $(install) -m 644 "$${doc_file}" "$(DESTDIR)$(docdir)"; \
done done
install-man: $(DESTDIR)$(mandir)$(MAN_SUBDIR) install-man: $(DESTDIR)$(mandir)$(MAN_SUBDIR)
@echo " INST '$(PROG_NAME).1.gz'" $(call __silent,INST,$(PROG_NAME).1.gz)$(install) -m 644 docs/$(PROG_NAME).1.gz "$(DESTDIR)$(mandir)$(MAN_SUBDIR)"
@$(install) -m 644 docs/$(PROG_NAME).1.gz "$(DESTDIR)$(mandir)$(MAN_SUBDIR)"
$(sort $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(docdir) $(DESTDIR)$(mandir)$(MAN_SUBDIR)): $(sort $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(docdir) $(DESTDIR)$(mandir)$(MAN_SUBDIR)):
@echo " MKDIR '$@/'" $(call __silent,MKDIR,$@)$(install) -m 755 -d "$@"
@$(install) -m 755 -d "$@"
install-post: install-post:
@echo @echo
@ -384,20 +344,16 @@ install-post:
real-uninstall: $(patsubst %,uninstall-%,$(filter-out lib-kconfig,$(TARGETS))) real-uninstall: $(patsubst %,uninstall-%,$(filter-out lib-kconfig,$(TARGETS)))
uninstall-bin: uninstall-bin:
@echo " RM '$(DESTDIR)$(bindir)/$(PROG_NAME)'" $(call __silent_rm,$(DESTDIR)$(bindir)/$(PROG_NAME))
@rm -f "$(DESTDIR)$(bindir)/$(PROG_NAME)"
uninstall-lib: uninstall-lib:
@echo " RMDIR '$(DESTDIR)$(libdir)/'" $(call __silent_rmdir,$(DESTDIR)$(libdir))
@rm -rf "$(DESTDIR)$(libdir)"
uninstall-doc: uninstall-doc:
@echo " RMDIR '$(DESTDIR)$(docdir)/'" $(call __silent_rmdir,$(DESTDIR)$(docdir))
@rm -rf "$(DESTDIR)$(docdir)"
uninstall-man: uninstall-man:
@echo " RM '$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1.gz'" $(call __silent_rm,$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1.gz)
@rm -f "$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1"{,.gz}
endif # Not --local endif # Not --local

1
TODO
View File

@ -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 [ ] add passthrough to configure, for host/target
[ ] Read/spellcheck configs & scripts [ ] Read/spellcheck configs & scripts
[ ] 'ct-ng olddefconfig' [ ] '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) [ ] 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? [ ] 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? [ ] elf2flt not compatible with multiple linkers enabled in binutils (ld.bfd + ld.gold) - fix upstream?

View File

@ -4,4 +4,7 @@ set -e
printf "Running autoconf...\n" printf "Running autoconf...\n"
autoconf -Wall --force autoconf -Wall --force
printf "Generating kconfig files...\n"
./maintainer/gen-kconfig.sh
printf "Done. You may now run:\n ./configure\n" printf "Done. You may now run:\n ./configure\n"

View File

@ -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

View File

@ -36,7 +36,7 @@ endchoice
config BINUTILS config BINUTILS
string string
source "config.gen/binutils.in" source "config/gen/binutils.in"
source "config.gen/binutils.in.2" source "config/gen/binutils.in.2"
endmenu endmenu

View File

@ -314,7 +314,6 @@ config BINUTILS_FOR_TARGET
bool bool
prompt "binutils libraries for the target" prompt "binutils libraries for the target"
depends on ! BARE_METAL depends on ! BARE_METAL
depends on ! BACKEND
help help
Some utilities may need binutils libraries to be available on Some utilities may need binutils libraries to be available on
the target, eg. oprofile. the target, eg. oprofile.

View File

@ -20,7 +20,7 @@ config CC_CORE_PASS_1_NEEDED
config CC_CORE_PASS_2_NEEDED config CC_CORE_PASS_2_NEEDED
bool bool
source "config.gen/cc.in" source "config/gen/cc.in"
config CC_SUPPORT_CXX config CC_SUPPORT_CXX
bool bool

View File

@ -10,6 +10,6 @@ config COMP_TOOLS_FOR_HOST
tools into the final toolchain (rather than just using them tools into the final toolchain (rather than just using them
to build it). to build it).
source "config.gen/companion_tools.in" source "config/gen/companion_tools.in"
endmenu endmenu

View File

@ -1,5 +1,4 @@
source "config/configure.in" source "config/configure.in"
source "config/backend.in"
source "config/global.in" source "config/global.in"
source "config/target.in" source "config/target.in"
source "config/toolchain.in" source "config/toolchain.in"

View File

@ -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

46
config/configure.in.in Normal file
View File

@ -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@

View File

@ -1,3 +1,3 @@
menu "Debug facilities" menu "Debug facilities"
source "config.gen/debug.in" source "config/gen/debug.in"
endmenu endmenu

View File

@ -1,6 +1,5 @@
# D.U.M.A. - Detect Unintended Memory Access - Memory checker # D.U.M.A. - Detect Unintended Memory Access - Memory checker
## depends on ! BACKEND
## depends on ! BARE_METAL ## depends on ! BARE_METAL
## help D.U.M.A. - Detect Unintended Memory Access ## help D.U.M.A. - Detect Unintended Memory Access

View File

@ -4,7 +4,6 @@ config GDB_NATIVE
bool bool
prompt "Native gdb" prompt "Native gdb"
depends on ! BARE_METAL depends on ! BARE_METAL
depends on ! BACKEND
select EXPAT_TARGET select EXPAT_TARGET
select NCURSES_TARGET select NCURSES_TARGET
help help

View File

@ -1,7 +1,5 @@
# ltrace # ltrace
## depends on ! BACKEND
##
## select LIBELF_TARGET ## select LIBELF_TARGET
## ##
## help ltrace is a program that simply runs the specified command until it exits. ## help ltrace is a program that simply runs the specified command until it exits.

View File

@ -1,7 +1,5 @@
# strace # strace
## depends on ! BACKEND
choice choice
bool bool
prompt "strace version" prompt "strace version"

View File

@ -2,12 +2,9 @@
comment "Build behavior" comment "Build behavior"
comment "Build options hiden"
depends on BACKEND
config PARALLEL_JOBS config PARALLEL_JOBS
int int
prompt "Number of parallel jobs" if ! BACKEND prompt "Number of parallel jobs"
default 0 default 0
help help
Number of jobs make will be allowed to run concurently. Number of jobs make will be allowed to run concurently.
@ -20,7 +17,7 @@ config PARALLEL_JOBS
config LOAD config LOAD
string string
prompt "Maximum allowed load" if ! BACKEND prompt "Maximum allowed load"
default "" default ""
help help
Specifies that no new jobs should be started if there are others jobs Specifies that no new jobs should be started if there are others jobs
@ -33,7 +30,7 @@ config LOAD
config USE_PIPES config USE_PIPES
bool bool
prompt "Use -pipe" if ! BACKEND prompt "Use -pipe"
default y default y
help help
Use gcc's option -pipe to use pipes rather than temp files when building Use gcc's option -pipe to use pipes rather than temp files when building
@ -83,7 +80,6 @@ choice
bool bool
prompt "Shell to use as CONFIG_SHELL" prompt "Shell to use as CONFIG_SHELL"
default CONFIG_SHELL_BASH default CONFIG_SHELL_BASH
depends on ! BACKEND
config CONFIG_SHELL_SH config CONFIG_SHELL_SH
bool bool
@ -141,13 +137,10 @@ config CONFIG_SHELL_CUSTOM
endchoice 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 config CONFIG_SHELL_CUSTOM_PATH
string string
prompt "Path to custom shell" if ! BACKEND prompt "Path to custom shell"
depends on CONFIG_SHELL_CUSTOM || BACKEND depends on CONFIG_SHELL_CUSTOM
default "/bin/sh" default "/bin/sh"
# Ditto. # Ditto.
@ -157,4 +150,4 @@ config CONFIG_SHELL
default "/bin/sh" if CONFIG_SHELL_SH default "/bin/sh" if CONFIG_SHELL_SH
default "/bin/ash" if CONFIG_SHELL_ASH default "/bin/ash" if CONFIG_SHELL_ASH
default "${bash}" if CONFIG_SHELL_BASH 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

View File

@ -63,7 +63,6 @@ config ALLOW_BUILD_AS_ROOT_SURE
config DEBUG_CT config DEBUG_CT
bool bool
prompt "Debug crosstool-NG" prompt "Debug crosstool-NG"
depends on ! BACKEND
help help
Say 'y' here to get some options regarding debugging crosstool-NG. Say 'y' here to get some options regarding debugging crosstool-NG.

View File

@ -4,7 +4,7 @@ comment "Paths"
config LOCAL_TARBALLS_DIR config LOCAL_TARBALLS_DIR
string string
prompt "Local tarballs directory" if ! BACKEND prompt "Local tarballs directory"
default "${HOME}/src" default "${HOME}/src"
help help
If you have previously downloaded the tarballs, enter the PATH where If you have previously downloaded the tarballs, enter the PATH where
@ -12,8 +12,8 @@ config LOCAL_TARBALLS_DIR
config SAVE_TARBALLS config SAVE_TARBALLS
bool bool
prompt "Save new tarballs" if ! BACKEND prompt "Save new tarballs"
depends on LOCAL_TARBALLS_DIR != "" || BACKEND depends on LOCAL_TARBALLS_DIR != ""
default y default y
help help
If you say 'y' here, new downloaded tarballs will be saved in the If you say 'y' here, new downloaded tarballs will be saved in the
@ -21,7 +21,7 @@ config SAVE_TARBALLS
config WORK_DIR config WORK_DIR
string string
prompt "Working directory" if ! BACKEND prompt "Working directory"
default "${CT_TOP_DIR}/.build" default "${CT_TOP_DIR}/.build"
help help
Set this to the directory where all build actions will be done. Set this to the directory where all build actions will be done.
@ -46,7 +46,7 @@ config BUILD_TOP_DIR
config PREFIX_DIR config PREFIX_DIR
string string
prompt "Prefix directory" if ! BACKEND prompt "Prefix directory"
default "${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" default "${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"
help help
This is the path the toolchain will run from. This is the path the toolchain will run from.
@ -55,7 +55,6 @@ config RM_RF_PREFIX_DIR
bool bool
prompt "| Remove the prefix dir prior to building" prompt "| Remove the prefix dir prior to building"
default y default y
depends on !BACKEND
help help
If you say 'y' here, then PREFIX_DIR (above) will be eradicated If you say 'y' here, then PREFIX_DIR (above) will be eradicated
prior to the toolchain is built. prior to the toolchain is built.
@ -70,9 +69,6 @@ config RM_RF_PREFIX_DIR
damageable to remove that directory. In this case, you may want to damageable to remove that directory. In this case, you may want to
say 'n' here. say 'n' here.
Note that when acting as a backend, this option is not available, and
is forced to 'n'.
config REMOVE_DOCS config REMOVE_DOCS
bool bool
prompt "Remove documentation" prompt "Remove documentation"

View File

@ -22,7 +22,7 @@ config KERNEL
config KERNEL_VERSION config KERNEL_VERSION
string string
source "config.gen/kernel.in" source "config/gen/kernel.in"
comment "Common kernel options" 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 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). 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 endmenu

View File

@ -19,7 +19,7 @@ config LIBC_VERSION
So if you want to be able to re-build your toolchain later, you will So if you want to be able to re-build your toolchain later, you will
have to save your C library tarball by yourself. have to save your C library tarball by yourself.
source "config.gen/libc.in" source "config/gen/libc.in"
config LIBC_SUPPORT_THREADS_ANY config LIBC_SUPPORT_THREADS_ANY
bool bool
@ -123,7 +123,7 @@ config LIBC_XLDD
for the native ldd. Please see the help, by running it for the native ldd. Please see the help, by running it
with '--help' for more explanations. with '--help' for more explanations.
source "config.gen/libc.in.2" source "config/gen/libc.in.2"
endif # ! LIBC_none endif # ! LIBC_none

View File

@ -5,7 +5,7 @@ menu "Target options"
config ARCH config ARCH
string string
source "config.gen/arch.in" source "config/gen/arch.in"
config ARCH_SUFFIX config ARCH_SUFFIX
string string
@ -392,6 +392,6 @@ config ARCH_FLOAT
default "soft" if ARCH_FLOAT_SW default "soft" if ARCH_FLOAT_SW
default "softfp" if ARCH_FLOAT_SOFTFP default "softfp" if ARCH_FLOAT_SOFTFP
source "config.gen/arch.in.2" source "config/gen/arch.in.2"
endmenu endmenu

View File

@ -20,7 +20,7 @@ config USE_SYSROOT
config SYSROOT_NAME config SYSROOT_NAME
string string
prompt "sysroot directory name" if ! BACKEND prompt "sysroot directory name"
depends on USE_SYSROOT depends on USE_SYSROOT
default "sysroot" default "sysroot"
help help
@ -33,7 +33,7 @@ config SYSROOT_NAME
config SYSROOT_DIR_PREFIX config SYSROOT_DIR_PREFIX
string string
prompt "sysroot prefix dir (READ HELP)" if ! BACKEND prompt "sysroot prefix dir (READ HELP)"
depends on USE_SYSROOT depends on USE_SYSROOT
default "" default ""
help help

View File

@ -65,10 +65,9 @@ AC_DEFUN(
AC_DEFUN( AC_DEFUN(
[ACX_SET_KCONFIG_OPTION], [ACX_SET_KCONFIG_OPTION],
[AS_IF( [AS_IF(
[test -n "$$1"], [test -n "$$1"],
[kconfig_options="$kconfig_options has_$1=y"], [AC_SUBST([KCONFIG_$1], ["def_bool y"])],
[kconfig_options="$kconfig_options has_$1"]) [AC_SUBST([KCONFIG_$1], ["bool"])])])
])
# Check if a given program is available with a particular version. # Check if a given program is available with a particular version.
# ACX_PROG_VERSION(VAR, HELP, PROG, SRCH, VERSION_CHECK[, CONFIG_OPT]) # ACX_PROG_VERSION(VAR, HELP, PROG, SRCH, VERSION_CHECK[, CONFIG_OPT])
@ -466,5 +465,5 @@ AS_IF(
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Finally, generate the output file(s) # Finally, generate the output file(s)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Makefile config/configure.in])
AC_OUTPUT AC_OUTPUT

View File

@ -111,7 +111,6 @@ help-clean::
@echo ' clean - Remove generated files' @echo ' clean - Remove generated files'
@echo ' distclean - Remove generated files, configuration and build directories' @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)/kconfig/kconfig.mk
include $(CT_LIB_DIR)/steps.mk include $(CT_LIB_DIR)/steps.mk
include $(CT_LIB_DIR)/samples/samples.mk include $(CT_LIB_DIR)/samples/samples.mk

View File

@ -2,7 +2,12 @@
# Hmmm! Cheesy build! # Hmmm! Cheesy build!
# Or: where I can unveil my make-fu... :-] # 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... @true # Just be silent, you fscking son of a fscking beach...
# Build flags # Build flags
@ -64,8 +69,7 @@ DEPS += $(nconf_DEP)
# Build the dependency for C files # Build the dependency for C files
%.dep: %.c %.dep: %.c
@echo " DEP '$@'" $(call __silent,DEP,$@)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@
# Generate the grammar parser # Generate the grammar parser
zconf.tab.o: zconf.tab.c zconf.hash.c zconf.lex.c 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 .PRECIOUS: zconf.tab.c
zconf.tab.c: zconf.y zconf.tab.c: zconf.y
@echo " BISON '$@'" $(call __silent,BISON)bison -l -b zconf -p zconf $<
@bison -l -b zconf -p zconf $<
zconf.hash.c: zconf.gperf zconf.hash.c: zconf.gperf
@echo " GPERF '$@'" $(call __silent,GPERF)$(gperf) -C < $< > $@
@$(gperf) -C < $< > $@
zconf.lex.c: zconf.l zconf.lex.c: zconf.l
@echo " LEX '$@'" $(call __silent,LEX)flex -L -Pzconf -o$@ $<
@flex -L -Pzconf -o$@ $<
# Build C files # Build C files
%.o: %.c %.o: %.c
@echo " CC '$@'" $(call __silent,CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
# Actual link # Actual link
mconf: $(COMMON_OBJ) $(LX_OBJ) $(mconf_OBJ) mconf: $(COMMON_OBJ) $(LX_OBJ) $(mconf_OBJ)
@echo " LD '$@'" $(call __silent,LD,$@)$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
@$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
nconf: $(COMMON_OBJ) $(nconf_OBJ) nconf: $(COMMON_OBJ) $(nconf_OBJ)
@echo " LD '$@'" $(call __silent,LD,$@)$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
@$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
conf: $(COMMON_OBJ) $(conf_OBJ) conf: $(COMMON_OBJ) $(conf_OBJ)
@echo " LD '$@'" $(call __silent,LD,$@)$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
@$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
#-----------------------------------------------------------
# Installation
install: $(patsubst %,install-%,$(PROGS)) install-kconfig.mk
install-%: %
$(call __silent,INSTALL,$<)install $< $(DESTDIR)/$<
#----------------------------------------------------------- #-----------------------------------------------------------
# Cleaning up the mess... # Cleaning up the mess...
clean: clean:
@echo " RM 'kconfig'" $(call __silent,RM,objs)rm -f $(ALL_OBJS) $(ALL_DEPS)
@rm -f conf mconf nconf $(ALL_OBJS) $(ALL_DEPS) $(call __silent_rm,$(PROGS))
@rm -f rm -f zconf.tab.c zconf.hash.c zconf.lex.c lex.backup $(call __silent_rm,zconf.tab.c zconf.hash.c zconf.lex.c lex.backup)

View File

@ -5,31 +5,27 @@
#----------------------------------------------------------- #-----------------------------------------------------------
# The configurators rules # The configurators rules
configurators = menuconfig nconfig oldconfig savedefconfig defconfig # Top file of crosstool-NG configuration
PHONY += $(configurators) export KCONFIG_TOP = $(CT_LIB_DIR)/config/config.in
$(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)
# We need CONF for savedefconfig in scripts/saveSample.sh # We need CONF for savedefconfig in scripts/saveSample.sh
export CONF := $(CT_LIB_DIR)/kconfig/conf export CONF := $(CT_LIB_DIR)/kconfig/conf
MCONF := $(CT_LIB_DIR)/kconfig/mconf MCONF := $(CT_LIB_DIR)/kconfig/mconf
NCONF := $(CT_LIB_DIR)/kconfig/nconf NCONF := $(CT_LIB_DIR)/kconfig/nconf
# Used by conf/mconf/nconf to find the .in files
export srctree=$(CT_LIB_DIR)
menuconfig: menuconfig:
@$(CT_ECHO) " CONF $(KCONFIG_TOP)" @$(CT_ECHO) " CONF $@"
$(SILENT)$(MCONF) $(KCONFIG_TOP) $(SILENT)$(MCONF) $(KCONFIG_TOP)
nconfig: nconfig:
@$(CT_ECHO) " CONF $(KCONFIG_TOP)" @$(CT_ECHO) " CONF $@"
$(SILENT)$(NCONF) $(KCONFIG_TOP) $(SILENT)$(NCONF) $(KCONFIG_TOP)
oldconfig: .config oldconfig: .config
@$(CT_ECHO) " CONF $(KCONFIG_TOP)" @$(CT_ECHO) " CONF $@"
$(SILENT)$(CONF) --silent$@ $(KCONFIG_TOP) $(SILENT)$(CONF) --silent$@ $(KCONFIG_TOP)
savedefconfig: .config savedefconfig: .config

View File

@ -1,15 +1,19 @@
#!/bin/sh #!/bin/bash
set -e set -e
# This scripts generates either a choice or a menuconfig # Accept overrides from command line if needed
# with the specified entries. sed=${SED:-sed}
grep=${GREP:-grep}
# Generate either a choice or a menuconfig with the specified entries.
# #
# Usage: # Usage:
# generate a choice: # 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: # 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: # where:
# out-file # out-file
@ -29,19 +33,17 @@ set -e
# base directory containing config files # base directory containing config files
# eg. config/arch, config/kernel... # eg. config/arch, config/kernel...
# #
# conditionals (valid only for choice)
# generate backend conditionals if Y/y, don't if anything else # Helper: find the base names of all *.in files in a given directory
# if 'Y' (or 'y'), a dependency on the backen mode will be added get_components() {
# to each entry local dir="${1}"
# local f b
# entry [entry...]
# a list of entry/ies toadd to the choice/menuconfig for f in ${dir}/*.in; do
# eg.: b=${f#${dir}/}
# arm mips sh x86... echo ${b%.in}
# linux cygwin mingw32 solaris... done
# ... }
#
#------------------------------------------------------------------------------
# Generate a choice # Generate a choice
# See above for usage # See above for usage
@ -50,8 +52,6 @@ gen_choice() {
local label="${2}" local label="${2}"
local cfg_prefix="${3}" local cfg_prefix="${3}"
local base_dir="${4}" local base_dir="${4}"
local cond="${5}"
shift 5
local file entry _entry local file entry _entry
# Generate the part-1 # Generate the part-1
@ -63,15 +63,12 @@ gen_choice() {
printf ' bool\n' printf ' bool\n'
printf ' prompt "%s"\n' "${label}" printf ' prompt "%s"\n' "${label}"
printf '\n' printf '\n'
for entry in "${@}"; do for entry in `get_components ${base_dir}`; do
file="${base_dir}/${entry}.in" file="${base_dir}/${entry}.in"
_entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
printf 'config %s_%s\n' "${cfg_prefix}" "${_entry}" printf 'config %s_%s\n' "${cfg_prefix}" "${_entry}"
printf ' bool\n' printf ' bool\n'
printf ' prompt "%s"\n' "${entry}" 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 '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null
"${sed}" -r -e '/^## select /!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 if "${grep}" -E '^## help' ${file} >/dev/null 2>&1; then
@ -82,21 +79,19 @@ gen_choice() {
done done
printf 'endchoice\n' 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" file="${base_dir}/${entry}.in"
_entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') _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}" 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 'source "%s"\n' "${file}"
printf 'endif\n' printf 'endif\n'
done done
@ -105,7 +100,7 @@ gen_choice() {
exec >"${out_file}.2" exec >"${out_file}.2"
printf '# %s second part options\n' "${label}" printf '# %s second part options\n' "${label}"
printf '# Generated file, do not edit!!!\n' printf '# Generated file, do not edit!!!\n'
for entry in "${@}"; do for entry in `get_components ${base_dir}`; do
file="${base_dir}/${entry}.in" file="${base_dir}/${entry}.in"
_entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
if [ -f "${file}.2" ]; then if [ -f "${file}.2" ]; then
@ -125,7 +120,6 @@ gen_menu() {
local label="${2}" local label="${2}"
local cfg_prefix="${3}" local cfg_prefix="${3}"
local base_dir="${4}" local base_dir="${4}"
shift 4
local file entry _entry local file entry _entry
# Generate the menuconfig # Generate the menuconfig
@ -133,7 +127,7 @@ gen_menu() {
printf '# %s menu\n' "${label}" printf '# %s menu\n' "${label}"
printf '# Generated file, do not edit!!!\n' printf '# Generated file, do not edit!!!\n'
printf '\n' printf '\n'
for entry in "${@}"; do for entry in `get_components ${base_dir}`; do
file="${base_dir}/${entry}.in" file="${base_dir}/${entry}.in"
_entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
printf 'menuconfig %s_%s\n' "${cfg_prefix}" "${_entry}" printf 'menuconfig %s_%s\n' "${cfg_prefix}" "${_entry}"
@ -156,6 +150,11 @@ gen_menu() {
done done
} }
type="${1}" mkdir -p config/gen
shift gen_choice config/gen/arch.in "Target Architecture" "ARCH" "config/arch"
"gen_${type}" "${@}" 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"

View File

@ -48,7 +48,7 @@ show-config: .config
# Prints the details of a sample # Prints the details of a sample
PHONY += $(patsubst %,show-%,$(CT_SAMPLES)) PHONY += $(patsubst %,show-%,$(CT_SAMPLES))
$(patsubst %,show-%,$(CT_SAMPLES)): show-%: config_files $(patsubst %,show-%,$(CT_SAMPLES)): show-%:
@KCONFIG_CONFIG=$$(pwd)/.config.sample \ @KCONFIG_CONFIG=$$(pwd)/.config.sample \
$(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \ $(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \
$(KCONFIG_TOP) >/dev/null $(KCONFIG_TOP) >/dev/null
@ -72,7 +72,7 @@ list-samples-pre: FORCE
@echo 'Status Sample name' @echo 'Status Sample name'
PHONY += $(patsubst %,list-%,$(CT_SAMPLES)) PHONY += $(patsubst %,list-%,$(CT_SAMPLES))
$(patsubst %,list-%,$(CT_SAMPLES)): list-%: config_files $(patsubst %,list-%,$(CT_SAMPLES)): list-%:
@KCONFIG_CONFIG=$$(pwd)/.config.sample \ @KCONFIG_CONFIG=$$(pwd)/.config.sample \
$(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \ $(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \
$(KCONFIG_TOP) >/dev/null $(KCONFIG_TOP) >/dev/null
@ -87,7 +87,7 @@ list-samples-short: FORCE
# Check one sample # Check one sample
PHONY += $(patsubst %,check-%,$(CT_SAMPLES)) PHONY += $(patsubst %,check-%,$(CT_SAMPLES))
$(patsubst %,check-%,$(CT_SAMPLES)): check-%: config_files $(patsubst %,check-%,$(CT_SAMPLES)): check-%:
@export KCONFIG_CONFIG=$$(pwd)/.config.sample; \ @export KCONFIG_CONFIG=$$(pwd)/.config.sample; \
CT_NG_SAMPLE=$(call sample_dir,$*)/crosstool.config; \ CT_NG_SAMPLE=$(call sample_dir,$*)/crosstool.config; \
$(CONF) -s --defconfig=$${CT_NG_SAMPLE} $(KCONFIG_TOP) &>/dev/null; \ $(CONF) -s --defconfig=$${CT_NG_SAMPLE} $(KCONFIG_TOP) &>/dev/null; \
@ -119,7 +119,7 @@ wiki-samples-pre: FORCE
wiki-samples-post: FORCE wiki-samples-post: FORCE
$(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -W $(CT_SAMPLES) $(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 \ $(SILENT)KCONFIG_CONFIG=$$(pwd)/.config.sample \
$(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \ $(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \
$(KCONFIG_TOP) >/dev/null $(KCONFIG_TOP) >/dev/null
@ -146,8 +146,8 @@ endef
# How we do recall one sample # How we do recall one sample
PHONY += $(CT_SAMPLES) PHONY += $(CT_SAMPLES)
$(CT_SAMPLES): config_files $(CT_SAMPLES):
@$(CT_ECHO) " CONF $(KCONFIG_TOP)" @$(CT_ECHO) " CONF $@"
$(SILENT)$(CONF) --defconfig=$(call sample_dir,$@)/crosstool.config $(KCONFIG_TOP) $(SILENT)$(CONF) --defconfig=$(call sample_dir,$@)/crosstool.config $(KCONFIG_TOP)
@echo @echo
@echo '***********************************************************' @echo '***********************************************************'
@ -225,7 +225,7 @@ endif # MAKECMDGOALS contains a build sample rule
endif # MAKECMDGOALS != "" endif # MAKECMDGOALS != ""
# Build a single sample # Build a single sample
$(patsubst %,build-%,$(CT_SAMPLES)): build-%: config_files $(patsubst %,build-%,$(CT_SAMPLES)): build-%:
$(call build_sample,$*) $(call build_sample,$*)
# Cross samples (build==host) # Cross samples (build==host)

View File

@ -86,7 +86,7 @@ fi
# Now, actually save the defconfig # Now, actually save the defconfig
export KCONFIG_CONFIG="$(pwd)/.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 rm -f .defconfig
# Fill-in the reported-by info # Fill-in the reported-by info