imgtools/imaker/src/imaker_image.mk
changeset 607 378360dbbdba
parent 596 9f25be3da657
--- a/imgtools/imaker/src/imaker_image.mk	Wed Jun 23 17:27:59 2010 +0800
+++ b/imgtools/imaker/src/imaker_image.mk	Wed Jun 30 11:35:58 2010 +0800
@@ -17,31 +17,36 @@
 
 
 USE_FEATVAR    = $(call select,$(word 1,$(getsbvrominc)),invalid,0,1)
-USE_FOTA       = 0
 USE_IMGCHK     = 0
-USE_IINTPRSIS  = 0
-USE_IREADIMG   = 0
-USE_IROMBLD    = 0
-USE_OVERRIDE   = 1
+USE_NOROMHDR   = 0
+USE_QTLOCLZTN  = 0
 USE_ROFS       = 1,2,3
 USE_ROFSFILE   = $(call iif,$(USE_PAGING),1,0)
 USE_ROMFILE    = 1
+USE_SMR        = 0
 USE_SYMGEN     = 0
 USE_UDEB       = 0
-USE_VERGEN     = 0
 
-$(foreach rofs,1 2 3 4 5 6,\
-  $(eval USE_ROFS$(rofs) = $$(if $$(findstring $(rofs),$$(filter-out :%,$$(subst :, :,$$(subst $$(,), ,$$(USE_ROFS))))),1,0)))
+# Temporary
+USE_BLRWORKDIR = 0
 
 #==============================================================================
 
 TYPE = rnd
 
-BUILD_INFOMK = image_conf_buildinfo.mk
-BUILD_NAMEMK = image_conf_naming.mk
+MAJOR_VERSION = 001
+MINOR_VERSION = 000
+SW_VERSION    = $(MAJOR_VERSION).$(MINOR_VERSION)
+SW_TYPEINFO   = $(call select,$(TYPE),rnd,RD)
+
+BUILD_INFOMK = $(call findfile,image_conf_buildinfo.mk,,1)
+BUILD_NAMEMK = $(call findfile,image_conf_naming.mk,,1)
 BUILD_YEAR   = $(YEAR)
+BUILD_MONTH  = $(MONTH)
 BUILD_WEEK   = $(WEEK)
-BUILD_NUMBER = xx
+BUILD_DAY    = $(DAY)
+BUILD_ID     = 001
+BUILD_NUMBER = 001
 
 COREPLAT_NAME    =
 COREPLAT_DIR     = $(CONFIGROOT)/$(COREPLAT_NAME)
@@ -49,24 +54,31 @@
 PLATFORM_NAME    = $(subst .,,$(COREPLAT_VERSION)$(S60_VERSION))
 PLATFORM_DIR     = $(CONFIGROOT)/$(PLATFORM_NAME)
 PRODUCT_MSTNAME  =
+PRODUCT_MSTDIR   = $(if $(PRODUCT_MSTNAME),$(PLATFORM_DIR)/$(PRODUCT_MSTNAME))
 PRODUCT_NAME     =
 PRODUCT_MANUFACT = Nokia
 PRODUCT_MODEL    = N00
 PRODUCT_TYPE     =
 PRODUCT_REVISION = 01
-PRODUCT_DIR      = $(PLATFORM_DIR)/$(if $(PRODUCT_MSTNAME),$(PRODUCT_MSTNAME)/)$(PRODUCT_NAME)
+PRODUCT_DIR      = $(if $(PRODUCT_NAME),$(PLATFORM_DIR)/$(if $(PRODUCT_MSTNAME),$(PRODUCT_MSTNAME)/)$(PRODUCT_NAME))
 
 FEATURE_VARIANT = $(PRODUCT_NAME)
 FEATVAR_IDIR    = $(call getrominc)
+FEATVAR_HRH     = $(call findfile,feature_settings.hrh)
 
-LABEL      =
-NAME       = $(PRODUCT_NAME)$(LABEL)
-WORKDIR    = $(if $(PRODUCT_NAME),$(E32ROMBLD)/$(PRODUCT_NAME),$(CURDIR))
-WORKPREFIX = $(WORKDIR)/$(NAME)
-WORKNAME   = $(WORKPREFIX)
+LABEL   =
+NAME    = $(or $(PRODUCT_NAME),imaker)$(LABEL)
+WORKDIR = $(if $(PRODUCT_NAME),$(E32ROMBLD)/$(PRODUCT_NAME),$(CURDIR))
 
