imgtools/imaker/src/imaker_help.mk
changeset 596 9f25be3da657
parent 584 56dd7656a965
--- a/imgtools/imaker/src/imaker_help.mk	Fri Jun 18 13:49:03 2010 +0300
+++ b/imgtools/imaker/src/imaker_help.mk	Thu Jun 24 10:35:05 2010 +0300
@@ -25,14 +25,15 @@
 
 add_help =\
   $(if $(filter help%,$(MAKECMDGOALS)),\
-    $(eval __i_type  := $(call select,$(call substr,1,1,$(strip $2)),t,t,v))\
-    $(eval __i_isvar := $(call equal,$(__i_type),v))\
+    $(eval __i_type  := $(if $(filter t% T%,$2),t,v))\
+    $(eval __i_isvar := $(filter v,$(__i_type)))\
     $(foreach name,$1,\
       $(eval HELP.$(name).TYPE := $(__i_type))\
       $(if $(__i_isvar),$(eval HELP.$(name).VALUES = $3))\
-      $(eval HELP.$(name).DESC = $(strip $(eval __i_desc := $(if $(__i_isvar),$4,$3))\
+      $(eval HELP.$(name).DESC = $(strip $(eval __i_desc = $(if $(__i_isvar),$$4,$$3))\
         $(foreach p,$(if $(__i_isvar),,4) 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20,\
-          $(if $(call defined,$p),$(eval __i_desc := $(__i_desc)$(,)$($p)))))$(__i_desc))))
+          $(if $(call defined,$p),$(eval __i_desc = $(value __i_desc)$(,)$$($p))))\
+        $(subst $$1,$(name),$(subst $$2,$(__i_type),$(__i_desc)))))))
 
 get_helpitems =\
   $(strip $(eval __i_list := $(filter HELP.%.TYPE,$(.VARIABLES)))\
@@ -40,26 +41,19 @@
 
 #==============================================================================
 
-.PHONY: help help-config help-target help-variable
+.PHONY: help help-config
 
-.DEFAULT_GOAL := help
-
-help:: ;@$(call IMAKER,HELPUSAGE:b)
+help:: ;@$(call IMAKER,HELPUSAGE)
 
-help-config: ;@$(call IMAKER,HELPCFG:b)
-
-help-target help-variable: $$@-* ;
+help-config: ;@$(call IMAKER,HELPCFG)
 
-help-target-%-list help-target-%-wiki help-target-% \
-help-variable-%-list help-variable-%-value help-variable-%-all help-variable-%-wiki help-variable-% \
-help-%-list help-%:\
-  ;@$(call IMAKER)
+help-%: ;@$(call IMAKER,HELP)
 
 # Help usage info
 define HELP_USAGE
 
   Print help data on documented iMaker API items; targets and variables.
-  Wildcards *, ? and [] can be used with % patterns.
+  Wildcards *, ? and [..] can be used with % patterns.
 
   help                  : Print this message.
   help-%                : $(HELP.help-%.DESC)
@@ -85,15 +79,10 @@
 
 BUILD_HELPUSAGE = echo | $(call def2str,$(HELP_USAGE))\n
 
-BUILD_HELPDYNAMIC =\
-  $(foreach file,$(call reverse,$(wildcard $(addsuffix /$(TRACE_PREFIX)*$(TRACE_SUFFIX),$(TRACE_IDIR)))),\
-    $(call add_help,core-trace-$(patsubst $(TRACE_PREFIX)%$(TRACE_SUFFIX),%,$(notdir $(file))),t,Core image with traces for $(file).))\
-  $(call add_help,$(call getlastdir,$(wildcard $(LANGPACK_ROOT)/$(LANGPACK_PREFIX)*/)),t,Language variant target.)\
-  $(call add_help,$(call getlastdir,$(wildcard $(CUSTVARIANT_ROOT)/$(CUSTVARIANT_PREFIX)*/)),t,Customer variant target.)\
-  $(eval include $(wildcard $(LANGPACK_ROOT)/$(LANGPACK_PREFIX)*/$(LANGPACK_MKNAME)))\
-  $(eval include $(wildcard $(CUSTVARIANT_ROOT)/$(CUSTVARIANT_PREFIX)*/$(VARIANT_MKNAME)))
+BUILD_HELPDYNAMIC =
 
 BUILD_HELP =\
+  $(BUILD_HELPDYNAMIC)\
   $(eval __i_var := $(filter help-%,$(MAKECMDGOALS)))\
   $(if $(filter help-target help-variable,$(__i_var)),$(eval __i_var := $(__i_var)-*))\
   $(eval __i_helpgoal := $(__i_var))\
@@ -107,15 +96,15 @@
   $(call peval,\
     my @var = ($(foreach var,$(foreach var2,$(subst $(,), ,$(__i_var)),$(call filterwcard,$(var2),$(__i_list))),{\
       n=>$(call pquote,$(var))\
-      $(eval __i_isvar := $(call equal,$(HELP.$(var).TYPE),v))\
+      $(eval __i_isvar := $(filter v,$(HELP.$(var).TYPE)))\
       $(if $(__i_value),$(if $(__i_isvar),$(,)v=>$(call pquote,$(call def2str,$($(var))))))\
       $(,)t=>q($(HELP.$(var).TYPE))\
       $(if $(__i_desc),\
         $(,)d=>$(call pquote,$(HELP.$(var).DESC))\
         $(if $(__i_isvar),$(,)V=>$(call pquote,$(HELP.$(var).VALUES)))) }$(,)));\
-    imaker:DPrint(1, map($(if $(__i_desc),$(if $(__i_wiki),,q(-) x 40 . qq(\n) .))\
+    DPrint(1, map($(if $(__i_desc),$(if $(__i_wiki),,q(-) x 40 . qq(\n) .))\
       qq($(if $(__i_wiki),== $$_->{n} ==,$$_->{n}))\
-      $(if $(__i_value),. ($$_->{t} eq q(v) ? qq( = `$$_->{v}$') : q())) . qq(\n)\
+      $(if $(__i_value),. ($$_->{t} eq q(v) ? qq( = `$$_->{v}') : q())) . qq(\n)\
       $(if $(__i_desc),.\
         qq($(__i_wiki)Type       : ) . ($$_->{t} eq q(t) ? qq(Target\n) : qq(Variable\n)) .\
         qq($(__i_wiki)Description: $$_->{d}\n) .\
@@ -124,42 +113,44 @@
 
 BUILD_HELPCFG =\
   echo | Finding available configuration file(s):\n\
-    $(call get_cfglist,$(CONFIGROOT),image_conf_.*\.mk,2)\n
+    $(call peval,return(join(q(), map(Quote(qq($$_\n)), GetConfmkList(1)))))
+
+
+###############################################################################
+# print-%
 
-get_cfglist =\
-  $(call peval,\
-    use File::Find;\
-    my ($$dir, @conf) = (GetAbsDirname($(call pquote,$1)), ());\
-    find(sub {\
-      push(@conf, $$File::Find::name) if\
-        /$2$$/s && (($$File::Find::name =~ tr/\///) > (($$dir =~ tr/\///) + $3));\
-    }, $$dir);\
-    return(join(q(\n), map(Quote($$_), sort({lc($$a) cmp lc($$b)} @conf)))))
+BUILD_PRINTVAR = $(call peval,DPrint(1,\
+  $(foreach var1,$(subst $(,), ,$(subst print-,,$(filter print-%,$(MAKECMDGOALS)))),\
+    $(foreach var2,$(call filterwcard,$(var1),$(filter-out BUILD_PRINTVAR,$(filter $(word 1,$(call substm,* ? [, ,$(var1)))%,$(.VARIABLES)))),\
+      $(call pquote,$(var2) = `$(call def2str,$($(var2)))').qq(\n),))); return(q()))
+
+print-%: ;@$(call IMAKER,PRINTVAR)
+
+$(call add_help,print-%,t,Print the value(s) of the given variable(s). Wildcards *, ? and [..] can be used in variable names.)
 
 
 ###############################################################################
 # Helps
 
 $(call add_help,CONFIGROOT,v,(string),Define the default configuration root directory.)
-$(call add_help,USE_OVERRIDE,v,([0|1]),Define whether the override.pm Buildrom.pl plugin is used.)
 $(call add_help,USE_PAGING,v,((0|rom|code[:[(1|2|3)]+]?)),Define the usage of On Demand Pagin (ODP). (E.g. 0,rom,code).)
 $(call add_help,USE_ROFS,v,([[dummy|]0..6][,[dummy|]0..6]*),Define the rofs sections in use. A comma separated list can be given of possible values. (E.g. 1,2,3).)
 $(call add_help,USE_ROMFILE,v,([0|1]),Define whether the \epoc32\rombuild\romfiles.txt is used. Files in romfiles are automatically moved to ROM, everything else in core is moved to ROFS1.)
 $(call add_help,USE_SYMGEN,v,([0|1]),Generate the rom symbol file. 0=Do not generate, 1=Generate)
 $(call add_help,USE_UDEB,v,([0|1|full]),Include the usage of the debug binary *.txt to define the list of binaries that are taken from udeb folder instead of the urel.)
-$(call add_help,USE_VERGEN,v,([0|1]),Use iMaker version info generation)
-$(call add_help,KEEPTEMP,v,([0|1]),Keep the buildrom.pl temp files (copied to the WORKDIR). E.g. tmp1.oby tmp2.oby..tmp9.oby)
+$(call add_help,KEEPTEMP,v,([0|1]),Keep the buildrom.pl temp files (copied to the OUTDIR). E.g. tmp1.oby tmp2.oby..tmp9.oby)
 $(call add_help,LABEL,v,(string),A label to the NAME of the image)
 $(call add_help,NAME,v,(string),The name of the image)
 $(call add_help,TYPE,v,(rnd|prd|subcon),Defines the image type.)
-$(call add_help,WORKDIR,v,(string),The working directory for the image creation)
+$(call add_help,OUTDIR,v,(string),The output directory for the image creation.)
+$(call add_help,WORKDIR,v,(string),The working directory for the image creation. Deprecated, please use OUTDIR.)
 $(call add_help,PRODUCT_NAME,v,(string),Name of the product)
 $(call add_help,PRODUCT_MODEL,v,(string),The model of the product)
 $(call add_help,PRODUCT_REVISION,v,(string),The revision of the product.)
 $(call add_help,BLDROM_OPT,v,(string),The default buildrom.pl options)
 $(call add_help,BLDROPT,v,(string),For passing extra parameters (from command line) to the buildrom.pl)
 $(call add_help,BLDROBY,v,(string),For passing extra oby files (from command line) to the buildrom.pl)
-$(call add_help,SOS_VERSION,v,([0-9]+.[0-9]+),Symbian OS version number. The value is used in the version info generation (platform.txt).(see USE_VERGEN))
+$(call add_help,SOS_VERSION,v,([0-9]+.[0-9]+),Symbian OS version number. The value is used in the version info generation (platform.txt).)
 $(call add_help,COREPLAT_NAME,v,(string),Name of the core platform)
 $(call add_help,CORE_DIR,v,(string),The working directory, when creating core image)
 $(call add_help,CORE_NAME,v,(string),The name of the core image)
@@ -209,28 +200,20 @@
 $(call add_help,ROFS3_TIME,v,(string),The time defined to the rofs3 image.)
 $(call add_help,ROFS3_VERIBY,v,(string),The (generated) version iby file name for the rofs3 image. This file included the version text files and other version parameters.)
 $(call add_help,ROFS3_ROMVER,v,(string),The rofs3 ROM version string)
-$(call add_help,ROFS3_CUSTSWFILE,v,(string),The (generated) source file name for customersw.txt.)
-$(call add_help,ROFS3_CUSTSWINFO,v,(string),The content string for the customersw.txt.)
+$(call add_help,ROFS3_SWVERFILE,v,(string),The (generated) source file name for customersw.txt.)
+$(call add_help,ROFS3_SWVERINFO,v,(string),The content string for the customersw.txt.)
 $(call add_help,ROFS3_FWIDFILE,v,(string),The (generated) _rofs3_fwid.txt file name.)
 $(call add_help,ROFS3_FWIDINFO,v,(string),The content string for the fwid3.txt file.)
 $(call add_help,VARIANT_DIR,v,(string),Configure the directory where to included the customer variant content. By default all content under $(VARIANT_CPDIR) is included to the image as it exists in the folder.)
-$(call add_help,VARIANT_CONFML,v,(string),Configure what is the ConfigurationTool input confml file, when configuration tool is ran.)
-$(call add_help,VARIANT_CONFCP,v,(string),Configure which ConfigurationTool generated configurations dirs are copied to output.)
+$(call add_help,PRODUCT_VARDIR,v,(string),Overrides the VARIANT_DIR for product variant, see the instructions of VARIANT_DIR for details.)
+$(call add_help,TARGET_DEFAULT,v,(string),Configure actual target(s) for target default.)
 
 # Targets
 $(call add_help,version,t,Print the version information)
 $(call add_help,clean,t,Clean all target files.)
-$(call add_help,core,t,Create the core image (ROM,ROFS1))
-$(call add_help,rofs2,t,Create the rofs2 image)
-$(call add_help,rofs3,t,Create the rofs3 image)
 $(call add_help,variant,t,Create the variant image (rofs2,rofs3))
-$(call add_help,uda,t,Create the User Data area (uda) image.)
 $(call add_help,image,t,Create only the image file(s) (*.img))
-$(call add_help,core-image,t,Create the core image files (rom.img, rofs1.img))
-$(call add_help,rofs2-image,t,Create the rofs2 image file (rofs2.img))
-$(call add_help,rofs3-image,t,Create the rofs3 image file (rofs3.img))
-$(call add_help,variant-image,t,Create the variant image files (rofs3.img,rofs3.img))
-$(call add_help,uda-image,t,Create the User Data area (uda) image.)
+$(call add_help,variant-image,t,Create the variant image files (rofs2.img, rofs3.img))
 $(call add_help,toolinfo,t,Print info about the tool)
 $(call add_help,romsymbol,t,Create the rom symbol file)
 $(call add_help,all,t,Create all image sections and symbol files.)
@@ -240,7 +223,7 @@
 $(call add_help,step-%,t,\
 Generic target to execute any step inside the iMaker configuration. Any step (e.g. BUILD_*,CLEAN_*) can be executed with step-STEPNAME.\
 Example: step-ROFS2PRE executes the CLEAN_ROFS2PRE and BUILD_ROFS2PRE commands.)
-$(call add_help,print-%,t,Print the value of the given variable to the screen.)
+$(call add_help,default,t,Default target, uses variable TARGET_DEFAULT to get actual target(s), current default = $$(TARGET_DEFAULT).)
 
 $(call add_help,help,t,Print help on help targets.)
 $(call add_help,help-%,t,Print help on help items matching the pattern.)