imgtools/imaker/src/imaker_tools.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 external tools configuration
       
    15 #
       
    16 
       
    17 
       
    18 
       
    19 ###############################################################################
       
    20 # External tools
       
    21 
       
    22 BLDROM_TOOL     = buildrom
       
    23 ROMBLD_TOOL     = rombuild
       
    24 ROFSBLD_TOOL    = rofsbuild
       
    25 MAKSYM_TOOL     = maksym
       
    26 MAKSYMROFS_TOOL = maksymrofs
       
    27 IMGCHK_TOOL     = imgcheck
       
    28 INTPRSIS_TOOL   = interpretsis
       
    29 READIMG_TOOL    = readimage
       
    30 
       
    31 UNZIP_TOOL      = unzip
       
    32 ZIP_TOOL        = zip
       
    33 7ZIP_TOOL       = 7za
       
    34 FILEDISK_TOOL   = filedisk
       
    35 WINIMAGE_TOOL   = "c:/program files/winimage/winimage.exe"
       
    36 
       
    37 #==============================================================================
       
    38 
       
    39 BLDROM_OPT =\
       
    40   -loglevel1 $(call iif,$(KEEPTEMP),-p) -v -nosymbols\
       
    41   $(call iif,$(USE_FEATVAR),-DFEATUREVARIANT=$(FEATURE_VARIANT))\
       
    42   $(if $(IMAGE_TYPE),-D_IMAGE_TYPE_$(IMAGE_TYPE)) $(if $(TYPE),-D_IMAGE_TYPE_$(call ucase,$(TYPE)))
       
    43 
       
    44 BLDROM_PARSE =\
       
    45   parse | \nMissing file(s):\n | Missing file: |\
       
    46   parse | \nWarning(s):\n      | /WARNING:\|WARN:/i |\
       
    47   parse | \nError(s):\n        | /ERROR:\|ERR :/i   |\
       
    48   parse | \nCan$'t locate:\n | Can$'t locate | parse | \ncouldn$'t be located:\n | couldn$'t be located
       
    49 
       
    50 #* Writing tmp7.oby - result of problem-suppression phase
       
    51 #Can't open \epoc32\release\ARMV5\urel\apgrfx.dll.map
       
    52 #Unrecognised option -NO-HEADER0
       
    53 
       
    54 # For passing extra paramters (from command line)
       
    55 BLDROPT =
       
    56 BLDROBY =
       
    57 
       
    58 
       
    59 ###############################################################################
       
    60 # S60 Configuration Tool CLI
       
    61 
       
    62 CONFT_TOOL    = cli.cmd
       
    63 CONFT_TOOLDIR = $(or $(wildcard /s60/tools/toolsextensions/ConfigurationTool),/ext/tools/toolsextensions/ConfigurationTool)
       
    64 
       
    65 CONFT_DIR     = $(WORKDIR)/ct
       
    66 CONFT_TMPDIR  = $(CONFT_DIR)/_temp
       
    67 CONFT_CFGNAME = variant
       
    68 CONFT_CONFML  = $(call iif,$(USE_VARIANTBLD),$(VARIANT_CONFML),$(WORKDIR)/$(CONFT_CFGNAME).confml)
       
    69 CONFT_IMPL    = $(CONFIGROOT)/confml_data/s60;$(CONFIGROOT)/confml_data/customsw
       
    70 CONFT_IBYML   = $(CONFT_TOOLDIR)/ibyml
       
    71 CONFT_OUTDIR  = $(call iif,$(USE_VARIANTBLD),$(VARIANT_OUTDIR),$(CONFT_DIR)/cenrep)
       
    72 CONFT_CRLOG   = $(call iif,$(USE_VARIANTBLD),$(VARIANT_PREFIX)_,$(CONFT_DIR))cenrep.log
       
    73 CONFT_ECLCONF = -configuration $(CONFT_TMPDIR) -data $(CONFT_TMPDIR)
       
    74 CONFT_CONF    = $(CONFT_ECLCONF)\
       
    75   -master $(CONFT_CONFML) -impl $(CONFT_IMPL) $(if $(CONFT_IBYML),-ibyml $(CONFT_IBYML)) -output $(CONFT_DIR)\
       
    76   -report $(CONFT_CRLOG) -ignore_errors
       
    77 CONFT_CONFCP  = $(call iif,$(USE_VARIANTBLD),$(VARIANT_CONFCP),$(CONFT_CFGNAME))
       
    78 
       
    79 CONFT_CMD     = $(CONFT_TOOL) $(CONFT_CONF)
       
    80 CONFT_PARSE   = parse | \nWarnings, errors and problems:\n | /warning:\|error:\|problem/i
       
    81 
       
    82 CLEAN_CENREP =\
       
    83   del    | $(CONFT_CRLOG) |\
       
    84   deldir | "$(CONFT_DIR)" "$(CONFT_TMPDIR)" $(call iif,$(USE_VARIANTBLD),,"$(CONFT_OUTDIR)")
       
    85 
       
    86 BUILD_CENREP =\
       
    87   echo-q | Calling S60 Configuration Tool |\
       
    88   mkcd   | $(CONFT_DIR) |\
       
    89   deldir | $(CONFT_TMPDIR) |\
       
    90   cmd    | $(CONFT_CMD) | $(CONFT_PARSE) |\
       
    91   $(foreach dir,$(CONFT_CONFCP),\
       
    92     finddir | $(CONFT_DIR)/$(dir) | * | |\
       
    93     copy    | __find__ | $(CONFT_OUTDIR) |)\
       
    94   $(call iif,$(KEEPTEMP),,deldir | $(CONFT_TMPDIR))
       
    95 
       
    96 
       
    97 ###############################################################################
       
    98 # Interpretsis
       
    99 
       
   100 SISINST_DIR    = $(WORKDIR)/sisinst
       
   101 SISINST_SISDIR = $(call iif,$(USE_VARIANTBLD),$(VARIANT_SISDIR))
       
   102 SISINST_OUTDIR = $(call iif,$(USE_VARIANTBLD),$(VARIANT_OUTDIR),$(SISINST_DIR)/output)
       
   103 #SISINST_ZDIR   = $(SISINST_DIR)/z_drive
       
   104 SISINST_ZDIR   = $(EPOC32)/data/Z
       
   105 
       
   106 SISINST_HALINI = $(wildcard $(PRODUCT_DIR)/interpretsis.ini)
       
   107 SISINST_CONF   = -w info -z $(SISINST_ZDIR) $(if $(SISINST_HALINI),-i $(SISINST_HALINI)) -c $(SISINST_OUTDIR) -s $(SISINST_SISDIR)
       
   108 SISINST_CMD    = $(INTPRSIS_TOOL) $(SISINST_CONF)
       
   109 SISINST_PARSE  =\
       
   110   parse | \nWarning(s):\n | /^WARN:/ |\
       
   111   parse | \nError(s):\n   | /^ERR :/
       
   112 
       
   113 #CLEAN_SISINSTPRE = deldir | $(SISINST_ZDIR)
       
   114 #BUILD_SISINSTPRE =\
       
   115 #  mkdir | $(SISINST_ZDIR) |\
       
   116 #  $(foreach img,$(ROM_IMG) $(foreach rofs,1 2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),$(ROFS$(rofs)_IMG))),\
       
   117 #    cmd | $(READIMG_TOOL) -z $(SISINST_ZDIR) $(img) |)
       
   118 
       
   119 CLEAN_SISINST = deldir | "$(SISINST_DIR)" $(call iif,$(USE_VARIANTBLD),,"$(SISINST_OUTDIR)")
       
   120 BUILD_SISINST =\
       
   121   echo-q | Installing SIS |\
       
   122   mkdir  | $(SISINST_OUTDIR) |\
       
   123   cmd    | $(SISINST_CMD) | $(SISINST_PARSE)
       
   124 
       
   125 
       
   126 ###############################################################################
       
   127 # Operator Cache Tool
       
   128 
       
   129 OPC_TOOL     = $(ITOOL_DIR)/opcache_tool.py
       
   130 OPC_CONF     = -u $(OPC_URL) -e $(OPC_EXPDATE) -m $(OPC_MMAPFILE) -i $(OPC_RAWDIR) -o $(OPC_OUTDIR)/$(OPC_CACHEDIR)
       
   131 OPC_CMD      = $(PYTHON) $(OPC_TOOL) $(OPC_CONF)
       
   132 OPC_DIR      = $(WORKDIR)/opcache
       
   133 OPC_RAWDIR   = $(call iif,$(USE_VARIANTBLD),$(VARIANT_OPCDIR))
       
   134 OPC_OUTDIR   = $(call iif,$(USE_VARIANTBLD),$(VARIANT_OUTDIR),$(OPC_DIR)/output)
       
   135 OPC_CACHEDIR = cache
       
   136 OPC_MMAPFILE = $(OPC_DIR)/mimemap.dat
       
   137 
       
   138 OPC_URL      = http://www.someoperator.com/Cache_OpCache
       
   139 OPC_EXPDATE  = 3
       
   140 
       
   141 define OPC_MIMEMAP
       
   142   .bmp:   image/bmp
       
   143   .css:   text/css
       
   144   .gif:   image/gif
       
   145   .htm:   text/html
       
   146   .html:  text/html
       
   147   .ico:   image/x-icon
       
   148   .jpeg:  image/jpeg
       
   149   .jpg:   image/jpeg
       
   150   .js:    text/javascript
       
   151   .mid:   audio/mid
       
   152   .midi:  audio/midi
       
   153   .png:   image/png
       
   154   .tif:   image/tiff
       
   155   .tiff:  image/tiff
       
   156   .wbmp:  image/vnd.wap.wbmp
       
   157   .wml:   text/vnd.wap.wml
       
   158   .wmlc:  application/vnd.wap.wmlc
       
   159   .xhtml: application/xhtml+xml
       
   160 endef
       
   161 
       
   162 CLEAN_OPCACHE = del | $(OPC_MMAPFILE) | deldir | "$(OPC_DIR)" $(call iif,$(USE_VARIANTBLD),,"$(OPC_OUTDIR)")
       
   163 BUILD_OPCACHE =\
       
   164   echo-q | Creating Operator Cache content |\
       
   165   write  | $(OPC_MMAPFILE) |\
       
   166     $(call def2str,\# Generated `$(OPC_MMAPFILE)$' for Operator Cache content creation$(\n)$(\n)$(OPC_MIMEMAP)) |\
       
   167   test   | $(OPC_RAWDIR)/* |\
       
   168   mkdir  | $(OPC_OUTDIR)/$(OPC_CACHEDIR) |\
       
   169   cmd    | $(OPC_CMD)
       
   170 
       
   171 
       
   172 ###############################################################################
       
   173 # Widget Pre-installation
       
   174 
       
   175 WIDGET_WGZIP   = $(WORKDIR)/*.wgz
       
   176 WIDGET_WGZDIR  = $(EPOC32)/release/winscw/udeb/z/data/WidgetBURTemp
       
   177 WIDGET_WGZIBY  = $(E32ROMINC)/widgetbackupfiles.iby
       
   178 WIDGET_WGZPXML = Info.plist
       
   179 
       
   180 CLEAN_WGZPREINST = del | $(WIDGET_WGZIBY) | deldir | $(WIDGET_WGZDIR)
       
   181 BUILD_WGZPREINST =\
       
   182   echo-q   | Widget Pre-installation |\
       
   183   echo-q   | Unzip $(WIDGET_WGZIP) file(s) to $(WIDGET_WGZDIR), generating $(WIDGET_WGZIBY) |\
       
   184   wgunzip  | $(WIDGET_WGZIP) | $(WIDGET_WGZDIR) | $(WIDGET_WGZPXML) |\
       
   185   geniby-r | $(WIDGET_WGZIBY) | $(WIDGET_WGZDIR) | * | data="%1" "data/WidgetBURTemp/%2" | end
       
   186 
       
   187 
       
   188 ###############################################################################
       
   189 # Image Checker
       
   190 
       
   191 IMGCHK_LOG = $($(IMAGE_TYPE)_ICHKLOG)
       
   192 IMGCHK_OPT = --verbose --dep
       
   193 IMGCHK_CMD = $(IMGCHK_TOOL) $($(IMAGE_TYPE)_ICHKOPT) $($(IMAGE_TYPE)_ICHKIMG)
       
   194 
       
   195 define IMGCHK_HDRINFO
       
   196   # Image Check log for $($(IMAGE_TYPE)_TITLE) SOS image
       
   197   #
       
   198   # Filename: $(IMGCHK_LOG)
       
   199   # Command : $(IMGCHK_CMD)
       
   200 endef
       
   201 
       
   202 CLEAN_IMGCHK = del | "$(basename $(IMGCHK_LOG)).*" "imgcheck.log"
       
   203 BUILD_IMGCHK =\
       
   204   echo-q | Checking $($(IMAGE_TYPE)_TITLE) SOS image file(s) |\
       
   205   cd     | $($(IMAGE_TYPE)_DIR) |\
       
   206   write  | $(IMGCHK_LOG) | $(call def2str,$(IMGCHK_HDRINFO))\n |\
       
   207   cmdtee | $(IMGCHK_CMD) | >>$(IMGCHK_LOG) |\
       
   208   del    | imgcheck.log
       
   209 
       
   210 
       
   211 ###############################################################################
       
   212 # CheckDependency
       
   213 
       
   214 CHKDEP_TOOL     = CheckDependency.pl
       
   215 CHKDEP_CONFXML  = $(E32ROMBLD)/iad/iad_rofs_config.xml
       
   216 CHKDEP_ROFSFILE = $(E32ROMBLD)/IAD_rofsfiles.txt
       
   217 CHKDEP_OPT      = -i $(CHKDEP_CONFXML) -o $(CHKDEP_ROFSFILE)
       
   218 CHKDEP_CMD      = $(PERL) -S $(CHKDEP_TOOL) $(CHKDEP_OPT)
       
   219 
       
   220 CLEAN_CHKDEP = del | $(CHKDEP_ROFSFILE)
       
   221 BUILD_CHKDEP =\
       
   222   echo-q | Running CheckDependency tool |\
       
   223   cmd    | $(CHKDEP_CMD)
       
   224 
       
   225 
       
   226 ###############################################################################
       
   227 # Image to files; extract files from .img using Readimage tool
       
   228 
       
   229 I2FILE_DIR = $(WORKDIR)/img2file
       
   230 
       
   231 CLEAN_COREI2F = deldir | $(CORE_I2FDIR)
       
   232 BUILD_COREI2F = $(call _buildi2file,CORE,$(CORE_I2FDIR),$(ROM_IMG) $(call iif,$(USE_ROFS1),$(ROFS1_IMG)))
       
   233 
       
   234 CLEAN_VARIANTI2F = $(foreach rofs,2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),deldir | $(ROFS$(rofs)_I2FDIR) |))
       
   235 BUILD_VARIANTI2F =\
       
   236   $(foreach rofs,2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),\
       
   237     $(call _buildi2file,ROFS$(rofs),$(ROFS$(rofs)_I2FDIR),$(ROFS$(rofs)_IMG))))
       
   238 
       
   239 CLEAN_I2FILE = deldir | $(I2FILE_DIR) | $(CLEAN_COREI2F) | $(CLEAN_VARIANTI2F)
       
   240 BUILD_I2FILE =\
       
   241   $(BUILD_COREI2F) | $(BUILD_VARIANTI2F) |\
       
   242   copy | $(CORE_I2FDIR)/* | $(I2FILE_DIR) |\
       
   243   $(foreach rofs,2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),copy | $(ROFS$(rofs)_I2FDIR)/* | $(I2FILE_DIR) |))
       
   244 
       
   245 _buildi2file =\
       
   246   echo-q | Extracting files from $($1_TITLE) SOS image to $2 |\
       
   247   mkcd   | $2 |\
       
   248   $(foreach img,$3,\
       
   249     cmd | $(READIMG_TOOL) -s $(img)   |\
       
   250     cmd | $(READIMG_TOOL) -z . $(img) |)
       
   251 
       
   252 
       
   253 ###############################################################################
       
   254 # Tool info
       
   255 
       
   256 define TOOL_INFO
       
   257   $(MAKE)          | $(MAKE) -v   | GNU Make (\S+).+(built for \S+) |
       
   258   $(PERL)          | $(PERL) -v   | perl, v(.+?)$$ |
       
   259   $(CPP)           | $(CPP) -v -h | CPP version (.+?)$$ |
       
   260   $(call _grepversion,$(E32TOOLS)/imaker.cmd) |
       
   261   $(call _grepversion,$(IMAKER_TOOL)) |
       
   262   $(call _grepversion,$(IMAKER_DIR)/imaker.pm) |
       
   263   $(if $(wildcard $(IMAKER_DIR)/imaker_extension.pm),$(call _grepversion,$(IMAKER_DIR)/imaker_extension.pm) |)
       
   264   $(call _grepversion,$(IMAKER_DIR)/imaker.mk) |
       
   265   $(call _grepversion,$(IMAKER_DIR)/imaker_public.mk) |
       
   266   $(if $(wildcard $(IMAKER_DIR)/imaker_extension.mk),$(call _grepversion,$(IMAKER_DIR)/imaker_extension.mk) |)
       
   267   $(ROMBLD_TOOL)   | $(ROMBLD_TOOL)         | ROMBUILD.+? V(.+?)\s*$$  |
       
   268   $(ROFSBLD_TOOL)  | $(ROFSBLD_TOOL)        | ROFSBUILD.+? V(.+?)\s*$$ |
       
   269   $(IMGCHK_TOOL)   | $(IMGCHK_TOOL) -h      | IMGCHECK.+? V(.+?)\s*$$  |
       
   270   $(INTPRSIS_TOOL) | $(INTPRSIS_TOOL) -h    | INTERPRETSIS\s+Version\s+(.+?)\s*$$ |
       
   271   $(READIMG_TOOL)  | $(READIMG_TOOL)        | Readimage.+? V(.+?)\s*$$ |
       
   272   $(CONFT_TOOL)    | $(CONFT_TOOL) -version | ^.+?\n(.+?)\n(.+?)\n
       
   273 endef
       
   274 
       
   275 BUILD_TOOLINFO = echo-q | | toolchk | $(strip $(TOOL_INFO)) | end
       
   276 
       
   277 #==============================================================================
       
   278 
       
   279 _grepversion = $1 | $(PERL) -ne "print, exit if /%version:\s*\S+\s*%/" < $1 | %version:\s*(\S+)\s*%
       
   280 
       
   281 
       
   282 ###############################################################################
       
   283 # Targets
       
   284 
       
   285 .PHONY: checkdep opcache sisinst toolinfo wgzpreinst
       
   286 
       
   287 chkdep opcache sisinst toolinfo wgzpreinst:\
       
   288   ;@$(call IMAKER,$(call ucase,$@))
       
   289 
       
   290 
       
   291 # END OF IMAKER_TOOLS.MK