phonebookui/Phonebook/Help/bldphobhelp.mk
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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 "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description:
       
    15 #
       
    16 #
       
    17 #	Build the PhoneBook help files
       
    18 #	================================
       
    19 #
       
    20 #	Also, compare the (definitive) phob.hlp.hrh exported from the source tree
       
    21 #	against the one generated from the RTF file, and throw an error if anything 
       
    22 #	is different.
       
    23 #
       
    24 #	Assumptions:
       
    25 #	The generated HRH file created by manually building help the first time is
       
    26 #	kept as part of the source for the component and exported to 
       
    27 #	epoc32\include\cshelp. This is so that this .mk file can pick up the file 
       
    28 #	for verfication against the newly generated one.
       
    29 #
       
    30 #	NB2 There are items in here which are also defined in the project file -
       
    31 #	attempts to modify this file to build for other components will require
       
    32 #	matching modifications in the project file. These are marked with
       
    33 #	"# Also defined in phob.xml"
       
    34 #
       
    35 #	NB3 Since I had to use the pseudotarget COMPARISON, the comparison of the 
       
    36 #	generated and exported HRH files will happen EVERY TIME the final stage 
       
    37 #	is run for this component.
       
    38 #
       
    39 
       
    40 #---------------------------------------#
       
    41 #										#
       
    42 #	Build tools							#
       
    43 #										#
       
    44 #---------------------------------------#
       
    45 
       
    46 
       
    47 PREPROCESSORTOOL=\epoc32\gcc\bin\cpp.exe
       
    48 HELPCOMPILERTOOL=\epoc32\tools\cshlpcmp
       
    49 
       
    50 #---------------------------------------#
       
    51 #										#
       
    52 #	Help project file					#
       
    53 #										#
       
    54 #---------------------------------------#
       
    55 
       
    56 HELPPROJECTFILE=\PhoneBook\help\phob.xml
       
    57 
       
    58 #---------------------------------------#
       
    59 #										#
       
    60 #	Intermediate build directory		#
       
    61 #										#
       
    62 #---------------------------------------#
       
    63 
       
    64 PROJECT=PhoneBook
       
    65 
       
    66 INTERMEDIATEDIR=..\..\epoc32\build\$(PROJECT)\help	# Also defined in phob.xml
       
    67 													# as the <output> and <working> fields.
       
    68 													# (Has to be defined here as a relative
       
    69 													# path because it is passed as a 
       
    70 													# parameter to the GCC preprocessor)
       
    71 
       
    72 $(INTERMEDIATEDIR) :
       
    73 	if not exist "\epoc32" md "\epoc32"
       
    74 	if not exist "\epoc32\build" md "\epoc32\build"
       
    75 	if not exist "\epoc32\build\$(PROJECT)" md "\epoc32\build\$(PROJECT)"
       
    76 	if not exist "\epoc32\build\$(PROJECT)\help" md "\epoc32\build\$(PROJECT)\help"
       
    77 
       
    78 #---------------------------------------#
       
    79 #										#
       
    80 #	Help build tool output				#
       
    81 #										#
       
    82 #---------------------------------------#
       
    83 
       
    84 HELPTOOLTARGETNAME=phob.hlp						#	Also defined in phob.xml
       
    85 
       
    86 
       
    87 #	Define the anticipated output files we're interested in
       
    88 
       
    89 HELPFILE=$(INTERMEDIATEDIR)\$(HELPTOOLTARGETNAME)
       
    90 HELPFILEHRH=$(INTERMEDIATEDIR)\$(HELPTOOLTARGETNAME).hrh
       
    91 HELPFILEOPH=$(INTERMEDIATEDIR)\$(HELPTOOLTARGETNAME).oph
       
    92 HELPFILEOPHTXT=$(INTERMEDIATEDIR)\$(HELPTOOLTARGETNAME).oph.txt
       
    93 
       
    94 HELPTOOLOUTPUT=$(HELPFILE) $(HELPFILEHRH) $(HELPFILEOPH) $(HELPFILEOPHTXT)
       
    95 
       
    96 #	Build the help files
       
    97 
       
    98 $(HELPTOOLOUTPUT) : $(INTERMEDIATEDIR) $(HELPPROJECTFILE)
       
    99 	$(HELPCOMPILERTOOL) $(HELPPROJECTFILE)
       
   100 
       
   101 #---------------------------------------#
       
   102 #										#
       
   103 #	Final destinations for output		#
       
   104 #										#
       
   105 #---------------------------------------#
       
   106 
       
   107 !IF "$(PLATFORM)"=="WINS"
       
   108 HELPTARGETDIR=\EPOC32\release\$(PLATFORM)\$(CFG)\z\system\help
       
   109 OPHTARGETDIR=\EPOC32\release\$(PLATFORM)\$(CFG)\z\system\opl
       
   110 !ELSE
       
   111 HELPTARGETDIR=\EPOC32\release\$(PLATFORM)\$(CFG)
       
   112 OPHTARGETDIR=\EPOC32\release\$(PLATFORM)\$(CFG)
       
   113 !ENDIF
       
   114 
       
   115 
       
   116 #	Create the destination directory for the helpfile
       
   117 
       
   118 #	NB Unpleasant use of IF WINS block below avoids error U4004
       
   119 #	in ARMI builds where the two paths are the same.
       
   120 
       
   121 $(HELPTARGETDIR) :
       
   122 	@if not exist "\EPOC32" md "\EPOC32"
       
   123 	@if not exist "\EPOC32\release" md "\EPOC32\release"
       
   124 	@if not exist "\EPOC32\release\$(PLATFORM)\" md "\EPOC32\release\$(PLATFORM)\"
       
   125 	@if not exist "\EPOC32\release\$(PLATFORM)\$(CFG)" md "\EPOC32\release\$(PLATFORM)\$(CFG)"
       
   126 !IF "$(PLATFORM)"=="WINS"
       
   127 	@if not exist "\EPOC32\release\$(PLATFORM)\$(CFG)\z" md "\EPOC32\release\$(PLATFORM)\$(CFG)\z"
       
   128 	@if not exist "\EPOC32\release\$(PLATFORM)\$(CFG)\z\System" md "\EPOC32\release\$(PLATFORM)\$(CFG)\z\System"
       
   129 	@if not exist "\EPOC32\release\$(PLATFORM)\$(CFG)\z\System\help" md "\EPOC32\release\$(PLATFORM)\$(CFG)\z\System\help"
       
   130 
       
   131 #	Create the destination directory for the OPH file
       
   132 
       
   133 $(OPHTARGETDIR) :
       
   134 	@if not exist "\EPOC32" md "\EPOC32"
       
   135 	@if not exist "\EPOC32\release" md "\EPOC32\release"
       
   136 	@if not exist "\EPOC32\release\$(PLATFORM)\" md "\EPOC32\release\$(PLATFORM)\"
       
   137 	@if not exist "\EPOC32\release\$(PLATFORM)\$(CFG)" md "\EPOC32\release\$(PLATFORM)\$(CFG)"
       
   138 	@if not exist "\EPOC32\release\$(PLATFORM)\$(CFG)\z" md "\EPOC32\release\$(PLATFORM)\$(CFG)\z"
       
   139 	@if not exist "\EPOC32\release\$(PLATFORM)\$(CFG)\z\System" md "\EPOC32\release\$(PLATFORM)\$(CFG)\z\System"
       
   140 	@if not exist "\EPOC32\release\$(PLATFORM)\$(CFG)\z\System\opl" md "\EPOC32\release\$(PLATFORM)\$(CFG)\z\System\opl"
       
   141 !ENDIF
       
   142 
       
   143 
       
   144 #	Copy the helpfile to its final destination
       
   145 
       
   146 HELPFILEFINAL=$(HELPTARGETDIR)\$(HELPTOOLTARGETNAME)
       
   147 
       
   148 $(HELPFILEFINAL) : $(HELPTARGETDIR) $(HELPFILE)
       
   149 	copy $(HELPFILE) $@
       
   150 
       
   151 
       
   152 #	Copy the helpfile OPH to its final destination
       
   153 
       
   154 OPHFILEFINAL=$(OPHTARGETDIR)\$(HELPTOOLTARGETNAME).oph
       
   155 
       
   156 $(OPHFILEFINAL) : $(OPHTARGETDIR) 
       
   157 	copy $(HELPFILEOPH) $@
       
   158 
       
   159 #---------------------------------------#
       
   160 #										#
       
   161 #	Preprocess and compare the two		#
       
   162 #	HRH files (one exported from		#
       
   163 #	source, one generated).				#
       
   164 #										#
       
   165 #---------------------------------------#
       
   166 
       
   167 
       
   168 #	Preprocess the generated HRH file
       
   169 
       
   170 PPGENERATEDHELPFILEHRH=$(HELPFILEHRH).gen.pp
       
   171 
       
   172 $(PPGENERATEDHELPFILEHRH) : $(HELPTOOLOUTPUT)
       
   173 	$(PREPROCESSORTOOL) -P $(HELPFILEHRH) $(PPGENERATEDHELPFILEHRH)
       
   174 
       
   175 
       
   176 #	Preprocess the exported HRH file
       
   177 
       
   178 EXPORTEDHELPFILEHRH=..\..\epoc32\include\cshelp\$(HELPTOOLTARGETNAME).hrh
       
   179 # NB Has to be defined as a relative path because it is going to be used
       
   180 # as a parameter for the GCC preprocessor.
       
   181 
       
   182 PPEXPORTEDHELPFILEHRH=$(INTERMEDIATEDIR)\$(HELPTOOLTARGETNAME).hrh.exp.pp
       
   183 
       
   184 $(PPEXPORTEDHELPFILEHRH) : $(INTERMEDIATEDIR) $(EXPORTEDHELPFILEHRH)
       
   185 	@$(PREPROCESSORTOOL) -P $(EXPORTEDHELPFILEHRH) $(PPEXPORTEDHELPFILEHRH)
       
   186 
       
   187 
       
   188 #	Do the comparison
       
   189 #	NB. we have to use the -call so that we can use the errorlevel
       
   190 #	returned by fc4bat without breaking NMAKE
       
   191 
       
   192 COMPARISON : $(PPEXPORTEDHELPFILEHRH) $(PPGENERATEDHELPFILEHRH)
       
   193 	@-call ..\help\compare.cmd $(PPEXPORTEDHELPFILEHRH) $(PPGENERATEDHELPFILEHRH)
       
   194 
       
   195 #---------------------------------------#
       
   196 #										#
       
   197 #	The targets invoked by bld...		#
       
   198 #										#
       
   199 #---------------------------------------#
       
   200 
       
   201 do_nothing :
       
   202 
       
   203 MAKMAKE : do_nothing
       
   204 
       
   205 BLD : do_nothing
       
   206 
       
   207 SAVESPACE : BLD
       
   208 
       
   209 CLEAN :
       
   210 	@if exist $(HELPFILE) erase $(HELPFILE)
       
   211 	@if exist $(HELPFILEHRH) erase $(HELPFILEHRH)
       
   212 	@if exist $(HELPFILEOPH) erase $(HELPFILEOPH)
       
   213 	@if exist $(HELPFILEOPHTXT) erase $(HELPFILEOPHTXT)
       
   214 	@if exist $(OPHFILEFINAL) erase $(OPHFILEFINAL)
       
   215 	@if exist $(HELPFILEFINAL) erase $(HELPFILEFINAL)
       
   216 	@if exist $(PPEXPORTEDHELPFILEHRH) erase $(PPEXPORTEDHELPFILEHRH)
       
   217 	@if exist $(PPGENERATEDHELPFILEHRH) erase $(PPGENERATEDHELPFILEHRH)
       
   218 
       
   219 FREEZE : do_nothing
       
   220 
       
   221 LIB : do_nothing
       
   222 
       
   223 CLEANLIB : do_nothing
       
   224 
       
   225 RESOURCE : do_nothing
       
   226 
       
   227 RELEASABLES :
       
   228 	@echo $(OPHFILEFINAL)
       
   229 	@echo $(HELPFILEFINAL)
       
   230 
       
   231 FINAL : COMPARISON $(OPHFILEFINAL) $(HELPFILEFINAL) 
       
   232