2007-06-17 11:13:48 +00:00
|
|
|
# Makefile to manage samples
|
2007-05-07 09:04:02 +00:00
|
|
|
|
2008-10-27 18:42:26 +00:00
|
|
|
# ----------------------------------------------------------
|
2007-06-17 11:13:48 +00:00
|
|
|
# Build the list of available samples
|
2007-07-01 19:04:20 +00:00
|
|
|
CT_TOP_SAMPLES := $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config))
|
|
|
|
CT_LIB_SAMPLES := $(filter-out $(CT_TOP_SAMPLES),$(patsubst $(CT_LIB_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_LIB_DIR)/samples/*/crosstool.config)))
|
2008-06-23 08:07:14 +00:00
|
|
|
CT_SAMPLES := $(sort $(CT_TOP_SAMPLES) $(CT_LIB_SAMPLES))
|
2007-05-07 09:04:02 +00:00
|
|
|
|
2008-10-27 18:42:26 +00:00
|
|
|
# ----------------------------------------------------------
|
|
|
|
# This part deals with the samples help entries
|
|
|
|
|
2007-06-17 16:24:23 +00:00
|
|
|
help-config::
|
2007-08-15 14:59:37 +00:00
|
|
|
@echo ' saveconfig - Save current config as a preconfigured target'
|
2007-06-17 16:24:23 +00:00
|
|
|
|
|
|
|
help-samples::
|
2008-06-01 21:12:00 +00:00
|
|
|
@echo ' list-samples - prints the list of all samples (for scripting)'
|
|
|
|
@echo ' show-<sample> - show a brief overview of <sample> (list below)'
|
|
|
|
@echo ' <sample> - preconfigure crosstool-NG with <sample> (list below)'
|
2008-10-31 18:31:01 +00:00
|
|
|
@echo ' build-all[.#] - Build *all* samples (list below) and install in'
|
|
|
|
@echo ' $${CT_PREFIX} (which you must set)'
|
|
|
|
@echo ' Available samples:'
|
2007-07-01 19:04:20 +00:00
|
|
|
@$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
|
2007-06-17 16:24:23 +00:00
|
|
|
|
2008-06-15 19:25:51 +00:00
|
|
|
help-distrib::
|
|
|
|
@echo ' wiki-samples - Print a DokuWiki table of samples'
|
|
|
|
|
2008-10-31 18:31:01 +00:00
|
|
|
help-env::
|
|
|
|
@echo ' CT_PREFIX - directory in which to auto-install samples'
|
|
|
|
@echo ' (see action "build-all", above).'
|
|
|
|
|
2008-10-27 18:42:26 +00:00
|
|
|
# ----------------------------------------------------------
|
|
|
|
# This part deals with printing samples information
|
|
|
|
|
|
|
|
# Prints the details of a sample
|
|
|
|
PHONY += $(patsubst %,show-%,$(CT_SAMPLES))
|
2008-05-26 21:49:36 +00:00
|
|
|
$(patsubst %,show-%,$(CT_SAMPLES)):
|
|
|
|
@$(CT_LIB_DIR)/scripts/showSamples.sh -v $(patsubst show-%,%,$(@))
|
|
|
|
|
2008-10-27 18:42:26 +00:00
|
|
|
# print the list of all available samples
|
2008-06-01 21:12:00 +00:00
|
|
|
PHONY += list-samples
|
|
|
|
list-samples: .FORCE
|
2008-05-26 21:49:36 +00:00
|
|
|
@echo $(CT_SAMPLES) |sed -r -e 's/ /\n/g;' |sort
|
2008-05-02 21:49:43 +00:00
|
|
|
|
2008-10-27 18:42:26 +00:00
|
|
|
wiki-samples:
|
|
|
|
$(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -w $(CT_SAMPLES)
|
|
|
|
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
# This part deals with saving/restoring samples
|
|
|
|
|
|
|
|
# Save a sample
|
|
|
|
saveconfig:
|
|
|
|
$(SILENT)$(CT_LIB_DIR)/scripts/saveSample.sh
|
|
|
|
|
|
|
|
# The 'sample_dir' function prints the directory in which the sample is,
|
|
|
|
# searching first in local samples, then in global samples
|
|
|
|
define sample_dir
|
|
|
|
$$( [ -d $(CT_TOP_DIR)/samples/$(1) ] && echo "$(CT_TOP_DIR)/samples/$(1)" || echo "$(CT_LIB_DIR)/samples/$(1)")
|
|
|
|
endef
|
|
|
|
|
2008-10-14 19:40:12 +00:00
|
|
|
# How we do recall one sample
|
2007-07-01 19:04:20 +00:00
|
|
|
PHONY += $(CT_SAMPLES)
|
2007-06-17 11:13:48 +00:00
|
|
|
$(CT_SAMPLES):
|
Cheesy kconfig stuff:
- silent/quiet/verbose build:
- ct-ng by default only prints quit messages, such as "CC xxx",
- if using V=0, nothing is printed,
- if using V=1, the full command lines are printed,
- other values are indeterminate,
- should help in debugging the kconfig stuff;
- complete kconfig/{,m}conf generation:
- fully dynamic dependencies on source files,
- compilation of .c into .o, then linking (instead of direct linking),
- VPATH usage when not --local;
Typo + a coment moved.
/trunk/kconfig/kconfig.mk | 140 87 53 0 +++++++++++++++++++++++++++++++++--------------------
/trunk/tools/tools.mk | 12 6 6 0 ++--
/trunk/steps.mk | 6 3 3 0 +-
/trunk/samples/samples.mk | 30 15 15 0 +++++-----
/trunk/ct-ng.in | 40 28 12 0 +++++++++++----
5 files changed, 139 insertions(+), 89 deletions(-)
2008-10-15 21:29:56 +00:00
|
|
|
$(SILENT)cp $(call sample_dir,$@)/crosstool.config .config
|
2008-10-31 18:31:01 +00:00
|
|
|
$(SILENT)$(MAKE) -rf $(CT_NG) V=$(V) oldconfig
|
2008-10-14 21:30:27 +00:00
|
|
|
@echo
|
|
|
|
@echo '***********************************************************'
|
|
|
|
@echo
|
Cheesy kconfig stuff:
- silent/quiet/verbose build:
- ct-ng by default only prints quit messages, such as "CC xxx",
- if using V=0, nothing is printed,
- if using V=1, the full command lines are printed,
- other values are indeterminate,
- should help in debugging the kconfig stuff;
- complete kconfig/{,m}conf generation:
- fully dynamic dependencies on source files,
- compilation of .c into .o, then linking (instead of direct linking),
- VPATH usage when not --local;
Typo + a coment moved.
/trunk/kconfig/kconfig.mk | 140 87 53 0 +++++++++++++++++++++++++++++++++--------------------
/trunk/tools/tools.mk | 12 6 6 0 ++--
/trunk/steps.mk | 6 3 3 0 +-
/trunk/samples/samples.mk | 30 15 15 0 +++++-----
/trunk/ct-ng.in | 40 28 12 0 +++++++++++----
5 files changed, 139 insertions(+), 89 deletions(-)
2008-10-15 21:29:56 +00:00
|
|
|
$(SILENT)( . $(call sample_dir,$@)/reported.by; \
|
2008-10-14 21:30:27 +00:00
|
|
|
echo "Initially reported by: $${reporter_name:-Yann E. MORIN}"; \
|
|
|
|
echo "URL: $${reporter_url:-http://ymorin.is-a-geek.org/}"; \
|
|
|
|
if [ -n "$${reporter_comment}" ]; then \
|
|
|
|
echo ; \
|
|
|
|
echo "Comment:"; \
|
|
|
|
printf "$${reporter_comment}\n"; \
|
|
|
|
fi; \
|
|
|
|
echo ; \
|
|
|
|
echo '***********************************************************'; \
|
|
|
|
)
|
Cheesy kconfig stuff:
- silent/quiet/verbose build:
- ct-ng by default only prints quit messages, such as "CC xxx",
- if using V=0, nothing is printed,
- if using V=1, the full command lines are printed,
- other values are indeterminate,
- should help in debugging the kconfig stuff;
- complete kconfig/{,m}conf generation:
- fully dynamic dependencies on source files,
- compilation of .c into .o, then linking (instead of direct linking),
- VPATH usage when not --local;
Typo + a coment moved.
/trunk/kconfig/kconfig.mk | 140 87 53 0 +++++++++++++++++++++++++++++++++--------------------
/trunk/tools/tools.mk | 12 6 6 0 ++--
/trunk/steps.mk | 6 3 3 0 +-
/trunk/samples/samples.mk | 30 15 15 0 +++++-----
/trunk/ct-ng.in | 40 28 12 0 +++++++++++----
5 files changed, 139 insertions(+), 89 deletions(-)
2008-10-15 21:29:56 +00:00
|
|
|
$(SILENT)if grep -E '^CT_EXPERIMENTAL=y$$' .config >/dev/null 2>&1; then \
|
|
|
|
echo ; \
|
|
|
|
echo 'WARNING! This sample may enable experimental features.'; \
|
|
|
|
echo ' Please be sure to review the configuration prior'; \
|
|
|
|
echo ' to building and using your toolchain!'; \
|
|
|
|
echo 'Now, you have been warned!'; \
|
|
|
|
echo ; \
|
|
|
|
echo '***********************************************************'; \
|
2008-09-02 12:43:11 +00:00
|
|
|
fi
|
2008-10-14 21:30:27 +00:00
|
|
|
@echo
|
2008-10-14 19:40:12 +00:00
|
|
|
@echo 'Now configured for "$@"'
|
2007-07-01 19:04:20 +00:00
|
|
|
|
2008-10-27 18:42:26 +00:00
|
|
|
# ----------------------------------------------------------
|
2008-10-31 18:31:01 +00:00
|
|
|
# Some helper functions
|
|
|
|
|
|
|
|
# Create the rule to build a sample
|
|
|
|
# $1: sample tuple
|
|
|
|
# $2: prefix
|
|
|
|
define build_sample
|
2008-11-21 15:37:46 +00:00
|
|
|
@$(ECHO) ' CONF $(1)'
|
2008-10-31 18:31:01 +00:00
|
|
|
$(SILENT)cp $(call sample_dir,$(1))/crosstool.config .config
|
|
|
|
$(SILENT)sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$(2)":;' .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
|
2008-11-21 15:37:46 +00:00
|
|
|
$(SILENT)$(MAKE) -rf $(CT_NG) V=0 oldconfig
|
2008-10-31 18:31:01 +00:00
|
|
|
@$(ECHO) ' BUILD $(1)'
|
2008-11-21 15:37:46 +00:00
|
|
|
$(SILENT)$(MAKE) -rf $(CT_NG) V=0 build
|
2008-10-31 18:31:01 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
# Build samples for use (not regtest!)
|
|
|
|
|
|
|
|
# Check that PREFIX is set if building samples
|
|
|
|
ifneq ($(strip $(MAKECMDGOALS)),)
|
|
|
|
ifneq ($(strip $(filter $(patsubst %,build-%,$(CT_SAMPLES)) build-all,$(MAKECMDGOALS))),)
|
|
|
|
|
|
|
|
ifeq ($(strip $(CT_PREFIX)),)
|
|
|
|
$(error Please set 'CT_PREFIX' to where you want to install generated toolchain samples!)
|
|
|
|
endif
|
|
|
|
|
|
|
|
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-%,%,$@))
|
|
|
|
|
|
|
|
# Build al samples
|
|
|
|
build-all: $(patsubst %,build-%,$(CT_SAMPLES))
|
|
|
|
|
|
|
|
# Build all samples, overiding the number of // jobs per sample
|
|
|
|
build-all.%:
|
|
|
|
$(SILENT)$(MAKE) -rf $(CT_NG) V=$(V) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
|
|
|
|
|