mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-20 05:17:54 +00:00
commit
85f98147f5
2
.gitignore
vendored
2
.gitignore
vendored
@ -22,3 +22,5 @@ build.log
|
||||
.build/
|
||||
# .. and the legacy location
|
||||
targets/
|
||||
# .. and log for 'build-all'
|
||||
.build-all
|
||||
|
@ -50,12 +50,12 @@ config_files: $(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
|
||||
|
||||
# Where to access to the source config files from
|
||||
config:
|
||||
@$(ECHO) " LN config"
|
||||
@$(CT_ECHO) " LN config"
|
||||
$(SILENT)ln -s $(CT_LIB_DIR)/config config
|
||||
|
||||
# Where to store the generated config files into
|
||||
config.gen:
|
||||
@$(ECHO) " MKDIR config.gen"
|
||||
@$(CT_ECHO) " MKDIR config.gen"
|
||||
$(SILENT)mkdir -p config.gen
|
||||
|
||||
#-----------------------------------------------------------
|
||||
@ -74,34 +74,34 @@ DEBUGS = $(patsubst config/debug/%.in,%,$(DEBUG_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)
|
||||
@$(ECHO) ' IN $(@)'
|
||||
@$(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)
|
||||
@$(ECHO) ' IN $(@)'
|
||||
@$(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)
|
||||
@$(ECHO) ' IN $(@)'
|
||||
@$(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)
|
||||
@$(ECHO) ' IN $(@)'
|
||||
@$(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)
|
||||
@$(ECHO) ' IN $(@)'
|
||||
@$(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)
|
||||
@$(ECHO) ' IN $(@)'
|
||||
@$(CT_ECHO) ' IN $(@)'
|
||||
$(SILENT)$(CT_LIB_DIR)/scripts/gen_in_frags.sh menu "$@" "Debug facilities" "DEBUG" "config/debug" $(DEBUGS)
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# Cleaning up the mess...
|
||||
|
||||
clean::
|
||||
@$(ECHO) " CLEAN config"
|
||||
@$(CT_ECHO) " CLEAN config"
|
||||
$(SILENT)rm -f config 2>/dev/null || true
|
||||
@$(ECHO) " CLEAN config.gen"
|
||||
@$(CT_ECHO) " CLEAN config.gen"
|
||||
$(SILENT)rm -rf config.gen
|
||||
|
21
ct-ng.in
21
ct-ng.in
@ -41,24 +41,24 @@ export CT_STOP:=$(STOP)
|
||||
export CT_RESTART:=$(RESTART)
|
||||
|
||||
SILENT=@
|
||||
ECHO=echo
|
||||
CT_ECHO=echo
|
||||
ifeq ($(strip $(origin V)),command line)
|
||||
ifeq ($(strip $(V)),0)
|
||||
SILENT=@
|
||||
ECHO=:
|
||||
CT_ECHO=:
|
||||
else
|
||||
ifeq ($(strip $(V)),1)
|
||||
SILENT=
|
||||
ECHO=:
|
||||
CT_ECHO=:
|
||||
else
|
||||
ifeq ($(strip $(V)),2)
|
||||
SILENT=
|
||||
ECHO=echo
|
||||
CT_ECHO=echo
|
||||
endif # V == 2
|
||||
endif # V== 1
|
||||
endif # V == 0
|
||||
endif # origin V
|
||||
export V SILENT ECHO
|
||||
export V SILENT CT_ECHO
|
||||
|
||||
all: help
|
||||
|
||||
@ -123,7 +123,8 @@ help-config::
|
||||
help-distrib::
|
||||
|
||||
help-env::
|
||||
@echo ' V=0|1|2 - 0 => show only human-readable messages (default)'
|
||||
@echo ' V=0|1|2|<unset> - <unset> show only human-readable messages (default)'
|
||||
@echo ' 0 => do not show commands or human-readable message'
|
||||
@echo ' 1 => show only the commands being executed'
|
||||
@echo ' 2 => show both'
|
||||
|
||||
@ -165,14 +166,14 @@ version:
|
||||
|
||||
PHONY += clean
|
||||
clean::
|
||||
@$(ECHO) " CLEAN log"
|
||||
@$(CT_ECHO) " CLEAN log"
|
||||
$(SILENT)rm -f build.log
|
||||
@$(ECHO) " CLEAN build dir"
|
||||
@$(CT_ECHO) " CLEAN build dir"
|
||||
$(SILENT)[ ! -d targets ] || chmod -R u+w targets
|
||||
$(SILENT)[ ! -d .build ] || chmod -R u+w .build
|
||||
$(SILENT)rm -rf targets .build
|
||||
$(SILENT)rm -rf targets .build .build-all
|
||||
|
||||
PHONY += distclean
|
||||
distclean:: clean
|
||||
@$(ECHO) " CLEAN .config"
|
||||
@$(CT_ECHO) " CLEAN .config"
|
||||
$(SILENT)rm -f .config .config.* ..config*
|
||||
|
@ -21,23 +21,23 @@ MCONF := $(CT_LIB_DIR)/kconfig/mconf
|
||||
NCONF := $(CT_LIB_DIR)/kconfig/nconf
|
||||
|
||||
menuconfig:
|
||||
@$(ECHO) " CONF $(KCONFIG_TOP)"
|
||||
@$(CT_ECHO) " CONF $(KCONFIG_TOP)"
|
||||
$(SILENT)$(MCONF) $(KCONFIG_TOP)
|
||||
|
||||
nconfig:
|
||||
@$(ECHO) " CONF $(KCONFIG_TOP)"
|
||||
@$(CT_ECHO) " CONF $(KCONFIG_TOP)"
|
||||
$(SILENT)$(NCONF) $(KCONFIG_TOP)
|
||||
|
||||
oldconfig: .config
|
||||
@$(ECHO) " CONF $(KCONFIG_TOP)"
|
||||
@$(CT_ECHO) " CONF $(KCONFIG_TOP)"
|
||||
$(SILENT)$(CONF) --silent$@ $(KCONFIG_TOP)
|
||||
|
||||
savedefconfig: .config
|
||||
@$(ECHO) ' GEN $@'
|
||||
@$(CT_ECHO) ' GEN $@'
|
||||
$(SILENT)$(CONF) --savedefconfig=$${DEFCONFIG-defconfig} $(KCONFIG_TOP)
|
||||
|
||||
defconfig:
|
||||
@$(ECHO) ' CONF $@'
|
||||
@$(CT_ECHO) ' CONF $@'
|
||||
$(SILENT)$(CONF) --defconfig=$${DEFCONFIG-defconfig} $(KCONFIG_TOP)
|
||||
|
||||
# Always be silent, the stdout an be >.config
|
||||
|
@ -117,7 +117,7 @@ $(patsubst %,wiki-%,$(CT_SAMPLES)): config_files
|
||||
|
||||
PHONY += samples
|
||||
samples:
|
||||
@$(ECHO) ' MKDIR $@'
|
||||
@$(CT_ECHO) ' MKDIR $@'
|
||||
$(SILENT)mkdir -p $@
|
||||
|
||||
# Save a sample
|
||||
@ -133,7 +133,7 @@ endef
|
||||
# How we do recall one sample
|
||||
PHONY += $(CT_SAMPLES)
|
||||
$(CT_SAMPLES): config_files
|
||||
@$(ECHO) " CONF $(KCONFIG_TOP)"
|
||||
@$(CT_ECHO) " CONF $(KCONFIG_TOP)"
|
||||
$(SILENT)$(CONF) --defconfig=$(call sample_dir,$@)/crosstool.config $(KCONFIG_TOP)
|
||||
@echo
|
||||
@echo '***********************************************************'
|
||||
@ -164,21 +164,41 @@ $(CT_SAMPLES): config_files
|
||||
# ----------------------------------------------------------
|
||||
# Some helper functions
|
||||
|
||||
# Construct a CT_PREFIX_DIR path from the sample name. Sample names use
|
||||
# comma as a separator between host and target triplets in canadian cross
|
||||
# configurations, but ct-ng does not allow commas in the path. Substitute
|
||||
# with = (equal sign).
|
||||
# $1: sample
|
||||
__comma = ,
|
||||
prefix_dir = $(CT_PREFIX)/$(subst $(__comma),=,$(1))
|
||||
host_triplet = $(if $(findstring $(__comma),$(1)),$(firstword $(subst $(__comma), ,$(1))))
|
||||
|
||||
# Create the rule to build a sample
|
||||
# $1: sample tuple
|
||||
# $2: prefix
|
||||
# $1: sample name (target tuple, or host/target tuples separated by a comma)
|
||||
define build_sample
|
||||
@$(ECHO) ' CONF $(1)'
|
||||
$(SILENT)cp $(call sample_dir,$(1))/crosstool.config .config
|
||||
$(SILENT)$(sed) -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$(2)":;' .config
|
||||
@$(CT_ECHO) ' CONF $(1)'
|
||||
$(SILENT)$(CONF) -s --defconfig=$(call sample_dir,$(1))/crosstool.config $(KCONFIG_TOP)
|
||||
$(SILENT)$(sed) -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$(call prefix_dir,$(1))":;' .config
|
||||
$(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config
|
||||
$(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config
|
||||
$(SILENT)$(sed) -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config
|
||||
$(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config
|
||||
$(SILENT)$(sed) -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config
|
||||
$(SILENT)$(MAKE) -rf $(CT_NG) V=0 oldconfig
|
||||
@$(ECHO) ' BUILD $(1)'
|
||||
$(SILENT)$(MAKE) -rf $(CT_NG) V=0 build
|
||||
$(SILENT)$(CONF) -s --oldconfig $(KCONFIG_TOP)
|
||||
@$(CT_ECHO) ' BUILD $(1)'
|
||||
$(SILENT)if [ ! -z "$(call host_triplet,$(1))" -a -d "$(call prefix_dir,$(call host_triplet,$(1)))" ]; then \
|
||||
PATH="$$PATH:$(call prefix_dir,$(call host_triplet,$(1)))/bin"; \
|
||||
fi; \
|
||||
if $(MAKE) -rf $(CT_NG) V=0 build; then \
|
||||
status=PASS; \
|
||||
elif [ -e $(call sample_dir,$(1))/broken ]; then \
|
||||
status=XFAIL; \
|
||||
else \
|
||||
status=FAIL; \
|
||||
fi; \
|
||||
printf '\r %-5s %s\n' $$status '$(1)'; \
|
||||
mkdir -p .build-all/$$status/$(1); \
|
||||
bzip2 < build.log > .build-all/$$status/$(1)/build.log.bz2
|
||||
endef
|
||||
|
||||
# ----------------------------------------------------------
|
||||
@ -196,11 +216,37 @@ endif # MAKECMDGOALS contains a build sample rule
|
||||
endif # MAKECMDGOALS != ""
|
||||
|
||||
# Build a single sample
|
||||
$(patsubst %,build-%,$(CT_SAMPLES)):
|
||||
$(call build_sample,$(patsubst build-%,%,$@),$(CT_PREFIX)/$(patsubst build-%,%,$@))
|
||||
$(patsubst %,build-%,$(CT_SAMPLES)): build-%: config_files
|
||||
$(call build_sample,$*)
|
||||
|
||||
# Build al samples
|
||||
build-all: $(patsubst %,build-%,$(CT_SAMPLES))
|
||||
# Cross samples (build==host)
|
||||
CT_SAMPLES_CROSS = $(strip $(foreach s,$(CT_SAMPLES),$(if $(findstring $(__comma),$(s)),, $(s))))
|
||||
# Canadian cross (build!=host)
|
||||
CT_SAMPLES_CANADIAN = $(strip $(foreach s,$(CT_SAMPLES),$(if $(findstring $(__comma),$(s)), $(s),)))
|
||||
|
||||
# Build all samples; first, build simple cross as canadian configurations may depend on
|
||||
# build-to-host cross being pre-built.
|
||||
build-all: build-all-pre $(patsubst %,build-%,$(CT_SAMPLES_CROSS) $(CT_SAMPLES_CANADIAN))
|
||||
@echo
|
||||
@if [ -d .build-all/PASS ]; then \
|
||||
echo 'Success:'; \
|
||||
(cd .build-all/PASS && ls | sed 's/^/ - /'); \
|
||||
echo; \
|
||||
fi
|
||||
@if [ -d .build-all/XFAIL ]; then \
|
||||
echo 'Expected failure:'; \
|
||||
(cd .build-all/XFAIL && ls | sed 's/^/ - /'); \
|
||||
echo; \
|
||||
fi
|
||||
@if [ -d .build-all/FAIL ]; then \
|
||||
echo 'Failure:'; \
|
||||
(cd .build-all/FAIL && ls | sed 's/^/ - /'); \
|
||||
echo; \
|
||||
fi
|
||||
@[ ! -d .build-all/FAIL ]
|
||||
|
||||
build-all-pre:
|
||||
@rm -rf .build-all
|
||||
|
||||
# Build all samples, overiding the number of // jobs per sample
|
||||
build-all.%:
|
||||
|
@ -14,7 +14,7 @@ CT_OnError() {
|
||||
# To avoid printing the backtace for each sub-shell
|
||||
# up to the top-level, just remember we've dumped it
|
||||
if [ ! -f "${CT_WORK_DIR}/backtrace" ]; then
|
||||
touch "${CT_WORK_DIR}/backtrace"
|
||||
[ -d "${CT_WORK_DIR}" ] && touch "${CT_WORK_DIR}/backtrace"
|
||||
|
||||
# Print steps backtrace
|
||||
step_depth=${CT_STEP_COUNT}
|
||||
@ -178,7 +178,7 @@ CT_DoLog() {
|
||||
if [ $# -eq 0 ]; then
|
||||
cat -
|
||||
else
|
||||
printf "%s\n" "${*}"
|
||||
echo -e "${*}"
|
||||
fi |( IFS="${CR}" # We want the full lines, even leading spaces
|
||||
_prog_bar_cpt=0
|
||||
_prog_bar[0]='/'
|
||||
|
@ -33,16 +33,16 @@ endif
|
||||
|
||||
PHONY += scripts
|
||||
scripts:
|
||||
@$(ECHO) ' MKDIR $@'
|
||||
@$(CT_ECHO) ' MKDIR $@'
|
||||
$(SILENT)mkdir -p $@
|
||||
|
||||
$(CONFIG_SUB_DEST): scripts FORCE
|
||||
@$(ECHO) ' WGET $@'
|
||||
@$(CT_ECHO) ' WGET $@'
|
||||
$(SILENT)wget $(wget_opt) -O $@ $(CONFIG_SUB_SRC)
|
||||
$(SILENT)chmod u+rwx,go+rx-w $@
|
||||
|
||||
$(CONFIG_GUESS_DEST): scripts FORCE
|
||||
@$(ECHO) ' WGET $@'
|
||||
@$(CT_ECHO) ' WGET $@'
|
||||
$(SILENT)wget $(wget_opt) -O $@ $(CONFIG_GUESS_SRC)
|
||||
$(SILENT)chmod u+rwx,go+rx-w $@
|
||||
|
||||
@ -50,5 +50,5 @@ $(CONFIG_GUESS_DEST): scripts FORCE
|
||||
# Clean up the mess
|
||||
|
||||
distclean::
|
||||
@$(ECHO) " CLEAN scripts"
|
||||
@$(CT_ECHO) " CLEAN scripts"
|
||||
$(SILENT)[ $(CT_TOP_DIR) = $(CT_LIB_DIR) ] || rm -rf $(CT_TOP_DIR)/scripts
|
||||
|
@ -23,10 +23,16 @@ dump_single_sample() {
|
||||
[ "$1" = "-v" ] && verbose=1 && shift
|
||||
[ "$1" = "-w" ] && wiki=1 && shift
|
||||
local sample="$1"
|
||||
. $(pwd)/.config.sample
|
||||
case "${sample}" in
|
||||
current)
|
||||
sample_type="l"
|
||||
sample="$( ${CT_NG} show-tuple )"
|
||||
case "${CT_TOOLCHAIN_TYPE}" in
|
||||
canadian)
|
||||
sample="${CT_HOST},$sample"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*) if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
|
||||
sample_top="${CT_TOP_DIR}"
|
||||
@ -37,7 +43,6 @@ dump_single_sample() {
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
. $(pwd)/.config.sample
|
||||
if [ ${wiki} -eq 0 ]; then
|
||||
width=14
|
||||
printf "[%s" "${sample_type}"
|
||||
|
Loading…
Reference in New Issue
Block a user