1.1 --- a/samples/Makefile Mon Jun 18 11:43:02 2007 +0000
1.2 +++ b/samples/Makefile Sun Jul 01 19:04:20 2007 +0000
1.3 @@ -1,22 +1,31 @@
1.4 # Makefile to manage samples
1.5
1.6 # Build the list of available samples
1.7 -CT_SAMPLES = $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config))
1.8 +CT_TOP_SAMPLES := $(patsubst $(CT_TOP_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_TOP_DIR)/samples/*/crosstool.config))
1.9 +CT_LIB_SAMPLES := $(filter-out $(CT_TOP_SAMPLES),$(patsubst $(CT_LIB_DIR)/samples/%/crosstool.config,%,$(wildcard $(CT_LIB_DIR)/samples/*/crosstool.config)))
1.10 +
1.11 +CT_SAMPLES := $(CT_TOP_SAMPLES) $(CT_LIB_SAMPLES)
1.12
1.13 help-config::
1.14 @echo ' saveconfig - Save current config as a preconfigured target'
1.15
1.16 help-samples::
1.17 - @$(CT_TOP_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
1.18 + @$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
1.19
1.20 help-build::
1.21 @echo ' regtest - Regtest-build all samples'
1.22
1.23 # How we do build one sample
1.24 -.PHONY: $(CT_SAMPLES)
1.25 +PHONY += $(CT_SAMPLES)
1.26 $(CT_SAMPLES):
1.27 - @cp "$(CT_TOP_DIR)/samples/$(@)/crosstool.config" "$(CT_TOP_DIR)/.config"
1.28 - @$(MAKE) oldconfig
1.29 + @$(MAKE) -f $(CT_MAKEFILE) $(patsubst %,%_copy_config,$(@)) oldconfig
1.30 +
1.31 +$(patsubst %,%_copy_config,$(CT_SAMPLES)):
1.32 + @if [ -f $(CT_TOP_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config ]; then \
1.33 + cp "$(CT_TOP_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
1.34 + else \
1.35 + cp "$(CT_LIB_DIR)/samples/$(patsubst %_copy_config,%,$(@))/crosstool.config" "$(CT_TOP_DIR)/.config"; \
1.36 + fi
1.37
1.38 # And now for building all samples one after the other
1.39 # We could use a simple rule like: 'regtest: $(CT_SAMPLES)', but that doesn't
1.40 @@ -27,25 +36,25 @@
1.41 # Finaly, we can't use 'make sample-name' as we need to provide default values
1.42 # if the options set has changed, but oldconfig does not like when stdin is
1.43 # not a terminal (eg. it is a pipe).
1.44 -.PHONY: regtest
1.45 +PHONY += regtest
1.46 regtest:
1.47 @for samp in $(CT_SAMPLES); do \
1.48 echo -e "\rBuilding sample \"$${samp}\"" && \
1.49 - cp "$(CT_TOP_DIR)/samples/$${samp}/crosstool.config" "$(CT_TOP_DIR)/.config" && \
1.50 - yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1 && \
1.51 - sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config && \
1.52 + $(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) $${samp}_copy_config && \
1.53 + yes "" |$(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) defoldconfig >/dev/null 2>&1 && \
1.54 + sed -i -r -e 's:^(CT_PREFIX_DIR=).*$$:\1"$${CT_TOP_DIR}/targets/tst/$${CT_TARGET}":;' .config && \
1.55 sed -i -r -e 's:^.*(CT_LOG_(WARN|INFO|EXTRA|DEBUG|ALL)).*$$:# \1 is not set:;' .config && \
1.56 sed -i -r -e 's:^.*(CT_LOG_ERROR).*$$:\1=y:;' .config && \
1.57 sed -i -r -e 's:^(CT_LOG_LEVEL_MAX)=.*$$:\1="ERROR":;' .config && \
1.58 sed -i -r -e 's:^.*(CT_LOG_TO_FILE).*$$:\1=y:;' .config && \
1.59 sed -i -r -e 's:^.*(CT_LOG_PROGRESS_BAR).*$$:\1=y:;' .config && \
1.60 - yes "" |make -C $(CT_TOP_DIR) defoldconfig >/dev/null 2>&1 && \
1.61 - make -C $(CT_TOP_DIR) && \
1.62 + yes "" |$(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) defoldconfig >/dev/null 2>&1 && \
1.63 + $(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) && \
1.64 echo -e "\rMaking tarball for sample \"$${samp}\"" && \
1.65 - make -C $(CT_TOP_DIR) tarball; \
1.66 - echo -e "\rCleaning sample \"$${samp}\""; \
1.67 - make -C $(CT_TOP_DIR) distclean; \
1.68 + $(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) tarball ; \
1.69 + echo -e "\rCleaning sample \"$${samp}\"" ; \
1.70 + $(MAKE) -C $(CT_TOP_DIR) -f $(CT_MAKEFILE) distclean ; \
1.71 done
1.72
1.73 saveconfig:
1.74 - $(CT_TOP_DIR)/scripts/saveSample.sh
1.75 + $(CT_LIB_DIR)/scripts/saveSample.sh