gfxconversion/mifconv/makefile_templates/mifconv.flm
changeset 37 2d01d5a0b322
parent 0 f453ebb75370
equal deleted inserted replaced
33:f01392e26aa1 37:2d01d5a0b322
     1 #
     1 #
     2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 # Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 # All rights reserved.
     3 # All rights reserved.
     4 # This component and the accompanying materials are made available
     4 # This component and the accompanying materials are made available
     5 # under the terms of "Eclipse Public License v1.0"
     5 # under the terms of "Eclipse Public License v1.0"
     6 # which accompanies this distribution, and is available
     6 # which accompanies this distribution, and is available
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
    13 # 
    13 # 
    14 # Description:
    14 # Description:
    15 # 
    15 # 
    16 #
    16 #
    17 
    17 
    18 # Check if $/ variable has been defined, if not, then it is always /
    18 # run a script to call mifconv and svgtbinencode
    19 ifeq ($(strip $(/)),)
    19 
    20     /:=/
    20 # only run once per TARGETFILE, but gather up all the requested PLATFORM + CFG
       
    21 # pairs so that the script can copy the target files to the other locations
       
    22 # required for different platforms.
       
    23 
       
    24 # note that TARGET_PLATFORMS is escaped in the macro so that it is not
       
    25 # expanded until the command runs, ensuring that it contains all the values.
       
    26 
       
    27 TARGET_PLATFORMS:=$(call sanitise,$(TARGETFILE)_mif)
       
    28 
       
    29 ifeq ($($(TARGET_PLATFORMS)),)
       
    30 $(TARGET_PLATFORMS):=$(PLATFORM) $(CFG)
       
    31 
       
    32 SCRIPT:=$(PYTHON) $(EPOCROOT)/epoc32/tools/mifconv_wrapper.py
       
    33 MANIFEST:=$(EPOCBLD)/$(TARGET_PLATFORMS)
       
    34 
       
    35 # macro to define rules for different phony targets
       
    36 #
       
    37 # run the script as a recipe, producing a manifest file as output.
       
    38 # then use the manifest file to generate the whatlog tags.
       
    39 #
       
    40 # $1 is BITMAP or CLEAN
       
    41 #
       
    42 define mifconvwrapper
       
    43 $1::
       
    44 	$(call startrule,mifconvwrapper,FORCESUCCESS) \
       
    45 	$(SCRIPT) \
       
    46 	  $(if $(FLMDEBUG),--debug="on") \
       
    47 	  --epocroot="$(EPOCROOT)" \
       
    48 	  --extroot="$(EXTENSION_ROOT)" \
       
    49 	  --make="$1" \
       
    50 	  --manifest="$(MANIFEST)" \
       
    51 	  --platforms="$$($(TARGET_PLATFORMS))" \
       
    52 	  $(if $(TARGETFILE),--target="$(TARGETFILE)") \
       
    53 	  $(if $(HEADERFILE),--header="$(HEADERFILE)") \
       
    54 	  $(if $(SOURCES),--sources="$(SOURCES)") \
       
    55 	  $(if $(SOURCEFILE),--sourcefile="$(SOURCEFILE)") \
       
    56 	  $(if $(SOURCEDIR),--sourcedir="$(SOURCEDIR)") \
       
    57 	  $(if $(SVGENCODINGVERSION),--svgversion="$(SVGENCODINGVERSION)") \
       
    58 	$(call endrule,mifconvwrapper)
       
    59 	$(call startrawoutput) \
       
    60 	echo "$(call whatLogOpen)" ; \
       
    61 	$(GNUCAT) $(MANIFEST) | \
       
    62 	(read -r LINE; while [ $$$$? -eq 0 ]; do \
       
    63 	echo "$(call whatLogItem,BITMAP,$$$$LINE)"; \
       
    64 	read -r LINE; done; ); \
       
    65 	echo "$(call whatLogClose)" \
       
    66 	$(call endrawoutput)
       
    67 	$(GNURM) $(MANIFEST)
       
    68 endef
       
    69 
       
    70 # if we are doing CLEAN or REALLYCLEAN then just include the CLEAN target,
       
    71 # otherwise just include the BITMAP target
       
    72 #
       
    73 ifeq ($(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS))),)
       
    74 $(eval $(call mifconvwrapper,BITMAP))
       
    75 else
       
    76 $(eval $(call mifconvwrapper,CLEAN))
    21 endif
    77 endif
    22 
    78 
    23 # Replace \ with / in EPOCROOT
    79 else
    24 EPOCROOT:=$(subst \,/,$(EPOCROOT))
    80 # this is an additional platform so append to the list
    25 # Make sure that EPOCROOT ends in /
       
    26 EPOCROOT:=$(patsubst %/,%,$(EPOCROOT))/
       
    27 # Replace / with $/ in EPOCROOT
       
    28 EPOCROOT:=$(subst /,$/,$(EPOCROOT))
       
    29 
    81 
    30 # Important initialise
    82 $(TARGET_PLATFORMS)+=$(PLATFORM) $(CFG)
    31 RELEASEABLES:=
       
    32 
    83 
    33 ifeq ($(SBS_BUILD_DIR),)
    84 endif # TARGET_PLATFORMS
    34 VECTORINTERMEDIATEDIR:=$(EPOCROOT)epoc32$/build$/s60$/icons$/$(notdir $(basename $(TARGETFILE)))
       
    35 else
       
    36 VECTORINTERMEDIATEDIR:=$(SBS_BUILD_DIR)$/s60$/icons$/$(notdir $(basename $(TARGETFILE)))
       
    37 endif
       
    38 
       
    39 include $(EPOCROOT)epoc32$/tools$/makefile_templates$/s60$/mifconv_global_options.make
       
    40 include $(EPOCROOT)epoc32$/tools$/makefile_templates$/s60$/mifconv_step1.make
       
    41 include $(EPOCROOT)epoc32$/tools$/makefile_templates$/s60$/mifconv_step2.make
       
    42 include $(EPOCROOT)epoc32$/tools$/makefile_templates$/s60$/mifconv_option_reader.make
       
    43 include $(EPOCROOT)epoc32$/tools$/makefile_templates$/s60$/mifconv_step3.make
       
    44 
       
    45 ifeq ($(OSTYPE),unix) 
       
    46 MIFCONV:=$(MIFCONV)
       
    47 SVGTBINENCODE:=$(SVGTBINENCODE)
       
    48 else 
       
    49 MIFCONV:=$(MIFCONV)$(DOTEXE)
       
    50 SVGTBINENCODE:=$(SVGTBINENCODE)$(DOTEXE)
       
    51 endif
       
    52 
       
    53 ifeq ($(strip $(MIFCONVDEBUG)),1)
       
    54 $(info <TOOLCAT toolcat='$(TOOLCAT)'/>)
       
    55 $(info <TOOLCOPY toolcopy='$(TOOLCOPY)'/>)
       
    56 $(info <TOOLMKDIR toolmkdir='$(TOOLMKDIR)'/>)
       
    57 $(info <MIFCONV mifconv='$(MIFCONV)'/>)
       
    58 endif
       
    59 
       
    60 ifeq ($(strip $(MIFCONVDEBUG)),1)
       
    61 $(warning MIFCONVOPTS $(MIFCONVOPTS))
       
    62 endif
       
    63 
       
    64 # The groupsvgin10 macro allows us to construct a command file, 10 
       
    65 # svgs/bmps objects at a time to avoid limits on argument lengths and 
       
    66 # sizes on Windows.
       
    67 define groupsvgin10
       
    68 	$(if $1,$(shell echo -e $(foreach L,$(wordlist 1,10,$1),"$(L)\\n") >>$(PARAMFILE)),)
       
    69 	$(if $1,$(call groupsvgin10,$(wordlist 11,$(words $1),$1)),true)
       
    70 endef
       
    71 
       
    72 define generatemif
       
    73 
       
    74 TARGET_$(TARGETFILE):=1
       
    75 MIFCONVOPTS:=$(MIFCONVOPTS)
       
    76 BITMAPS:=$(addsuffix .bmp,$(BITMAPBASESOURCES))
       
    77 
       
    78 BITMAP:: $(BITMAPFILE) $(TARGETFILE)
       
    79 
       
    80 ifeq ($(INIT_CFG),$(PLATFORM)$(CFG))
       
    81 ifneq ($(HEADERFILE),)
       
    82 $(HEADERFILE): $(TARGETFILE)
       
    83 endif
       
    84 endif
       
    85 
       
    86 ifneq ($(BITMAPFILE),)
       
    87 $(BITMAPFILE): $(TARGETFILE)
       
    88 endif
       
    89 
       
    90 
       
    91 $(if $(HEADERFILE),$(shell echo -e "-h$(HEADERFILE)\n-e\n" >$(PARAMFILE)), $(shell echo -e "-e\n" >$(PARAMFILE)) )
       
    92 $(if $(SOURCEDIR),$(shell echo -e "-i$(SOURCEDIR)\n" >>$(PARAMFILE)),)
       
    93 
       
    94 $(call groupsvgin10, $(MIFCONVOPTS))
       
    95 
       
    96 $(TARGETFILE): $(SVGBFILES) $(MIFCONV) $(SVGTBINENCODE) $(BMPFILES) $(MASKFILES)
       
    97 	$(call startrule,mifcompile,FORCESUCCESS) \
       
    98 	$(MIFCONV) $(TARGETFILE) -f$(PARAMFILE) \
       
    99 	$(call endrule,mifcompile)
       
   100 
       
   101 endef
       
   102 
       
   103 ifeq ($(TARGET_$(TARGETFILE)),)
       
   104 $(eval $(call generatemif))
       
   105 endif
       
   106 
       
   107 %-erase :
       
   108 	-$(GNURM) $*
       
   109 
       
   110 # FLM specific block begins
       
   111 CLEAN CLEANMAKEFILE :: $(addsuffix -erase,$(wildcard $(TARGETFILE) $(HEADERFILE) $(BITMAPFILE) $(PARAMFILE) $(patsubst %b,%,$(SVGBFILES)) $(SVGBFILES)))
       
   112 # FLM specific block ends
       
   113 
       
   114 # for the abld -what target 
       
   115 RELEASEABLES:=$(TARGETFILE) $(HEADERFILE) $(BITMAPFILE)
       
   116 $(eval $(call whatmacro,$(RELEASEABLES),WHATBITMAP))