-IMAGE_HBY  = <data_caging_paths_for_iby.hrh> <Variant\Header.iby>
-IMAGE_TYPE =
+IMAGE_TYPE    =
+IMAGE_ID      = $(or $(subst CORE,1,$(subst ROFS,,$(filter CORE ROFS%,$(IMAGE_TYPE)))),\
+  $(call lcase,$(call substr,1,1,$(filter EMMC MCARD UDA,$(IMAGE_TYPE)))))
+IMAGE_PREFIX  = $($(IMAGE_TYPE)_PREFIX)_$(call lcase,$(IMAGE_TYPE))
+IMAGE_HBY     = <data_caging_paths_for_iby.hrh> <variant/header.iby>
+IMAGE_VERSDIR = RESOURCE_FILES_DIR\versions
+
+IMAGE_ORIDEFILES =
+IMAGE_ORIDECONF  =
 
 TRACE_IDIR     = $(addsuffix /traces,$(FEATVAR_IDIR))
 TRACE_PREFIX   =
@@ -75,72 +87,63 @@
 
 OVERRIDE_CONF = OVERRIDE_REPLACE/WARN #OVERRIDE_REPLACE/ADD, OVERRIDE_REPLACE/SKIP, OVERRIDE_SKIP/ADD
 
-GENIBY_FILEPAT = *.dll *.exe *.agt *.csy *.fsy *.tsy *.drv *.nif *.pgn *.prt
+#GENIBY_FILEPAT = *.dll *.exe *.agt *.csy *.fsy *.tsy *.drv *.nif *.pgn *.prt
 
 ARM_VERSION = ARMV5
-SOS_VERSION = #9.3, 9.4, 9.5
-S60_VERSION = #3.2, 5.0
-
-ROFS_MAXSIZE = 0x10000000
-
-CPPFILE_LIST =
-MKFILE_LIST  = $(call findfile,$(BUILD_INFOMK) $(BUILD_NAMEMK) $(LANGPACK_SYSLANGMK),$(FEATVAR_IDIR)) | $(VARIANT_MK)
-
+SOS_VERSION = #9.5
+S60_VERSION =
 
-###############################################################################
-#
+CPPFILE_FILTER = FF_WDP_\S+|SYMBIAN_\S+
+CPPFILE_LIST   = $(if $(FEATURE_VARIANT),$(FEATVAR_HRH))
 
