samples/samples.mk
changeset 1001 c8ac48ba1411
parent 940 f0f9ba3f98f2
child 1025 fc64f85e41cc
     1.1 --- a/samples/samples.mk	Wed Oct 15 21:29:56 2008 +0000
     1.2 +++ b/samples/samples.mk	Mon Oct 27 18:42:26 2008 +0000
     1.3 @@ -1,10 +1,13 @@
     1.4  # Makefile to manage samples
     1.5  
     1.6 +# ----------------------------------------------------------
     1.7  # Build the list of available samples
     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 +CT_SAMPLES := $(sort $(CT_TOP_SAMPLES) $(CT_LIB_SAMPLES))
    1.11  
    1.12 -CT_SAMPLES := $(sort $(CT_TOP_SAMPLES) $(CT_LIB_SAMPLES))
    1.13 +# ----------------------------------------------------------
    1.14 +# This part deals with the samples help entries
    1.15  
    1.16  help-config::
    1.17  	@echo  '  saveconfig         - Save current config as a preconfigured target'
    1.18 @@ -23,13 +26,35 @@
    1.19  help-distrib::
    1.20  	@echo  '  wiki-samples       - Print a DokuWiki table of samples'
    1.21  
    1.22 +# ----------------------------------------------------------
    1.23 +# This part deals with printing samples information
    1.24 +
    1.25 +# Prints the details of a sample
    1.26 +PHONY += $(patsubst %,show-%,$(CT_SAMPLES))
    1.27  $(patsubst %,show-%,$(CT_SAMPLES)):
    1.28  	@$(CT_LIB_DIR)/scripts/showSamples.sh -v $(patsubst show-%,%,$(@))
    1.29  
    1.30 +# print the list of all available samples
    1.31  PHONY += list-samples
    1.32  list-samples: .FORCE
    1.33  	@echo $(CT_SAMPLES) |sed -r -e 's/ /\n/g;' |sort
    1.34  
    1.35 +wiki-samples:
    1.36 +	$(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -w $(CT_SAMPLES)
    1.37 +
    1.38 +# ----------------------------------------------------------
    1.39 +# This part deals with saving/restoring samples
    1.40 +
    1.41 +# Save a sample
    1.42 +saveconfig:
    1.43 +	$(SILENT)$(CT_LIB_DIR)/scripts/saveSample.sh
    1.44 +
    1.45 +# The 'sample_dir' function prints the directory in which the sample is,
    1.46 +# searching first in local samples, then in global samples
    1.47 +define sample_dir
    1.48 +$$( [ -d $(CT_TOP_DIR)/samples/$(1) ] && echo "$(CT_TOP_DIR)/samples/$(1)" || echo "$(CT_LIB_DIR)/samples/$(1)")
    1.49 +endef
    1.50 +
    1.51  # How we do recall one sample
    1.52  PHONY += $(CT_SAMPLES)
    1.53  $(CT_SAMPLES):
    1.54 @@ -61,13 +86,9 @@
    1.55  	@echo
    1.56  	@echo  'Now configured for "$@"'
    1.57  
    1.58 -# The 'sample_dir' function prints the directory in which the sample is,
    1.59 -# searching first in local samples, then in global samples
    1.60 -define sample_dir
    1.61 -$$( [ -d $(CT_TOP_DIR)/samples/$(1) ] && echo "$(CT_TOP_DIR)/samples/$(1)" || echo "$(CT_LIB_DIR)/samples/$(1)")
    1.62 -endef
    1.63 +# ----------------------------------------------------------
    1.64 +# And now for building all samples one after the other
    1.65  
    1.66 -# And now for building all samples one after the other
    1.67  PHONY += regtest regtest_local regtest_global
    1.68  regtest: regtest-local regtest-global
    1.69  
    1.70 @@ -107,9 +128,3 @@
    1.71  	 echo -e "\rCleaning sample \"$${samp}\""                                                       ;   \
    1.72  	 $(CT_NG) distclean                                                                             ;   \
    1.73  	 echo -e "\r"
    1.74 -
    1.75 -saveconfig:
    1.76 -	$(SILENT)$(CT_LIB_DIR)/scripts/saveSample.sh
    1.77 -
    1.78 -wiki-samples:
    1.79 -	$(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -w $(CT_SAMPLES)