imgtools/imaker/src/imaker_help.mk
changeset 1 be27ed110b50
child 584 56dd7656a965
equal deleted inserted replaced
0:044383f39525 1:be27ed110b50
       
     1 #
       
     2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Symbian Foundation License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description: iMaker help configuration
       
    15 #
       
    16 
       
    17 
       
    18 
       
    19 # Add help for a target or variable
       
    20 # add_help(name,type,values,desc)
       
    21 # @param name   - The name of the item for which the help is added
       
    22 # @param type   - The type of the item; t (target) or v (variable)
       
    23 # @param values - The possible values for the item, only for variables
       
    24 # @param desc   - Descrition of the item
       
    25 
       
    26 add_help =\
       
    27   $(if $(filter help%,$(MAKECMDGOALS)),\
       
    28     $(eval __i_type  := $(call select,$(call substr,1,1,$(strip $2)),t,t,v))\
       
    29     $(eval __i_isvar := $(call equal,$(__i_type),v))\
       
    30     $(foreach name,$1,\
       
    31       $(eval HELP.$(name).TYPE := $(__i_type))\
       
    32       $(if $(__i_isvar),$(eval HELP.$(name).VALUES = $3))\
       
    33       $(eval HELP.$(name).DESC = $(strip $(eval __i_desc := $(if $(__i_isvar),$4,$3))\
       
    34         $(foreach p,$(if $(__i_isvar),,4) 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20,\
       
    35           $(if $(call defined,$p),$(eval __i_desc := $(__i_desc)$(,)$($p)))))$(__i_desc))))
       
    36 
       
    37 get_helpitems =\
       
    38   $(strip $(eval __i_list := $(filter HELP.%.TYPE,$(.VARIABLES)))\
       
    39   $(foreach var,$(__i_list),$(call select,$($(var)),$1,$(patsubst HELP.%.TYPE,%,$(var)))))
       
    40 
       
    41 #==============================================================================
       
    42 
       
    43 .PHONY: help help-config help-target help-variable
       
    44 
       
    45 .DEFAULT_GOAL := help
       
    46 
       
    47 help:: ;@$(call IMAKER,HELPUSAGE:b)
       
    48 
       
    49 help-config: ;@$(call IMAKER,HELPCFG:b)
       
    50 
       
    51 help-target help-variable: $$@-* ;
       
    52 
       
    53 help-target-%-list help-target-%-wiki help-target-% \
       
    54 help-variable-%-list help-variable-%-value help-variable-%-all help-variable-%-wiki help-variable-% \
       
    55 help-%-list help-%:\
       
    56   ;@$(call IMAKER)
       
    57 
       
    58 # Help usage info
       
    59 define HELP_USAGE
       
    60 
       
    61   Print help data on documented iMaker API items; targets and variables.
       
    62   Wildcards *, ? and [] can be used with % patterns.
       
    63 
       
    64   help                  : Print this message.
       
    65   help-%                : $(HELP.help-%.DESC)
       
    66   help-%-list           : $(HELP.help-%-list.DESC)
       
    67 
       
    68   help-target           : $(HELP.help-target.DESC)
       
    69   help-target-%         : $(HELP.help-target-%.DESC)
       
    70   help-target-%-wiki    : $(HELP.help-target-%-wiki.DESC)
       
    71   help-target-%-list    : $(HELP.help-target-%-list.DESC)
       
    72 
       
    73   help-variable         : $(HELP.help-variable.DESC)
       
    74   help-variable-%       : $(HELP.help-variable-%.DESC)
       
    75   help-variable-%-all   : $(HELP.help-variable-%-all.DESC)
       
    76   help-variable-%-wiki  : $(HELP.help-variable-%-wiki.DESC)
       
    77   help-variable-%-list  : $(HELP.help-variable-%-list.DESC)
       
    78   help-variable-%-value : $(HELP.help-variable-%-value.DESC)
       
    79 
       
    80   help-config           : $(HELP.help-config.DESC)
       
    81 
       
    82   menu                  : Run interactive menu.
       
    83   version               : Print the iMaker version number.
       
    84 endef
       
    85 
       
    86 BUILD_HELPUSAGE = echo | $(call def2str,$(HELP_USAGE))\n
       
    87 
       
    88 BUILD_HELPDYNAMIC =\
       
    89   $(foreach file,$(call reverse,$(wildcard $(addsuffix /$(TRACE_PREFIX)*$(TRACE_SUFFIX),$(TRACE_IDIR)))),\
       
    90     $(call add_help,core-trace-$(patsubst $(TRACE_PREFIX)%$(TRACE_SUFFIX),%,$(notdir $(file))),t,Core image with traces for $(file).))\
       
    91   $(call add_help,$(call getlastdir,$(wildcard $(LANGPACK_ROOT)/$(LANGPACK_PREFIX)*/)),t,Language variant target.)\
       
    92   $(call add_help,$(call getlastdir,$(wildcard $(CUSTVARIANT_ROOT)/$(CUSTVARIANT_PREFIX)*/)),t,Customer variant target.)\
       
    93   $(eval include $(wildcard $(LANGPACK_ROOT)/$(LANGPACK_PREFIX)*/$(LANGPACK_MKNAME)))\
       
    94   $(eval include $(wildcard $(CUSTVARIANT_ROOT)/$(CUSTVARIANT_PREFIX)*/$(VARIANT_MKNAME)))
       
    95 
       
    96 BUILD_HELP =\
       
    97   $(eval __i_var := $(filter help-%,$(MAKECMDGOALS)))\
       
    98   $(if $(filter help-target help-variable,$(__i_var)),$(eval __i_var := $(__i_var)-*))\
       
    99   $(eval __i_helpgoal := $(__i_var))\
       
   100   $(foreach prefix,help target variable,$(eval __i_var := $(patsubst $(prefix)-%,%,$(__i_var))))\
       
   101   $(foreach suffix,all list value wiki,$(eval __i_var := $(patsubst %-$(suffix),%,$(__i_var))))\
       
   102   $(eval __i_list := $(if $(findstring help-target-$(__i_var),$(__i_helpgoal)),$(call get_helpitems,t),\
       
   103     $(if $(findstring help-variable-$(__i_var),$(__i_helpgoal)),$(call get_helpitems,v),$(call get_helpitems,t) $(call get_helpitems,v))))\
       
   104   $(eval __i_value := $(filter %-$(__i_var)-all %-$(__i_var)-value,$(__i_helpgoal)))\
       
   105   $(eval __i_desc := $(filter-out %-$(__i_var)-list %-$(__i_var)-value,$(__i_helpgoal)))\
       
   106   $(eval __i_wiki := $(if $(filter %-$(__i_var)-wiki,$(__i_helpgoal)),\ * ))\
       
   107   $(call peval,\
       
   108     my @var = ($(foreach var,$(foreach var2,$(subst $(,), ,$(__i_var)),$(call filterwcard,$(var2),$(__i_list))),{\
       
   109       n=>$(call pquote,$(var))\
       
   110       $(eval __i_isvar := $(call equal,$(HELP.$(var).TYPE),v))\
       
   111       $(if $(__i_value),$(if $(__i_isvar),$(,)v=>$(call pquote,$(call def2str,$($(var))))))\
       
   112       $(,)t=>q($(HELP.$(var).TYPE))\
       
   113       $(if $(__i_desc),\
       
   114         $(,)d=>$(call pquote,$(HELP.$(var).DESC))\
       
   115         $(if $(__i_isvar),$(,)V=>$(call pquote,$(HELP.$(var).VALUES)))) }$(,)));\
       
   116     imaker:DPrint(1, map($(if $(__i_desc),$(if $(__i_wiki),,q(-) x 40 . qq(\n) .))\
       
   117       qq($(if $(__i_wiki),== $$_->{n} ==,$$_->{n}))\
       
   118       $(if $(__i_value),. ($$_->{t} eq q(v) ? qq( = `$$_->{v}$') : q())) . qq(\n)\
       
   119       $(if $(__i_desc),.\
       
   120         qq($(__i_wiki)Type       : ) . ($$_->{t} eq q(t) ? qq(Target\n) : qq(Variable\n)) .\
       
   121         qq($(__i_wiki)Description: $$_->{d}\n) .\
       
   122         ($$_->{t} eq q(v) ? qq($(__i_wiki)Values     : $$_->{V}\n) : q())), @var));\
       
   123     return(q()))
       
   124 
       
   125 BUILD_HELPCFG =\
       
   126   echo | Finding available configuration file(s):\n\
       
   127     $(call get_cfglist,$(CONFIGROOT),image_conf_.*\.mk,2)\n
       
   128 
       
   129 get_cfglist =\
       
   130   $(call peval,\
       
   131     use File::Find;\
       
   132     my ($$dir, @conf) = (GetAbsDirname($(call pquote,$1)), ());\
       
   133     find(sub {\
       
   134       push(@conf, $$File::Find::name) if\
       
   135         /$2$$/s && (($$File::Find::name =~ tr/\///) > (($$dir =~ tr/\///) + $3));\
       
   136     }, $$dir);\
       
   137     return(join(q(\n), map(Quote($$_), sort({lc($$a) cmp lc($$b)} @conf)))))
       
   138 
       
   139 
       
   140 ###############################################################################
       
   141 # Helps
       
   142 
       
   143 $(call add_help,CONFIGROOT,v,(string),Define the default configuration root directory.)
       
   144 $(call add_help,USE_OVERRIDE,v,([0|1]),Define whether the override.pm Buildrom.pl plugin is used.)
       
   145 $(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).)
       
   146 $(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).)
       
   147 $(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.)
       
   148 $(call add_help,USE_SYMGEN,v,([0|1]),Generate the rom symbol file. 0=Do not generate, 1=Generate)
       
   149 $(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.)
       
   150 $(call add_help,USE_VERGEN,v,([0|1]),Use iMaker version info generation)
       
   151 $(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)
       
   152 $(call add_help,LABEL,v,(string),A label to the NAME of the image)
       
   153 $(call add_help,NAME,v,(string),The name of the image)
       
   154 $(call add_help,TYPE,v,(rnd|prd|subcon),Defines the image type.)
       
   155 $(call add_help,WORKDIR,v,(string),The working directory for the image creation)
       
   156 $(call add_help,PRODUCT_NAME,v,(string),Name of the product)
       
   157 $(call add_help,PRODUCT_MODEL,v,(string),The model of the product)
       
   158 $(call add_help,PRODUCT_REVISION,v,(string),The revision of the product.)
       
   159 $(call add_help,BLDROM_OPT,v,(string),The default buildrom.pl options)
       
   160 $(call add_help,BLDROPT,v,(string),For passing extra parameters (from command line) to the buildrom.pl)
       
   161 $(call add_help,BLDROBY,v,(string),For passing extra oby files (from command line) to the buildrom.pl)
       
   162 $(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))
       
   163 $(call add_help,COREPLAT_NAME,v,(string),Name of the core platform)
       
   164 $(call add_help,CORE_DIR,v,(string),The working directory, when creating core image)
       
   165 $(call add_help,CORE_NAME,v,(string),The name of the core image)
       
   166 $(call add_help,CORE_OBY,v,(string),The oby file(s) included to the core image creation)
       
   167 $(call add_help,CORE_OPT,v,(string),The core specific buildrom options)
       
   168 $(call add_help,CORE_MSTOBY,v,(string),The generated master oby file name, which includes the CORE_OBY files)
       
   169 $(call add_help,CORE_TIME,v,(string),The time defined to the core image)
       
   170 $(call add_help,CORE_VERIBY,v,(string),The name of the generated core *version.iby, which included version files and info)
       
   171 $(call add_help,CORE_ROMVER,v,(string),The rom version parameter passed to the version.iby)
       
   172 $(call add_help,CORE_VERSION,v,(string),The version of the core. Used in sw.txt generation.)
       
   173 $(call add_help,CORE_SWVERFILE,v,(string),The (generated) _core_sw.txt version file name. This generated file is included in the CORE_VERIBY file.)
       
   174 $(call add_help,CORE_SWVERINFO,v,(string),The content string for the sw.txt file.)
       
   175 $(call add_help,CORE_MODELFILE,v,(string),The (generated) _core_model.txt file name.)
       
   176 $(call add_help,CORE_MODELINFO,v,(string),The content string for the model.txt file.)
       
   177 $(call add_help,CORE_IMEISVFILE,v,(string),The (generated) _core_imeisv.txt file name.)
       
   178 $(call add_help,CORE_IMEISVINFO,v,(string),The content string for the imeisv.txt file.)
       
   179 $(call add_help,CORE_PLATFILE,v,(string),The (generated) _core_platform.txt file name.)
       
   180 $(call add_help,CORE_PLATINFO,v,(string),The content string for the platform.txt file.)
       
   181 $(call add_help,CORE_PRODFILE,v,(string),The (generated) _core_product.txt file name.)
       
   182 $(call add_help,CORE_PLATINFO,v,(string),The content string for the product.txt file.)
       
   183 $(call add_help,CORE_FWIDFILE,v,(string),The (generated) _core_fwid.txt file name.)
       
   184 $(call add_help,CORE_PLATINFO,v,(string),The content string for the fwid.txt file.)
       
   185 $(call add_help,CORE_NDPROMFILE,v,(string),The name of the core Non Demand Paging rom file.)
       
   186 $(call add_help,CORE_ODPROMFILE,v,(string),The name of the core On Demand Paging rom file (Rom paging).)
       
   187 $(call add_help,CORE_CDPROMFILE,v,(string),The name of the core Code Demand Paging rom file (Code paging).)
       
   188 $(call add_help,CORE_ROFSFILE,v,(string),The name of the core rofs file.)
       
   189 $(call add_help,CORE_UDEBFILE,v,(string),The name of the core udeb file. See USE_UDEB.)
       
   190 $(call add_help,ROFS2_DIR,v,(string),The working directory, when creating the rofs2 image)
       
   191 $(call add_help,ROFS2_NAME,v,(string),The name of the rofs2 image)
       
   192 $(call add_help,ROFS2_OBY,v,(string),The oby file(s) included to the rofs2 image creation)
       
   193 $(call add_help,ROFS2_OPT,v,(string),The rofs2 specific buildrom options)
       
   194 $(call add_help,ROFS2_MSTOBY,v,(string),The (generated) rofs2 master oby file name. This file includes the ROFS2_OBY files and other parameters)
       
   195 $(call add_help,ROFS2_HEADER,v,(string),This variable can contain a header section for the rofs2 master oby.)
       
   196 $(call add_help,ROFS2_FOOTER,v,(string),This variable can contain a footer section for the rofs2 master oby.)
       
   197 $(call add_help,ROFS2_TIME,v,(string),The time defined to the rofs2 image.)
       
   198 $(call add_help,ROFS2_VERIBY,v,(string),The (generated) version iby file name for the rofs2 image. This file included the version text files and other version parameters.)
       
   199 $(call add_help,ROFS2_ROMVER,v,(string),The rofs2 ROM version string)
       
   200 $(call add_help,ROFS2_FWIDFILE,v,(string),The (generated) _rofs2_fwid.txt file name.)
       
   201 $(call add_help,ROFS2_FWIDINFO,v,(string),The content string for the fwid2.txt file.)
       
   202 $(call add_help,ROFS3_DIR,v,(string),The working directory, when creating the rofs3 image)
       
   203 $(call add_help,ROFS3_NAME,v,(string),The name of the rofs3 image)
       
   204 $(call add_help,ROFS3_OBY,v,(string),The oby file(s) included to the rofs3 image creation)
       
   205 $(call add_help,ROFS3_OPT,v,(string),The rofs3 specific buildrom options)
       
   206 $(call add_help,ROFS3_MSTOBY,v,(string),The (generated) version iby file name for the rofs3 image. This file included the version text files and other version parameters.)
       
   207 $(call add_help,ROFS3_HEADER,v,(string),This variable can contain a header section for the rofs3 master oby.)
       
   208 $(call add_help,ROFS3_FOOTER,v,(string),This variable can contain a footer section for the rofs3 master oby.)
       
   209 $(call add_help,ROFS3_TIME,v,(string),The time defined to the rofs3 image.)
       
   210 $(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.)
       
   211 $(call add_help,ROFS3_ROMVER,v,(string),The rofs3 ROM version string)
       
   212 $(call add_help,ROFS3_CUSTSWFILE,v,(string),The (generated) source file name for customersw.txt.)
       
   213 $(call add_help,ROFS3_CUSTSWINFO,v,(string),The content string for the customersw.txt.)
       
   214 $(call add_help,ROFS3_FWIDFILE,v,(string),The (generated) _rofs3_fwid.txt file name.)
       
   215 $(call add_help,ROFS3_FWIDINFO,v,(string),The content string for the fwid3.txt file.)
       
   216 $(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.)
       
   217 $(call add_help,VARIANT_CONFML,v,(string),Configure what is the ConfigurationTool input confml file, when configuration tool is ran.)
       
   218 $(call add_help,VARIANT_CONFCP,v,(string),Configure which ConfigurationTool generated configurations dirs are copied to output.)
       
   219 
       
   220 # Targets
       
   221 $(call add_help,version,t,Print the version information)
       
   222 $(call add_help,clean,t,Clean all target files.)
       
   223 $(call add_help,core,t,Create the core image (ROM,ROFS1))
       
   224 $(call add_help,rofs2,t,Create the rofs2 image)
       
   225 $(call add_help,rofs3,t,Create the rofs3 image)
       
   226 $(call add_help,variant,t,Create the variant image (rofs2,rofs3))
       
   227 $(call add_help,uda,t,Create the User Data area (uda) image.)
       
   228 $(call add_help,image,t,Create only the image file(s) (*.img))
       
   229 $(call add_help,core-image,t,Create the core image files (rom.img, rofs1.img))
       
   230 $(call add_help,rofs2-image,t,Create the rofs2 image file (rofs2.img))
       
   231 $(call add_help,rofs3-image,t,Create the rofs3 image file (rofs3.img))
       
   232 $(call add_help,variant-image,t,Create the variant image files (rofs3.img,rofs3.img))
       
   233 $(call add_help,uda-image,t,Create the User Data area (uda) image.)
       
   234 $(call add_help,toolinfo,t,Print info about the tool)
       
   235 $(call add_help,romsymbol,t,Create the rom symbol file)
       
   236 $(call add_help,all,t,Create all image sections and symbol files.)
       
   237 $(call add_help,flash-all,t,Create all image sections and symbol files.)
       
   238 $(call add_help,flash,t,Create all image sections files. Not any symbol files.)
       
   239 $(call add_help,f2image,t,Revert the Symbian image file (.img) from the elf2flash (flash) file.(See CORE_FLASH,ROFS2_FLASH,ROFS3_FLASH))
       
   240 $(call add_help,step-%,t,\
       
   241 Generic target to execute any step inside the iMaker configuration. Any step (e.g. BUILD_*,CLEAN_*) can be executed with step-STEPNAME.\
       
   242 Example: step-ROFS2PRE executes the CLEAN_ROFS2PRE and BUILD_ROFS2PRE commands.)
       
   243 $(call add_help,print-%,t,Print the value of the given variable to the screen.)
       
   244 
       
   245 $(call add_help,help,t,Print help on help targets.)
       
   246 $(call add_help,help-%,t,Print help on help items matching the pattern.)
       
   247 $(call add_help,help-%-list,t,Print a list of help items matching the pattern.)
       
   248 $(call add_help,help-target,t,Print help on all targets (same as help-target-*).)
       
   249 $(call add_help,help-target-%,t,Print help on targets matching the pattern.)
       
   250 $(call add_help,help-target-%-wiki,t,Print wiki-formatted help on targets matching the pattern.)
       
   251 $(call add_help,help-target-%-list,t,Print a list of targets matching the pattern.)
       
   252 $(call add_help,help-variable,t,Print help on all variables (same as help-variable-*).)
       
   253 $(call add_help,help-variable-%,t,Print help on variables matching the pattern.)
       
   254 $(call add_help,help-variable-%-all,t,Print full help on variables matching the pattern.)
       
   255 $(call add_help,help-variable-%-wiki,t,Print wiki-formatted help on variables matching the pattern.)
       
   256 $(call add_help,help-variable-%-list,t,Print a list of variables matching the pattern.)
       
   257 $(call add_help,help-variable-%-value,t,Print a list of variables with values matching the pattern.)
       
   258 $(call add_help,help-config,t,Print a list of available configurations in the current working environment.)
       
   259 
       
   260 
       
   261 # END OF IMAKER_HELP.MK