-SOS.IMAGE.STEPS =\
-  $(filter-out %POST,$(SOS.CORE.STEPS) $(SOS.VARIANT.STEPS))\
-  $(filter %POST,$(SOS.CORE.STEPS) $(SOS.VARIANT.STEPS))
-
-ALL.IMAGE.STEPS = $(SOS.IMAGE.STEPS)
-
-CLEAN_WORKAREA  = del | $(WORKDIR)/* | deldir | $(WORKDIR)/*
-ALL.CLEAN.STEPS = $(ALL.IMAGE.STEPS) WORKAREA
+TARGET_PRODUCT =
+TARGET_DEFAULT = all
 
 
 ###############################################################################
 # Internal macros and definitions
 
-getrominc = $(if $(call true,$(USE_FEATVAR)),$(getsbvrominc),$(CONFIGROOT) $(E32ROM))
+getrominc =\
+  $(if $(call true,$(USE_FEATVAR)),$(getsbvrominc),$(if $(word 5,$(__i_getrominc)),$(call restwords,5,$(__i_getrominc))\
+    ,$(PRODUCT_DIR) $(PRODUCT_MSTDIR) $(CONFIGROOT)) $(E32ROM) $(E32ROMINC) $(E32INC)/oem $(E32INC))
+
+#    ,$(PRODUCT_DIR) $(PRODUCT_MSTDIR) $(CONFIGROOT)) $(E32INC)/config $(E32ROM) $(E32ROMINC) $(E32INC)/internal $(E32INC))
 
 getsbvrominc =\
-  $(if $(call equal,$(__i_featvar),$(FEATURE_VARIANT)),,$(eval __i_featvar := $(FEATURE_VARIANT))\
-    $(eval __i_getrominc := $(shell $(PERL) -x $(IMAKER_TOOL) --incdir $(__i_featvar))))$(__i_getrominc)
+  $(if $(and $(FEATURE_VARIANT),$(call equal,$(__i_featvar),$(FEATURE_VARIANT))),,$(eval __i_featvar := $(FEATURE_VARIANT))\
+    $(eval __i_getrominc := $(if $(__i_featvar),$(shell $(PERL) -x $(IMAKER_TOOL) --incdir $(__i_featvar)),invalid)))$(__i_getrominc)
 
-includeiby = $(call peval,\
+includeiby = $(if $(strip $1),$(call peval,\
   my @files = ();\
   while ($(call pquote,$1) =~ /(?:([1-6]):)?(?:<(.+?)>|"+(.+?)"+|(\S+))/g) {\
     my $$rom = (defined($$1) ? $$1 : q());\
-    push(@files, ($$rom ? q(ROM_IMAGE[).$$rom.q(] {\\\n) : q()) . q(\#include ).\
-      (defined($$2) ? qq(<$$2>) : q(").GetRelFname(defined($$3) ? $$3 : $$4, $(call pquote,$2)).q(")) . ($$rom ? q(\\\n}) : q()))\
+    push(@files, ($$rom ? q(ROM_IMAGE[).$$rom.q(] {\n) : q()) . q(\#include ).\
+      (defined($$2) ? qq(<$$2>) : q(").GetAbsFname(defined($$3) ? $$3 : $$4).q(")) . ($$rom ? q(\n}) : q()))\
   }\
-  return(join(q(\\\n), @files)))
+  return(join(q(), map(q(\n) . $$_, @files)))))
 
 define BLDROM_HDRINFO
-  // Generated master oby for $($(IMAGE_TYPE)_TITLE) image creation
+  // Generated master oby for $($1_TITLE) image creation
   //
-  // Filename: $($(IMAGE_TYPE)_MSTOBY)
-  // Work dir: $(call peval,GetAbsDirname(q(.)))
-  // Command : $(BLDROM_CMD)
+  // Filename: $($1_MSTOBY)
+  // Command : $(call BLDROM_CMD,$1)
 endef
 
 define BLDROM_PLUGINFO
-  // Buildrom plugins
-  //
-  $(call iif,$(USE_OVERRIDE),
-    externaltool=override:$($(IMAGE_TYPE)_PLUGINLOG);$(if $(filter debug 127,$(VERBOSE)),debug,0)
-    $(OVERRIDE_CONF))
-  externaltool=obyparse:$($(IMAGE_TYPE)_PLUGINLOG);$(if $(filter debug 127,$(VERBOSE)),debug,0)
-  $(call iif,$(call select,$(IMAGE_TYPE),CORE,$(USE_ROFS1)),
+  /* Buildrom plugins
+  */
+  externaltool=override:-i$1;-l$($1_PLUGINLOG)$(if $(filter debug 127,$(VERBOSE)),;-ddebug)
+  $(OVERRIDE_CONF)
+  externaltool=obyparse:-i$1;-l$($1_PLUGINLOG);-w$($1_DIR)$(if $(filter debug 127,$(VERBOSE)),;-ddebug);-f$(FEATURE_VARIANT)
+  externaltool=stubsischeck:-i$1;-l$($1_PLUGINLOG)$(if $(filter debug 127,$(VERBOSE)),;-ddebug)
+  $(call iif,$(if $(filter CORE,$1),$(USE_ROFS1)),
     $(call iif,$(USE_ROMFILE),
       OBYPARSE_ROM $(CORE_ROMFILE))
     $(call iif,$(USE_ROFSFILE),
       OBYPARSE_ROFS1 $(CORE_ROFSFILE))
   )
   $(call iif,$(USE_UDEB),
-    OBYPARSE_UDEB $(call select,$(USE_UDEB),full,*,$($(IMAGE_TYPE)_UDEBFILE)))
+    OBYPARSE_UDEB $(call select,$(USE_UDEB),full,*,$($1_UDEBFILE)))
 endef
 
 getgenfiles = $(if $1,\
@@ -148,54 +151,60 @@
   $(if $(__i_cmd),"$(call getelem,2,$1)")\
   $(call getgenfiles,$(call restelems,$(if $(filter geniby%,$(__i_cmd)),7,$(if $(filter write%,$(__i_cmd)),4,2)),$1)))
 
-# TEMPORARY
-_buildoby = $(if $1,\
-  $(eval __i_elem1 := $(call getelem,1,$1))\
-  $(if $(filter geniby%,$(call lcase,$(__i_elem1))),$1,\
-    geniby | $(__i_elem1) | $(call getelem,2,$1) | $(call getelem,3,$1) | \#include "%3" | end |\
-    $(call _buildoby,$(call restelems,4,$1))))
-# TEMPORARY
-
 #==============================================================================
 
-BLDROM_CMD = $(BLDROM_TOOL) $(filter-out --D% -U%,$(BLR.$(IMAGE_TYPE).OPT)) $(BLR.$(IMAGE_TYPE).IDIR) $($(IMAGE_TYPE)_MSTOBY)
+BLDROM_CMD = $(BLDROM_TOOL)\
+  $(filter-out --D% -U% $(filter-out $(BLDROM_CMDDOPT),$(filter -D%,$(BLR.$1.OPT))),$(BLR.$1.OPT))\
+  $(BLR.$1.IDIR) $(subst \,/,$($1_MSTOBY))
+
+BLDROM_CMDDOPT = -DFEATUREVARIANT=% -D_FULL_DEBUG -D_PLAT=%
 
 CLEAN_BLDROM =\
