MTK resgen编译分析

MTK命令分析之resgen

以下是命令resgen的源码分析:

resgen:
ifeq ($(strip $(call Upper,$(LEVEL))),VENDOR)
 @if exist $(MMIDIR)/VendorApp/DevResource/ResGenerator.bat /
  ($(MMIDIR)/VendorApp/DevResource/ResGenerator.bat -t)
else
# 生成custom_option.txt文件
 @if exist $(MMIDIR)/customer /
  (@if /I $(RUN_RESGEN) EQU TRUE /
   (echo CUSTOM_OPTION = $(foreach def,$(BOARD_VER) $(PLATFORM) $(LCD_MODULE) $(EXT_CAM_MODULE) $(CMOS_SENSOR),-D "$(def)") /> $(MMIDIR)/customer/resGenerator/custom_option.txt) /
  )

 @tools/strcmpex.exe TRUE TRUE e make/~cus_opt.tmp $(foreach def,$(sort $(COM_DEFS)),-D /"$(def)/")
 @if exist $(MMIDIR)/customer /
  (@if /I $(RUN_RESGEN) EQU TRUE /
   (type make/~cus_opt.tmp >> $(MMIDIR)/customer/resGenerator/custom_option.txt) /
  )

 @tools/strcmpex.exe TRUE TRUE e make/~tgt_opt.tmp $(foreach def,$(COM_DEFS) $(LCD_MODULE),/D /"$(def)/")
 @if exist $(MMIDIR)/customer /
  (@if /I $(RUN_RESGEN) EQU TRUE /
   (@del $(MMIDIR)/mmi/TargetOption.txt) & /
   (copy /Y make/~tgt_opt.tmp $(MMIDIR)/MMI/TargetOption.txt) /
  )

 @tools/strcmpex.exe TRUE TRUE e make/~inc.tmp $(foreach inc,$(COMMINCDIRS),$(inc))
 @if exist $(MMIDIR)/customer /
  (@if /I $(RUN_RESGEN) EQU TRUE /
   (type make/~inc.tmp > $(MMIDIR)/customer/resGenerator/custom_include.tmp) /
  )


ifdef OPTR_SPEC
# FALSE
  ifneq ($(strip $(OPTR_SPEC)),NONE)
 @if exist $(MMIDIR)/customer/replace_project_name.pl /
  (@if exist $(OPTR_PATH)/ResGenerator_OP.tmp /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(OPTR_PATH)/ResGenerator_OP.tmp {OP_NAME} $(strip $(word 1,$(subst _, ,$(OPTR_SPEC)))) $(OPTR_PATH)/ResGenerator_OP.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(OPTR_PATH)/ResGenerator_OP.bat {VER_NUM} $(strip $(word 2,$(subst _, ,$(OPTR_SPEC)))) $(OPTR_PATH)/ResGenerator_OP.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(OPTR_PATH)/ResGenerator_OP.bat {SEG_NAME} $(strip $(word 3,$(subst _, ,$(OPTR_SPEC)))) $(OPTR_PATH)/ResGenerator_OP.bat)  /
  ) & /
  (@if exist $(OPTR_PATH)/operator_CustResDef.tmp /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(OPTR_PATH)/operator_CustResDef.tmp {OP_NAME} $(strip $(word 1,$(subst _, ,$(OPTR_SPEC)))) $(OPTR_PATH)/operator_CustResDef.h) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(OPTR_PATH)/operator_CustResDef.h {VER_NUM} $(strip $(word 2,$(subst _, ,$(OPTR_SPEC)))) $(OPTR_PATH)/operator_CustResDef.h) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(OPTR_PATH)/operator_CustResDef.h {SEG_NAME} $(strip $(word 3,$(subst _, ,$(OPTR_SPEC)))) $(OPTR_PATH)/operator_CustResDef.h) )
  endif
