imgtools/imaker/src/imaker_variant.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 Variant image configuration
       
    15 #
       
    16 
       
    17 
       
    18 
       
    19 ###############################################################################
       
    20 # __   __        _          _     ___      _ _    _
       
    21 # \ \ / /_ _ _ _(_)__ _ _ _| |_  | _ )_  _(_) |__| |
       
    22 #  \ V / _` | '_| / _` | ' \  _| | _ \ || | | / _` |
       
    23 #   \_/\__,_|_| |_\__,_|_||_\__| |___/\_,_|_|_\__,_|
       
    24 #
       
    25 
       
    26 USE_VARIANTBLD = 0
       
    27 
       
    28 VARIANT_NAME     = $(TARGETNAME)
       
    29 VARIANT_ID       = $(TARGETID)
       
    30 VARIANT_DIR      = $(call iif,$(USE_CUSTVARIANTBLD),,$(PRODVARIANT_DIR))
       
    31 VARIANT_OUTDIR   = $(if $(filter u U,$(USE_VARIANTBLD)),$(UDA_DATADIR),$($(IMAGE_TYPE)_DIR)/variant)
       
    32 VARIANT_MKNAME   = variant.mk
       
    33 VARIANT_MK       = $(if $(VARIANT_DIR),$(wildcard $(VARIANT_DIR)/$(VARIANT_MKNAME)))
       
    34 
       
    35 VARIANT_PREFIX   = $($(IMAGE_TYPE)_PREFIX)_$(call lcase,$(IMAGE_TYPE))
       
    36 VARIANT_HBY      = $(VARIANT_PREFIX)_customervariant.hby
       
    37 VARIANT_HEADER   = $(if $(VARIANT_INCDIR),$(call includeiby,$(VARIANT_HBY)))
       
    38 VARIANT_OBY      = $(VARIANT_PREFIX)_customervariant.oby
       
    39 VARIANT_OVERRIDE = $(if $(filter 1 2,$(USE_VARIANTBLD)),1,0)
       
    40 VARIANT_OBYDATA  = data$(call iif,$(VARIANT_OVERRIDE),-override)="%1"  "%2"
       
    41 
       
    42 VARIANT_CONFML   = $(call iif,$(USE_CUSTVARIANTBLD),$(wildcard $(VARIANT_DIR)/$(CONFT_CFGNAME).confml),$(PRODVARIANT_CONFML))
       
    43 VARIANT_CONFCP   = $(call iif,$(USE_CUSTVARIANTBLD),$(if $(VARIANT_CONFML),$(CONFT_CFGNAME)),$(PRODVARIANT_CONFCP))
       
    44 VARIANT_CPDIR    = $(wildcard $(VARIANT_DIR)/content)
       
    45 VARIANT_INCDIR   = $(wildcard $(VARIANT_DIR)/include)
       
    46 VARIANT_SISDIR   = $(wildcard $(VARIANT_DIR)/sis)
       
    47 VARIANT_OPCDIR   = $(wildcard $(VARIANT_DIR)/opcache)
       
    48 VARIANT_ZIPDIR   = $(wildcard $(VARIANT_DIR)/zip)
       
    49 
       
    50 #==============================================================================
       
    51 
       
    52 CLEAN_CUSTVARIANT =\
       
    53   del | "$(VARIANT_HBY)" "$(VARIANT_OBY)" | deldir | $(VARIANT_OUTDIR) |\
       
    54   $(if $(VARIANT_CONFML),$(CLEAN_CENREP)  |)\
       
    55   $(if $(VARIANT_SISDIR),$(CLEAN_SISINST) |)\
       
    56   $(if $(VARIANT_OPCDIR),$(CLEAN_OPCACHE) |)
       
    57 
       
    58 BUILD_CUSTVARIANT =\
       
    59   echo-q | Variant target             USE_VARIANTBLD = $(call iif,$(USE_VARIANTBLD),`$(USE_VARIANTBLD)$',-) |\
       
    60   echo-q | Variant directory          VARIANT_DIR    = $(or $(filter -,$(VARIANT_DIR)),$(if $(VARIANT_DIR),`$(VARIANT_DIR)$',-)) |\
       
    61   echo-q | Variant config makefile    VARIANT_MK     = $(if $(VARIANT_MK),`$(VARIANT_MK)$',-) |\
       
    62   echo-q | Variant include directory  VARIANT_INCDIR = $(if $(VARIANT_INCDIR),`$(VARIANT_INCDIR)$',-) |\
       
    63   echo-q | Variant confml file        VARIANT_CONFML = $(if $(VARIANT_CONFML),`$(VARIANT_CONFML)$',-) |\
       
    64   echo-q | Variant CenRep configs     VARIANT_CONFCP = $(if $(VARIANT_CONFCP),`$(VARIANT_CONFCP)$',-) |\
       
    65   echo-q | Variant SIS directory      VARIANT_SISDIR = $(if $(VARIANT_SISDIR),`$(VARIANT_SISDIR)$',-) |\
       
    66   echo-q | Variant operator cache dir VARIANT_OPCDIR = $(if $(VARIANT_OPCDIR),`$(VARIANT_OPCDIR)$',-) |\
       
    67   echo-q | Variant zip content dir    VARIANT_ZIPDIR = $(if $(VARIANT_ZIPDIR),`$(VARIANT_ZIPDIR)$',-) |\
       
    68   echo-q | Variant copy content dir   VARIANT_CPDIR  = $(if $(VARIANT_CPDIR),`$(VARIANT_CPDIR)$',-)   |\
       
    69   echo-q | Variant output directory   VARIANT_OUTDIR = $(if $(VARIANT_OUTDIR),`$(VARIANT_OUTDIR)$',-) |\
       
    70   $(if $(VARIANT_DIR),,\
       
    71     error | 1 | Variable VARIANT_DIR is not set while making target $@!\n |)\
       
    72   $(if $(word 2,$(USE_VARIANTBLD))$(filter-out 0 1 2 3 4 5 6 u U,$(USE_VARIANTBLD)),\
       
    73     error | 1 | Variable USE_VARIANTBLD is incorrectly defined. Possible values are 1 - 3 (6) and u.\n |)\
       
    74   mkdir  | $(VARIANT_OUTDIR) |\
       
    75   $(if $(VARIANT_INCDIR),\
       
    76     echo-q | Generating oby(s) for Variant image creation |\
       
    77     geniby | $(VARIANT_HBY) | $(VARIANT_INCDIR) | *.hrh | \#include "%3" | end |\
       
    78     geniby | $(VARIANT_OBY) | $(VARIANT_INCDIR) | *.iby | \#include "%3" | end |)\
       
    79   $(if $(wildcard $(VARIANT_CONFML)),\
       
    80     $(BUILD_CENREP) |)\
       
    81   $(if $(VARIANT_SISDIR),\
       
    82     $(call iif,$(USE_SOSUDA),\
       
    83       geniby-r | >>$(VARIANT_OBY) | $(VARIANT_SISDIR) | *.sis* | sisfile="%1" | end,\
       
    84       $(BUILD_SISINST)) |)\
       
    85   $(if $(VARIANT_OPCDIR),\
       
    86     $(BUILD_OPCACHE) |)\
       
    87   $(if $(VARIANT_ZIPDIR),$(if $(wildcard $(VARIANT_ZIPDIR)/*),\
       
    88     echo-q | Extracting zip content directory |\
       
    89     cmd    | $(7ZIP_TOOL) x -y $(VARIANT_ZIPDIR)/* -o$(VARIANT_OUTDIR) |))\
       
    90   $(if $(VARIANT_CPDIR),\
       
    91     echo-q | Copying copy content directory |\
       
    92     copy   | $(VARIANT_CPDIR)/* | $(VARIANT_OUTDIR) |)\
       
    93   $(if $(filter u U,$(USE_VARIANTBLD)),,\
       
    94     geniby-r | >>$(VARIANT_OBY) | $(VARIANT_OUTDIR) | * | $(VARIANT_OBYDATA) | end |)\
       
    95   write | >>$(VARIANT_OBY) | |
       
    96 
       
    97 #==============================================================================
       
    98 
       
    99 variantrofs%: USE_CUSTVARIANTBLD = 1
       
   100 
       
   101 $(foreach rofs,2 3 4 5 6,\
       
   102   $(eval .PHONY: variantrofs$(rofs))\
       
   103   $(eval variantrofs$(rofs) variantrofs$(rofs)%: USE_VARIANTBLD = $(rofs))\
       
   104   $(eval variantrofs$(rofs) variantrofs$(rofs)%: rofs$(rofs)$(TARGETEXT) ;)\
       
   105 )
       
   106 
       
   107 $(call add_help,variantrofs2,t,Create an image from a variant with rofs2. Be sure to define the VARIANT_DIR.)
       
   108 $(call add_help,variantrofs3,t,Create an image from a customer variant folder. Be sure to define the VARIANT_DIR.)
       
   109 $(call add_help,variantuda,t,Create an image from a variant userdata folder. Be sure to define the VARIANT_DIR.)
       
   110 
       
   111 #==============================================================================
       
   112 
       
   113 SOS.VARIANT.STEPS = $(foreach rofs,2 3 4 5 6,$(SOS.ROFS$(rofs).STEPS))
       
   114 ALL.VARIANT.STEPS = $(SOS.VARIANT.STEPS)
       
   115 
       
   116 #==============================================================================
       
   117 # Targets
       
   118 
       
   119 .PHONY: variant variant-image variant-symbol variant-i2file
       
   120 
       
   121 variant: ;@$(call IMAKER,$$(ALL.VARIANT.STEPS))
       
   122 
       
   123 variant-image: ;@$(call IMAKER,$$(SOS.VARIANT.STEPS))
       
   124 
       
   125 variant-symbol:\
       
   126   ;@$(call IMAKER,$(foreach rofs,2 3 4 5 6,$(call iif,$(USE_ROFS$(rofs)),ROFS$(rofs)SYM)))
       
   127 
       
   128 variant-i2file: ;@$(call IMAKER,VARIANTI2F)
       
   129 
       
   130 
       
   131 # END OF IMAKER_VARIANT.MK