-  del | "$($(IMAGE_TYPE)_PREFIX).*" "$($(IMAGE_TYPE)_DIR)/tmp?.oby" "$($(IMAGE_TYPE)_DIR)/ecom*.s??" "$($(IMAGE_TYPE)_PLUGINLOG)" |\
-  $(BLR.$(IMAGE_TYPE).CLEAN)
+  del | $(foreach file,dir *.img *.inc *.log *.oby *.symbol,"$($1_PREFIX).$(file)")\
+    $(foreach file,ecom*.s?? features.dat loglinux.oby logwin.oby tmp?.oby,"$($1_DIR)/$(file)")\
+    "$($1_PLUGINLOG)" |\
+  $(BLR.$1.CLEAN)
 
 BUILD_BLDROM =\
-  $(if $(BLR.$(IMAGE_TYPE).BUILD),$(BLR.$(IMAGE_TYPE).BUILD),\
-    echo-q | Creating $($(IMAGE_TYPE)_TITLE) SOS image |\
-    cd     | $($(IMAGE_TYPE)_DIR) |\
-    cmd    | $(strip $(BLDROM_CMD)) | $(BLDROM_PARSE) |\
-    copy   | tmp1.oby | $($(IMAGE_TYPE)_PREFIX).tmp1.oby |\
-    $(call iif,$(KEEPTEMP),,del | "tmp?.oby" "$($(IMAGE_TYPE)_PREFIX).dummy*" |)\
-    $(BLR.$(IMAGE_TYPE).POST))
+  $(or $(BLR.$1.BUILD),\
+    echo-q | Creating $($1_TITLE) SOS $(if $(filter -noimage,$(BLR.$1.OPT)),oby,image) |\
+    $(call iif,$(USE_BLRWORKDIR),,cd | "$($1_DIR)" |)\
+    cmd    | $(strip $(call BLDROM_CMD,$1)) | $(BLDROM_PARSE) |\
+    move   | "$($1_DIR)/tmp1.oby" | $($1_PREFIX).tmp1.oby |\
+    $(call iif,$(KEEPTEMP),,del | "$($1_DIR)/tmp?.oby" "$($1_PREFIX).dummy*" |)\
+    $(BLR.$1.POST))
 
-CLEAN_MAKSYMROFS = del | $($(IMAGE_TYPE)_SYM)
-BUILD_MAKSYMROFS =\
-  echo-q | Creating $($(IMAGE_TYPE)_TITLE) symbol file |\
-  cmd    | $(MAKSYMROFS_TOOL) $(call pathconv,$($(IMAGE_TYPE)_LOG) $($(IMAGE_TYPE)_SYM))
+
+###############################################################################
+# Steps
+
+IMAGE_STEPS = core $(VARIANT_STEPS)
+
+VARIANT_STEPS = $(call iif,$(USE_ROFS2),langpack_$(or $(TARGETID),01))\
+  $(foreach rofs,3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),rofs$(rofs)))
 
 
 ###############################################################################
 # Targets
 
-.PHONY:\
-  all flash flash-all image image-all\
-  i2file
+.PHONY: default all flash image variant #i2file variant-i2file
+
+default default-%:\
+  ;@$(call IMAKER,$$(if $$(PRODUCT_NAME),,$$(TARGET_PRODUCT)) $$(TARGET_DEFAULT))
 
-all flash-all image-all: USE_SYMGEN = 1
-all flash flash-all    : ;@$(call IMAKER,$$(ALL.IMAGE.STEPS))
+all  : ;@$(call IMAKER,flash-all)
+image: ;@$(call IMAKER,flash-image)
+
+flash flash-% image-%: ;@$(call IMAKER,$$(IMAGE_STEPS))
 
-image image-all: ;@$(call IMAKER,$$(SOS.IMAGE.STEPS))
+variant variant_% variant-%: ;@$(call IMAKER,$$(VARIANT_STEPS))
 
-i2file: ;@$(call IMAKER,$(call ucase,$@))
+#i2file        : ;@$(call IMAKER,$(call ucase,$@))
+#variant-i2file: ;@$(call IMAKER,VARIANTI2F)
 
 #==============================================================================
 
-include $(addprefix $(IMAKER_DIR)/imaker_,$(addsuffix .mk,core odp rofs2 rofs3 rofs4 uda variant))
+$(call includechk,$(addprefix $(IMAKER_DIR)/imaker_,fat.mk odp.mk rofs.mk smr.mk core.mk variant.mk))
 
 
 # END OF IMAKER_IMAGE.MK