endif
# TRUE
# 生成文件custom_include.txt
# 生成文件
GlobalTargetPathDef
# 将参数一表示的文件中的参数二替换为参数三,保存为文件参数四
ifeq ($(strip $(NEED_COPY_MMIFEATURE)),CUSTOMER_MMI)
 @if exist $(MMIDIR)/customer /
  (@if /I $(RUN_RESGEN) EQU TRUE /
   (@perl -e "open F,'<$(MMIDIR)/customer/resGenerator/custom_include.tmp';my $$i=join('',);close F;$$i =~s//s+/ /gs;$$i =~ s/(/S+)/-I /"..//..//..//$$1/"/gs;print /"CUSTOM_INC = $$i/";" > $(MMIDIR)/customer/resGenerator/custom_include.txt) & /
   (@perl -e "open F,'<$(MMIDIR)/customer/resGenerator/custom_include.tmp';my $$i=join('',);close F;$$i =~s//s+/ /gs;$$i =~ s/(/S+)///I /"..//..//$$1/"/n/gs;print /"$$i/";" > $(MMIDIR)/MMI/GlobalTargetPathDef) & /
   (@if exist $(MMIDIR)/customer/replace_project_name.pl /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.tmp XXX $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.tmp XXX $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/ResGenerator.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.tmp XXX $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/remakeResource.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/UpdateSkin.tmp XXX $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/UpdateSkin.bat) & /
     (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.bat YYY $(patsubst %_MMI,%,$(CUSTOMER)) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
     (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.bat YYY $(patsubst %_MMI,%,$(CUSTOMER)) $(MMIDIR)/customer/ResGenerator.bat) & /
     (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.bat YYY $(patsubst %_MMI,%,$(CUSTOMER)) $(MMIDIR)/customer/remakeResource.bat) & /
     (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/UpdateSkin.bat YYY $(patsubst %_MMI,%,$(CUSTOMER)) $(MMIDIR)/customer/UpdateSkin.bat) /
   ) /
  )
 @if exist $(MMIDIR)/customer /
  (@if /I $(RUN_RESGEN) EQU TRUE /
   (@if exist $(MMIDIR)/customer/replace_project_name.pl /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.bat SSS $(call Upper,$(strip $(OPTR_SPEC))) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.bat MMM $(call Upper,$(strip $(MAIN_LCD_SIZE))) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.bat PPP $(strip $(OPTR_PATH)) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.bat QQQ $(call Upper,$(strip $(TOUCH_PANEL_SUPPORT))) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.bat SSS $(call Upper,$(strip $(OPTR_SPEC))) $(MMIDIR)/customer/ResGenerator.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.bat MMM $(call Upper,$(strip $(MAIN_LCD_SIZE))) $(MMIDIR)/customer/ResGenerator.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.bat PPP $(strip $(OPTR_PATH)) $(MMIDIR)/customer/ResGenerator.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.bat QQQ $(call Upper,$(strip $(TOUCH_PANEL_SUPPORT))) $(MMIDIR)/customer/ResGenerator.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.bat SSS $(call Upper,$(strip $(OPTR_SPEC))) $(MMIDIR)/customer/remakeResource.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.bat MMM $(call Upper,$(strip $(MAIN_LCD_SIZE))) $(MMIDIR)/customer/remakeResource.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.bat PPP $(strip $(OPTR_PATH)) $(MMIDIR)/customer/remakeResource.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.bat QQQ $(call Upper,$(strip $(TOUCH_PANEL_SUPPORT))) $(MMIDIR)/customer/remakeResource.bat) /
   ) & /
   (@del $(MMIDIR)/customer/resGenerator/custom_include.tmp) & /
   ($(MMIDIR)/customer/ResGenerator_HW.bat $(MMI_VERSION) $(CUSTOMER)) /
  )
else
 @if exist $(MMIDIR)/customer /
  (@if /I $(RUN_RESGEN) EQU TRUE /
   (@perl -e "open F,'<$(MMIDIR)/customer/resGenerator/custom_include.tmp';my $$i=join('',);close F;$$i =~s//s+/ /gs;$$i =~ s/(/S+)/-I /"..//..//..//$$1/"/gs;print /"CUSTOM_INC = $$i/";" > $(MMIDIR)/customer/resGenerator/custom_include.txt) & /
   (@perl -e "open F,'<$(MMIDIR)/customer/resGenerator/custom_include.tmp';my $$i=join('',);close F;$$i =~s//s+/ /gs;$$i =~ s/(/S+)///I /"..//..//$$1/"/n/gs;print /"$$i/";" > $(MMIDIR)/MMI/GlobalTargetPathDef) & /
   (@if exist $(MMIDIR)/customer/replace_project_name.pl /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.tmp XXX $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.tmp XXX $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/ResGenerator.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.tmp XXX $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/remakeResource.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/UpdateSkin.tmp XXX $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/UpdateSkin.bat) & /
     (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.bat YYY $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
     (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.bat YYY $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/ResGenerator.bat) & /
     (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.bat YYY $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/remakeResource.bat) & /
     (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/UpdateSkin.bat YYY $(patsubst %_MMI,%,$(MMI_VERSION)) $(MMIDIR)/customer/UpdateSkin.bat) /
   ) /
  )
 @if exist $(MMIDIR)/customer /
  (@if /I $(RUN_RESGEN) EQU TRUE /
   (@if exist $(MMIDIR)/customer/replace_project_name.pl /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.bat SSS $(call Upper,$(strip $(OPTR_SPEC))) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.bat MMM $(call Upper,$(strip $(MAIN_LCD_SIZE))) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.bat PPP $(strip $(OPTR_PATH)) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator_HW.bat QQQ $(call Upper,$(strip $(TOUCH_PANEL_SUPPORT))) $(MMIDIR)/customer/ResGenerator_HW.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.bat SSS $(call Upper,$(strip $(OPTR_SPEC))) $(MMIDIR)/customer/ResGenerator.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.bat MMM $(call Upper,$(strip $(MAIN_LCD_SIZE))) $(MMIDIR)/customer/ResGenerator.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.bat PPP $(strip $(OPTR_PATH)) $(MMIDIR)/customer/ResGenerator.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/ResGenerator.bat QQQ $(call Upper,$(strip $(TOUCH_PANEL_SUPPORT))) $(MMIDIR)/customer/ResGenerator.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.bat SSS $(call Upper,$(strip $(OPTR_SPEC))) $(MMIDIR)/customer/remakeResource.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.bat MMM $(call Upper,$(strip $(MAIN_LCD_SIZE))) $(MMIDIR)/customer/remakeResource.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.bat PPP $(strip $(OPTR_PATH)) $(MMIDIR)/customer/remakeResource.bat) & /
    (@perl $(MMIDIR)/customer/replace_project_name.pl $(MMIDIR)/customer/remakeResource.bat QQQ $(call Upper,$(strip $(TOUCH_PANEL_SUPPORT))) $(MMIDIR)/customer/remakeResource.bat) /
   ) & /
   (@del $(MMIDIR)/customer/resGenerator/custom_include.tmp) & /
   ($(MMIDIR)/customer/ResGenerator_HW.bat $(MMI_VERSION) $(CUSTOMER)) /
  )
endif
   # copy only for Neptune162
# FALSE  
 if /I "$(strip $(CUSTOMER))" EQU "NEPTUNE162" /
  (if exist $(FIXPATH)/$(MMIDIR)/customer/CustResource/$(strip $(CUSTOMER))_MMI/resource_shortcuts.c /
     (copy /y $(FIXPATH)/$(MMIDIR)/Customer/CustResource/$(strip $(CUSTOMER))_MMI/resource_shortcuts.c $(FIXPATH)/$(MMIDIR)/Customer/CustResource/resource_shortcuts.c) /
  )
# 复制文件custom_option.txt和custom_include.txt到$(MMIDIR)/VendorApp/resGenerator目录下
 @if exist $(MMIDIR)/customer/resGenerator/custom_option.txt /
  (@if exist $(MMIDIR)/VendorApp/resGenerator /
   (copy /z $(MMIDIR)/customer/resGenerator/custom_option.txt $(MMIDIR)/VendorApp/resGenerator/custom_option.txt) & /
   (copy /z $(MMIDIR)/customer/resGenerator/custom_include.txt $(MMIDIR)/VendorApp/resGenerator/custom_include.txt) /
  )

endif

你可能感兴趣的:(MTK resgen编译分析)