23 # \_/\__,_|_| |_\__,_|_||_\__| |___/\_,_|_|_\__,_| |
23 # \_/\__,_|_| |_\__,_|_||_\__| |___/\_,_|_|_\__,_| |
24 # |
24 # |
25 |
25 |
26 USE_VARIANTBLD = 0 |
26 USE_VARIANTBLD = 0 |
27 |
27 |
|
28 PRODUCT_VARDIR = $(if $(and $(call true,$(USE_CONE)),$(call true,$(IMAKER_MKRESTARTS))),$(CONE_OUTDIR),$(PRODUCT_DIR)) |
|
29 |
28 VARIANT_NAME = $(TARGETNAME) |
30 VARIANT_NAME = $(TARGETNAME) |
29 VARIANT_ID = $(TARGETID) |
31 VARIANT_ID = $(TARGETID) |
30 VARIANT_DIR = $(call iif,$(USE_CUSTVARIANTBLD),,$(PRODVARIANT_DIR)) |
32 VARIANT_DIR = $(if $(filter $(LANGPACK_PREFIX)%,$(TARGETNAME)),$(LANGPACK_DIR),$(if\ |
31 VARIANT_OUTDIR = $(if $(filter u U,$(USE_VARIANTBLD)),$(UDA_DATADIR),$($(IMAGE_TYPE)_DIR)/variant) |
33 $(filter $(CUSTVARIANT_PREFIX)%,$(TARGETNAME)),$(CUSTVARIANT_DIR),$(if\ |
|
34 $(filter emmc_% mcard_% uda_%,$(TARGETNAME)),$($(IMAGE_TYPE)_VARDIR),$(if\ |
|
35 $(filter variant%,$(TARGETNAME)),,$(PRODUCT_VARDIR))))) |
|
36 VARIANT_OUTDIR = $(if $(filter CORE ROFS%,$(IMAGE_TYPE)),$($(IMAGE_TYPE)_DIR)/variant,$($(IMAGE_TYPE)_DATADIR)) |
32 VARIANT_MKNAME = variant.mk |
37 VARIANT_MKNAME = variant.mk |
33 VARIANT_MK = $(if $(VARIANT_DIR),$(wildcard $(VARIANT_DIR)/$(VARIANT_MKNAME))) |
38 VARIANT_MK = $(if $(VARIANT_DIR),$(wildcard $(VARIANT_DIR)/$(VARIANT_MKNAME))) |
34 |
39 |
35 VARIANT_PREFIX = $($(IMAGE_TYPE)_PREFIX)_$(call lcase,$(IMAGE_TYPE)) |
40 VARIANT_HBY = $(IMAGE_PREFIX)_$(if $(filter CORE ROFS%,$(IMAGE_TYPE)),variant,datadrive).hby |
36 VARIANT_HBY = $(VARIANT_PREFIX)_customervariant.hby |
|
37 VARIANT_HEADER = $(if $(VARIANT_INCDIR),$(call includeiby,$(VARIANT_HBY))) |
41 VARIANT_HEADER = $(if $(VARIANT_INCDIR),$(call includeiby,$(VARIANT_HBY))) |
38 VARIANT_OBY = $(VARIANT_PREFIX)_customervariant.oby |
42 VARIANT_OBY = $(basename $(VARIANT_HBY)).oby |
39 VARIANT_OVERRIDE = $(if $(filter 1 2,$(USE_VARIANTBLD)),1,0) |
43 VARIANT_OVERRIDE = $(if $(filter CORE ROFS%,$(IMAGE_TYPE)),OVERRIDE_REPLACE/ADD) |
40 VARIANT_OBYDATA = data$(call iif,$(VARIANT_OVERRIDE),-override)="%1" "%2" |
44 VARIANT_OBYDATA = data$(call iif,$(VARIANT_OVERRIDE),-override)="%1" "%2"$(if $(filter CORE ROFS%,$(IMAGE_TYPE)),, %4) |
41 |
45 |
42 VARIANT_CONFML = $(call iif,$(USE_CUSTVARIANTBLD),$(wildcard $(VARIANT_DIR)/$(CONFT_CFGNAME).confml),$(PRODVARIANT_CONFML)) |
46 VARIANT_CPDIR = $(if $(wildcard $(VARIANT_DIR)/content/*),$(VARIANT_DIR)/content) |
43 VARIANT_CONFCP = $(call iif,$(USE_CUSTVARIANTBLD),$(if $(VARIANT_CONFML),$(CONFT_CFGNAME)),$(PRODVARIANT_CONFCP)) |
47 VARIANT_INCDIR = $(if $(wildcard $(VARIANT_DIR)/include/*),$(VARIANT_DIR)/include) |
44 VARIANT_CPDIR = $(wildcard $(VARIANT_DIR)/content) |
48 VARIANT_SISDIR = $(if $(wildcard $(VARIANT_DIR)/sis/*),$(VARIANT_DIR)/sis) |
45 VARIANT_INCDIR = $(wildcard $(VARIANT_DIR)/include) |
49 VARIANT_OPCDIR = $(if $(wildcard $(VARIANT_DIR)/opcache/*),$(VARIANT_DIR)/opcache) |
46 VARIANT_SISDIR = $(wildcard $(VARIANT_DIR)/sis) |
50 VARIANT_WGZDIR = $(if $(wildcard $(VARIANT_DIR)/widget/*),$(VARIANT_DIR)/widget) |
47 VARIANT_OPCDIR = $(wildcard $(VARIANT_DIR)/opcache) |
51 VARIANT_ZIPDIR = $(if $(wildcard $(VARIANT_DIR)/zip/*),$(VARIANT_DIR)/zip) |
48 VARIANT_ZIPDIR = $(wildcard $(VARIANT_DIR)/zip) |
|
49 |
52 |
50 #============================================================================== |
53 #============================================================================== |
51 |
54 |
52 CLEAN_CUSTVARIANT =\ |
55 CLEAN_VARIANT =\ |
53 del | "$(VARIANT_HBY)" "$(VARIANT_OBY)" | deldir | $(VARIANT_OUTDIR) |\ |
56 del | "$(VARIANT_HBY)" "$(VARIANT_OBY)" | deldir | "$(VARIANT_OUTDIR)" |\ |
54 $(if $(VARIANT_CONFML),$(CLEAN_CENREP) |)\ |
57 $(CLEAN_SISINST) | $(CLEAN_OPCACHE) | $(CLEAN_WIDGET) |
55 $(if $(VARIANT_SISDIR),$(CLEAN_SISINST) |)\ |
|
56 $(if $(VARIANT_OPCDIR),$(CLEAN_OPCACHE) |) |
|
57 |
58 |
58 BUILD_CUSTVARIANT =\ |
59 BUILD_VARIANT =\ |
59 echo-q | Variant target USE_VARIANTBLD = $(call iif,$(USE_VARIANTBLD),`$(USE_VARIANTBLD)$',-) |\ |
60 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 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 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 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 SIS conf SISINST_INI = $(if $(SISINST_INI),`$(SISINST_INI)',-) |\ |
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)',-) |\ |
65 echo-q | Variant SIS directory VARIANT_SISDIR = $(if $(VARIANT_SISDIR),`$(VARIANT_SISDIR)$',-) |\ |
66 echo-q | Variant operator cache conf OPC_INI = $(if $(OPC_INI),`$(OPC_INI)',-) |\ |
66 echo-q | Variant operator cache dir VARIANT_OPCDIR = $(if $(VARIANT_OPCDIR),`$(VARIANT_OPCDIR)$',-) |\ |
67 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 widget preinst conf WIDGET_INI = $(if $(WIDGET_INI),`$(WIDGET_INI)',-) |\ |
68 echo-q | Variant copy content dir VARIANT_CPDIR = $(if $(VARIANT_CPDIR),`$(VARIANT_CPDIR)$',-) |\ |
69 echo-q | Variant widget preinst dir VARIANT_WGZDIR = $(if $(VARIANT_WGZDIR),`$(VARIANT_WGZDIR)',-) |\ |
69 echo-q | Variant output directory VARIANT_OUTDIR = $(if $(VARIANT_OUTDIR),`$(VARIANT_OUTDIR)$',-) |\ |
70 echo-q | Variant zip content dir VARIANT_ZIPDIR = $(if $(VARIANT_ZIPDIR),`$(VARIANT_ZIPDIR)',-) |\ |
|
71 echo-q | Variant copy content dir VARIANT_CPDIR = $(if $(VARIANT_CPDIR),`$(VARIANT_CPDIR)',-) |\ |
|
72 echo-q | Variant output directory VARIANT_OUTDIR = $(if $(VARIANT_OUTDIR),`$(VARIANT_OUTDIR)',-) |\ |
70 $(if $(VARIANT_DIR),,\ |
73 $(if $(VARIANT_DIR),,\ |
71 error | 1 | Variable VARIANT_DIR is not set while making target $@!\n |)\ |
74 error | 1 | Variable VARIANT_DIR is not set while making target $(TARGETNAME). |)\ |
72 $(if $(word 2,$(USE_VARIANTBLD))$(filter-out 0 1 2 3 4 5 6 u U,$(USE_VARIANTBLD)),\ |
75 $(if $(wildcard $(subst \,/,$(VARIANT_DIR))),,\ |
73 error | 1 | Variable USE_VARIANTBLD is incorrectly defined. Possible values are 1 - 3 (6) and u.\n |)\ |
76 error | 1 | Variable VARIANT_DIR does not point to an existing directory ($(VARIANT_DIR)). |)\ |
74 mkdir | $(VARIANT_OUTDIR) |\ |
77 $(if $(word 2,$(USE_VARIANTBLD))$(filter-out 0 1 2 3 4 5 6 e E m M u U,$(USE_VARIANTBLD)),\ |
|
78 error | 1 | Variable USE_VARIANTBLD is incorrectly defined. Possible values are 1 - 6$(,) e$(,) m and u. |)\ |
|
79 mkdir | "$(VARIANT_OUTDIR)" |\ |
75 $(if $(VARIANT_INCDIR),\ |
80 $(if $(VARIANT_INCDIR),\ |
76 echo-q | Generating oby(s) for Variant image creation |\ |
81 echo-q | Generating oby(s) for Variant image creation |\ |
77 geniby | $(VARIANT_HBY) | $(VARIANT_INCDIR) | *.hrh | \#include "%3" | end |\ |
82 geniby | $(VARIANT_HBY) | $(VARIANT_INCDIR) |\ |
|
83 __header__ | define _IMAGE_VARINCDIR $(call quote,$(VARIANT_INCDIR)) | *.hrh | \#include "%3" | end |\ |
78 geniby | $(VARIANT_OBY) | $(VARIANT_INCDIR) | *.iby | \#include "%3" | end |)\ |
84 geniby | $(VARIANT_OBY) | $(VARIANT_INCDIR) | *.iby | \#include "%3" | end |)\ |
79 $(if $(wildcard $(VARIANT_CONFML)),\ |
85 $(if $(or $(SISINST_INI),$(VARIANT_SISDIR)),\ |
80 $(BUILD_CENREP) |)\ |
86 $(BUILD_SISINST) |)\ |
81 $(if $(VARIANT_SISDIR),\ |
87 $(if $(or $(OPC_INI),$(VARIANT_OPCDIR)),\ |
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) |)\ |
88 $(BUILD_OPCACHE) |)\ |
87 $(if $(VARIANT_ZIPDIR),$(if $(wildcard $(VARIANT_ZIPDIR)/*),\ |
89 $(if $(or $(WIDGET_INI),$(VARIANT_WGZDIR)),\ |
|
90 $(BUILD_WIDGET) |)\ |
|
91 $(if $(VARIANT_ZIPDIR),\ |
88 echo-q | Extracting zip content directory |\ |
92 echo-q | Extracting zip content directory |\ |
89 cmd | $(7ZIP_TOOL) x -y $(VARIANT_ZIPDIR)/* -o$(VARIANT_OUTDIR) |))\ |
93 cmd | $(7ZIP_TOOL) x -y $(VARIANT_ZIPDIR)/* -o$(VARIANT_OUTDIR) |)\ |
90 $(if $(VARIANT_CPDIR),\ |
94 $(if $(VARIANT_CPDIR),\ |
91 echo-q | Copying copy content directory |\ |
95 echo-q | Copying copy content directory |\ |
92 copy | $(VARIANT_CPDIR)/* | $(VARIANT_OUTDIR) |)\ |
96 copydir | "$(VARIANT_CPDIR)" | $(VARIANT_OUTDIR) |)\ |
93 $(if $(filter u U,$(USE_VARIANTBLD)),,\ |
97 $(call iif,$(filter CORE ROFS%,$(IMAGE_TYPE))$(USE_SOSUDA),\ |
94 geniby-r | >>$(VARIANT_OBY) | $(VARIANT_OUTDIR) | * | $(VARIANT_OBYDATA) | end |)\ |
98 geniby-r | >>$(VARIANT_OBY) | $(VARIANT_OUTDIR) |\ |
95 write | >>$(VARIANT_OBY) | | |
99 $(call iif,$(VARIANT_OVERRIDE),__header__ | $(VARIANT_OVERRIDE) |)\ |
|
100 * | $(VARIANT_OBYDATA) |\ |
|
101 $(call iif,$(VARIANT_OVERRIDE),__footer__ | OVERRIDE_END |) end) |
96 |
102 |
97 #============================================================================== |
103 # geniby-dr | >>$(VARIANT_OBY) | $(VARIANT_OUTDIR) | * | dir="%2" | end |
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 |
104 |
130 |
105 |
131 # END OF IMAKER_VARIANT.MK |
106 # END OF IMAKER_VARIANT.MK |