sbsv2/raptor/lib/flm/resource.flm
author timothy.murphy@nokia.com
Sat, 01 May 2010 05:41:25 +0100
branchfix
changeset 536 49d91f1e52a3
parent 535 3ed696bd9e5f
child 537 164e587fef9f
permissions -rw-r--r--
small resource fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
394
b6f8d38305f2 Code review update.
Jon Chatten
parents: 393
diff changeset
     1
# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
     2
# All rights reserved.
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
     3
# This component and the accompanying materials are made available
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
     4
# under the terms of the License "Eclipse Public License v1.0"
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
     5
# which accompanies this distribution, and is available
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
     7
#
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
     8
# Initial Contributors:
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
     9
# Nokia Corporation - initial contribution.
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    10
#
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    11
# Contributors:
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    12
#
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    13
# Description:
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    14
# Function Like Makefile (FLM) to create a resource header (.rsg)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    15
# and resource files (.rsc, .r01, .r02 etc.)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    16
#
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    17
#
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    18
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    19
## Parameters that are expected:
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    20
# TARGET
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    21
# TARGETPATH
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    22
# LANGUAGES
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    23
# HEADER
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    24
# HEADERONLY
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    25
# EPOCROOT
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    26
# MMPDEFS
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    27
# PRODUCT_INCLUDE
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    28
# SYSTEMINCLUDE
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    29
# USERINCLUDE
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    30
# GNUCPP
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    31
# GNUSED
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    32
# RCOMP
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    33
# OUTPUTPATH
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    34
# SOURCE
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    35
# BINCOPYDIRS
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    36
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    37
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    38
# The rss is pre-processed once for each language and results
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    39
# in a file with extension r$(LANGUAGE) where $(LANGUAGE) is
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    40
# either "sc" or a 2 (or more) digit number.
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    41
ifneq ($(TARGETPATH),)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    42
RSCDIR:=$(subst //,/,$(EPOCROOT)/epoc32/data/z/$(TARGETPATH))
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    43
else
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    44
RSCDIR:=$(subst //,/,$(EPOCROOT)/epoc32/data)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    45
endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    46
RESBASE:=$(RSCDIR)/$(TARGET_lower)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    47
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    48
# Ensure that RELEASABLES and CLEANTARGETS cannot expand indefinitely in successive calls to this flm:
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    49
CLEANTARGETS:=
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    50
RELEASABLES:=
532
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
    51
CREATABLEPATHS:=
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    52
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    53
# There is only one resource header (.rsg) file and we only
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    54
# make that if we are asked.
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    55
RSGDIR:=$(EPOCROOT)/epoc32/include
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
    56
# If there are multiple LANGUAGES then it is the last one in the list
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
    57
# which produces the header.
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
    58
HEADLANG:=$(lastword $(LANGUAGES:SC=sc))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    59
ifneq ($(or $(HEADER),$(HEADERONLY)),)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    60
        RESOURCEHEADER:=$(RSGDIR)/$(HEADER)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    61
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    62
else
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
    63
        RESOURCEHEADER:=
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    64
endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    65
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    66
# we create intermediate .rpp and .d files
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
    67
INTERBASE_TMP:=$(OUTPUTPATH)/$(TARGET_lower)_$(notdir $(basename $(SOURCE)))
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
    68
INTERBASE:=$(OUTPUTPATH)/$(TARGET_lower)
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    69
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    70
################################## localisation ###########################$(GNUMKDIR)#############
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    71
# Only make copies for full resource builds
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    72
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    73
# Initialise to prevent RELEASABLES spill-over between calls
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    74
DESTRPP:=
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    75
INFOFILE:=
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    76
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    77
ifeq ($(HEADERONLY),)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    78
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    79
RSSBASENAME:=$(call lowercase,$(basename $(notdir $(SOURCE))))
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    80
DESTRPP:=$(EPOCROOT)/epoc32/localisation/$(RSSBASENAME)/rsc/$(RSSBASENAME).rpp
532
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
    81
CREATABLEPATHS:=$(CREATABLEPATHS) $(EPOCROOT)/epoc32/localisation/$(RSSBASENAME)/rsc
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    82
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    83
INFOFILE:=$(EPOCROOT)/epoc32/localisation/group/$(RSSBASENAME).info
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    84
# If there are MULTIPLE languages then copy the .rpp for the last one
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    85
RPPLANG:=$(lastword $(LANGUAGES:SC=sc))
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    86
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    87
# Copy .rpp files from epoc32/build/ to epoc32/localisation/x/rsc/x.rpp and create .info files in localisation
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    88
define CreateRppAndInfo
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    89
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    90
ifeq ($(RESOURCE_$(call sanitise,$(SOURCE))),)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    91
RESOURCE_$(call sanitise,$(SOURCE)):=1
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    92
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    93
RESOURCE:: $(DESTRPP) $(INFOFILE)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    94
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
    95
$(DESTRPP): $(INTERBASE_TMP)_$(RPPLANG).rpp
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    96
	$(call startrule,rppfilecopy,FORCESUCCESS) \
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    97
	$(GNUCP) $$< $$@ \
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    98
	$(call endrule,rppfilecopy)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    99
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   100
$(INFOFILE)::
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   101
	@if [ ! -d $(EPOCROOT)/epoc32/localisation/group ]; then $(GNUMKDIR) -p $(EPOCROOT)/epoc32/localisation/group; fi
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   102
	@if [ ! -f $$@ ]; then echo "DATADIR: /$(RSSBASENAME)" > $$@ ; fi
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   103
	@echo -e "\n/z$(TARGETPATH)/$(TARGET_lower).rsc : $(RSSBASENAME).rpp" >> $$@
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   104
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   105
endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   106
endef
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   107
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   108
$(eval $(call CreateRppAndInfo))
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   109
endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   110
################################# end of localisation ###################################
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   111
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   112
# common pre-processor options
471
8786668610ae fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents: 470
diff changeset
   113
8786668610ae fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents: 470
diff changeset
   114
# We really should be using -iquote with a recent cpp.  This is a note for when we do update:
8786668610ae fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents: 470
diff changeset
   115
#CPPOPT:=-nostdinc -undef -Wno-trigraphs -D_UNICODE -include $(PRODUCT_INCLUDE)\
8786668610ae fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents: 470
diff changeset
   116
# -I$(dir $(SOURCE)) $(foreach I, $(USERINCLUDE),-iquote $(I) ) $(foreach J,$(SYSTEMINCLUDE),-I $(J) )
8786668610ae fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents: 470
diff changeset
   117
393
629079c72ee4 Suppress trigraph warnings in resource file preprocessing.
Jon Chatten
parents: 5
diff changeset
   118
CPPOPT:=-nostdinc -undef -Wno-trigraphs -D_UNICODE -include $(PRODUCT_INCLUDE)\
471
8786668610ae fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents: 470
diff changeset
   119
 -I$(dir $(SOURCE)) $(foreach I, $(USERINCLUDE),-I$(I) ) -I- $(foreach J,$(SYSTEMINCLUDE),-I$(J) )
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   120
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   121
CREATABLEPATHS:=$(CREATABLEPATHS) $(RSCDIR) $(RSGDIR) $(OUTPUTPATH) $(INTERBASE_TMP) $(INTERBASE)
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   122
470
f45853a5ce36 comments: better commenting in resource.flm
timothy.murphy@nokia.com
parents: 466
diff changeset
   123
# We intend to generate the resource in an intermediate location and copy to the targetpath to
f45853a5ce36 comments: better commenting in resource.flm
timothy.murphy@nokia.com
parents: 466
diff changeset
   124
# ensure that when the "same" resource is built into separare target paths, it doesn't have to be 
f45853a5ce36 comments: better commenting in resource.flm
timothy.murphy@nokia.com
parents: 466
diff changeset
   125
# completely recreated each time - just copied.
466
b9e5cf94aac3 fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents: 465
diff changeset
   126
RSCCOPYDIRS:=$(RSCDIR)
470
f45853a5ce36 comments: better commenting in resource.flm
timothy.murphy@nokia.com
parents: 466
diff changeset
   127
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   128
# additional binary resource copies performed based on BINCOPYDIRS
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   129
ifneq ($(BINCOPYDIRS),)
464
a6aa62a0998d fix: prevent regeneration of resources for winscw after an armv5 build
timothy.murphy@nokia.com
parents: 394
diff changeset
   130
        RSCCOPYDIRS:=$(RSCCOPYDIRS) $(subst //,/,$(patsubst %,%/$(if $(TARGETPATH),/z/$(TARGETPATH),),$(BINCOPYDIRS)))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   131
endif
464
a6aa62a0998d fix: prevent regeneration of resources for winscw after an armv5 build
timothy.murphy@nokia.com
parents: 394
diff changeset
   132
CREATABLEPATHS:=$(CREATABLEPATHS) $(RSCCOPYDIRS)
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   133
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   134
###############################################################################
462
7f12c652f36d Fix: Resource stage parse performance affected by huge size of included dependency files
timothy.murphy@nokia.com
parents: 394
diff changeset
   135
7f12c652f36d Fix: Resource stage parse performance affected by huge size of included dependency files
timothy.murphy@nokia.com
parents: 394
diff changeset
   136
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   137
define preprocessresource
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   138
# $(1) is the RPPFILE		(eg. /epoc32/build/xxx/b_sc.rpp)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   139
# $(2) is the related RESOURCEFILE if any (eg. /a/b.rsc)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   140
# $(3) is the LANGUAGE		(eg. sc or 01 or 02 ...)
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   141
# $(4) is the "primary" language on which all the others depend
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   142
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   143
  ifeq ($(TARGET_$(call sanitise,$1)),)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   144
    TARGET_$(call sanitise,$1):=1
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   145
    $(if $(FLMDEBUG),$$(info <debug>preprocessresource: $(1) for $(2) LANG:$(3) dep $(4)</debug>))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   146
462
7f12c652f36d Fix: Resource stage parse performance affected by huge size of included dependency files
timothy.murphy@nokia.com
parents: 394
diff changeset
   147
466
b9e5cf94aac3 fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents: 465
diff changeset
   148
    # Correct dependency information when a header file can't be found.
b9e5cf94aac3 fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents: 465
diff changeset
   149
    # If the c preprocessor can't find a dependency it appears as it did in the #include statement
b9e5cf94aac3 fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents: 465
diff changeset
   150
    # e.g. "filename.mbg" or "filename.rsg" in the dependency file.
532
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
   151
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
   152
ifneq ($(NO_DEPEND_GENERATE),)
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
   153
    # This version minimises the size of dependency files, to contain only .mbg and .rsg deps.
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
   154
    # It allows resources to be built in the right order but doesn't impose the weight of
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
   155
    # of full dependency information which can overwhelm make in large builds.
534
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   156
    # The strategy is filter lines which don't have .rsg or 
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   157
    # .mbg dependencies in them and if to sift eah line to leave out non-relevant things like
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   158
    # other header files, .hrh files etc.  In the end we don't print anything at all if we
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   159
    # did not find the target.
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   160
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   161
define  DEPENDENCY_CORRECTOR
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   162
{ set +x; $(GNUSED) -rn '\% ([^ /]+)\.((rsg)|(mbg))%I {y/\\/ /;p;}'  |  \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   163
    { \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   164
    DEPTXT="$$$$RPP: \\\\\n"; \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   165
    DEPCOUNT=0; \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   166
    DEPS=''; read L; \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   167
    while [ $$$$? -eq 0 ]; do \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   168
        for i in $$$${L}; do \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   169
          if [[ ( "$$$${i%%.[Rr][Ss][Gg]}" != "$$$$i"  || "$$$${i%%.[Mm][Bb][Gg]}" != "$$$$i" ) && ( "$$$${i:1:1}" != ':' && "$$$${i:0:1}" != '/' ) ]];  then \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   170
            DEPTXT="$$$$DEPTXT \$$$$(EPOCROOT)/epoc32/include/$$$$i \\\\\n"; \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   171
            (( DEPCOUNT += 1 )) ; \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   172
          fi; \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   173
        done; \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   174
      read L; \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   175
    done; \
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   176
    if [ $$$$DEPCOUNT -ne 0 ]; then  echo -e "$$$${DEPTXT%%\\\\\\n}\n"; fi ;\
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   177
  } ;\
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   178
} 
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   179
endef
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   180
532
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
   181
else
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
   182
    # This can correct the dependencies by assuming that the file will be in epoc32\include as this is the default
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   183
    DEPENDENCY_CORRECTOR:=$(GNUSED)  -r 's% ([^ \/]+\.((rsg)|(mbg)))% $(EPOCROOT)\/epoc32\/include\/\1%ig' 
532
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
   184
endif
462
7f12c652f36d Fix: Resource stage parse performance affected by huge size of included dependency files
timothy.murphy@nokia.com
parents: 394
diff changeset
   185
7f12c652f36d Fix: Resource stage parse performance affected by huge size of included dependency files
timothy.murphy@nokia.com
parents: 394
diff changeset
   186
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   187
    ifeq "$1" "$4"
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   188
        RESOURCE_DEPS:: $1.d
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   189
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   190
        $1.d: $(SOURCE)
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   191
	  $(call startrule,resourcedependencies,FORCESUCCESS) \
532
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
   192
	  RPP=$1; $(GNUCPP) -C -DLANGUAGE_$(3) -DLANGUAGE_$(subst sc,SC,$3) $(call makemacrodef,-D,$(MMPDEFS))\
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   193
	  $(CPPOPT) $(SOURCE) -M -MG -MT"$1" | \
474
d22e74b2b0f8 fix: resource dependencies sometimes not generated because of too-early expansion of variable.
timothy.murphy@nokia.com
parents: 472
diff changeset
   194
	  $$(DEPENDENCY_CORRECTOR) >$$@ \
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   195
	  $(call endrule,resourcedependencies)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   196
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   197
         $1 : $1.d
532
1083c9a3a7cf minimising dependencies might have helped after all by ecluding something that's getting updated that maybe shouldn't. Try it out again.
timothy.murphy@nokia.com
parents: 530
diff changeset
   198
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   199
    else
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   200
         $1 : $4
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   201
    endif
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   202
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   203
    $1:
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   204
	  $(call startrule,resourcepreprocess,FORCESUCCESS) \
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   205
	  $(GNUCPP) -C -DLANGUAGE_$3 -DLANGUAGE_$(subst sc,SC,$(3)) $(call makemacrodef,-D,$(MMPDEFS))\
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   206
	  $(CPPOPT) $(SOURCE) -o $$@ \
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   207
	  $(call endrule,resourcepreprocess)
487
fa72431a3f1a fix: stop including dep files in the depfile generation stage. Remove other unnecessary stuff from RESOURCE_DEPS
timothy.murphy@nokia.com
parents: 486
diff changeset
   208
    endif
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   209
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   210
    CLEANTARGETS:= $$(CLEANTARGETS) $1
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   211
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   212
    ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   213
    ifeq "$1" "$4"
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   214
      $(eval DEPENDFILENAME:=$1.d)
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   215
      $(eval DEPENDFILE:=$(wildcard $(DEPENDFILENAME)))
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   216
      
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   217
      CLEANTARGETS:=$$(CLEANTARGETS) $(DEPENDFILENAME)
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   218
      ifneq "$(DEPENDFILE)" ""
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   219
        ifeq "$(filter %CLEAN,$(call uppercase,$(MAKECMDGOALS)))" ""
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   220
          ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   221
           -include $(DEPENDFILE)
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   222
          endif
466
b9e5cf94aac3 fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents: 465
diff changeset
   223
        endif
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   224
      endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   225
    endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   226
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   227
  endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   228
endef # preprocessresource #
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   229
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   230
###############################################################################
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   231
define copyresource
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   232
# $(1) is the source
534
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   233
# $(2) is the space separated list of destinations which must be filenames
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   234
533
408bfff46ad7 fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents: 532
diff changeset
   235
   RELEASABLES:=$$(RELEASABLES) $(2)
534
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   236
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   237
   $(if $(TARGET_$(call sanitise,$(firstword $2))),,$(eval TARGET_$(call sanitise,$(firstword $2)):=1)$(info <copy source='$1'>$2</copy>))
533
408bfff46ad7 fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents: 532
diff changeset
   238
 
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   239
endef # copyresource #
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   240
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   241
###############################################################################
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   242
define generateresource
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   243
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   244
# $(1) is the resource filename e.g. /a/b/resource.rsc
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   245
# $(2) is the preprocessed resource to make it from
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   246
# $(3) is the language e.g. sc or 01 or 02
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   247
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   248
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   249
        ifeq ($(TARGET_$(call sanitise,$1)),)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   250
                TARGET_$(call sanitise,$1):=1
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   251
483
941b2742ee49 Fix a copyright date. Make sure all FLMBDEBUG usage is wrapped in <debug> tags.
timothy.murphy@nokia.com
parents: 479
diff changeset
   252
            $(if $(FLMDEBUG),$(info <debug>generateresource: $(1) from $(2) LANG:$(3)</debug>),)	
941b2742ee49 Fix a copyright date. Make sure all FLMBDEBUG usage is wrapped in <debug> tags.
timothy.murphy@nokia.com
parents: 479
diff changeset
   253
            $(if $(FLMDEBUG),$(info <debug>generateresource: copies: $(sort $(patsubst %,%/$(notdir $(1)),$(RSCCOPYDIRS)))</debug>))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   254
475
2b71dc28e5fc fix: resource cleaning fix
timothy.murphy@nokia.com
parents: 474
diff changeset
   255
            CLEANTARGETS:=$$(CLEANTARGETS) $(1)
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   256
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   257
            RESOURCE:: $(1)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   258
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   259
            $(1): $(2) $(RCOMP)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   260
			$(call startrule,resourcecompile,FORCESUCCESS) \
533
408bfff46ad7 fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents: 532
diff changeset
   261
			$(RCOMP) -m045,046,047 -u -o$(1) -s$(2)  \
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   262
			$(call endrule,resourcecompile)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   263
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   264
        endif
471
8786668610ae fix: revert -iquote since older cpps don't understand it
timothy.murphy@nokia.com
parents: 470
diff changeset
   265
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   266
#	Whether or not we have generated this resource for some other variant, check if there
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   267
#       are any new copies to be made for this variant. e.g. winscw requires that we make
475
2b71dc28e5fc fix: resource cleaning fix
timothy.murphy@nokia.com
parents: 474
diff changeset
   268
#       some extra copies.  We tried to copy after running rcomp itself but we still need these
2b71dc28e5fc fix: resource cleaning fix
timothy.murphy@nokia.com
parents: 474
diff changeset
   269
#       targets for the sake of dependencies or, for example if someone merely adds a new copy 
2b71dc28e5fc fix: resource cleaning fix
timothy.murphy@nokia.com
parents: 474
diff changeset
   270
#       when the resource is up-to-date
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   271
533
408bfff46ad7 fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents: 532
diff changeset
   272
        $(call copyresource,$1,$(sort $(patsubst %,%/$(notdir $1),$(RSCCOPYDIRS))))
408bfff46ad7 fix performance: copy resources in the frontend. Helps cluster builds since remote copying is inefficient.
timothy.murphy@nokia.com
parents: 532
diff changeset
   273
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   274
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   275
        # individual source file compilation
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   276
        SOURCETARGET_$(call sanitise,$(SOURCE)): $(1)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   277
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   278
endef # generateresource
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   279
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   280
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   281
###############################################################################
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   282
define generateresourceheader
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   283
# $(1) is the resource header	(eg. /epoc32/include/a.rsg)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   284
# $(2) is the preprocessed resource to make it from
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   285
# $(3) is the language to use	(eg. sc)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   286
534
3b10c85868b1 fix resource deps: generate more cleanly - no targets if there are no prereqs. no empty lines.
timothy.murphy@nokia.com
parents: 533
diff changeset
   287
        RELEASABLES:= $$(RELEASABLES) $(1)
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   288
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   289
        ifeq ($(TARGET_$(call sanitise,$1)),)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   290
                TARGET_$(call sanitise,$1):=1
466
b9e5cf94aac3 fix: don't regenrate resources for WINSCW
timothy.murphy@nokia.com
parents: 465
diff changeset
   291
                $(if $(FLMDEBUG),$(info <debug>resourceheader: $(1) from $(2) LANG:$(3)</debug>))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   292
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   293
                RESOURCE:: $(1)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   294
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   295
                $(1): $(2) $(RCOMP)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   296
			$(call startrule,resourceheader,FORCESUCCESS) \
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   297
			$(RCOMP) -m045,046,047 -u -h$(1) -s$(2) \
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   298
			$(call endrule,resourceheader)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   299
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   300
        endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   301
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   302
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   303
        # individual source file compilation
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   304
        SOURCETARGET_$(call sanitise,$(SOURCE)): $(1)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   305
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   306
endef
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   307
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   308
###############################################################################
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   309
## call the generator
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   310
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   311
# We always create at least the header
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   312
# even if we sometimes don't create the resources
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   313
ifneq ($(RESOURCEHEADER),)
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   314
        $(eval $(call generateresourceheader,$(RESOURCEHEADER),$(INTERBASE_TMP)_$(HEADLANG).rpp,$(HEADLANG)))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   315
endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   316
530
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   317
# The one on which the others will depend i.e. they will 
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   318
# "sit in it's dependency slipstream" or in other words
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   319
# We only have to make one dependency file because all of
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   320
# the other languages will benefit from this languages'
c708fcd8e968 fix: use only one dependency file per resource - not one per language per resource. Speed improvement.
timothy.murphy@nokia.com
parents: 529
diff changeset
   321
# dependency file
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   322
PRIMARYRPPFILE:=$(INTERBASE_TMP)_$(HEADLANG).rpp
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   323
ifeq ($(HEADERONLY),)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   324
        # generate a resource file for each language
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   325
        # For sc we generate $(RESBASE).rsc and define LANGUAGE_SC and LANGUAGE_sc.
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   326
        $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call preprocessresource,$(INTERBASE_TMP)_$(L).rpp,$(INTERBASE).r$(L),$(L),$(PRIMARYRPPFILE))))
487
fa72431a3f1a fix: stop including dep files in the depfile generation stage. Remove other unnecessary stuff from RESOURCE_DEPS
timothy.murphy@nokia.com
parents: 486
diff changeset
   327
fa72431a3f1a fix: stop including dep files in the depfile generation stage. Remove other unnecessary stuff from RESOURCE_DEPS
timothy.murphy@nokia.com
parents: 486
diff changeset
   328
        ifeq "$(MAKEFILE_GROUP)" "RESOURCE"
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   329
            $(foreach L,$(LANGUAGES:SC=sc),$(eval $(call generateresource,$(INTERBASE).r$(L),$(INTERBASE_TMP)_$(L).rpp,$(L))))
487
fa72431a3f1a fix: stop including dep files in the depfile generation stage. Remove other unnecessary stuff from RESOURCE_DEPS
timothy.murphy@nokia.com
parents: 486
diff changeset
   330
        endif
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   331
else
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   332
        # No resources are going to be made so unless we specifically ask for it, there will be no
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   333
        # preprocessed file from which to create the header:
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   334
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   335
        $(eval $(call preprocessresource,$(INTERBASE_TMP)_$(HEADLANG).rpp,,$(HEADLANG),$(PRIMARYRPPFILE)))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   336
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   337
endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   338
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   339
###############################################################################
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   340
## .rfi generation in support of the gccxml build
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   341
## Note that .rfi files are created from the dependency files generated from preprocessing resources to create .rpp files
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   342
ifneq ($(RFIFILE),)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   343
  RESOURCE:: $(RFIFILE)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   344
  RELEASABLES:=$(RELEASABLES) $(RFIFILE)
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   345
  CREATABLEPATHS:=$(CREATABLEPATHS) $(dir $(RFIFILE))/
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   346
536
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   347
  RPPFILES:=$(foreach L,$(LANGUAGES:SC=sc),$(INTERBASE_TMP)_$(L).rpp)
49d91f1e52a3 small resource fixes
timothy.murphy@nokia.com
parents: 535
diff changeset
   348
  #$(eval $(call generaterfifile,$(RFIFILE),$(RPPFILES),$(addsuffix .d,$(RPPFILES))))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   349
endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   350
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   351
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   352
## Clean up
5
593a8820b912 Team Wip branch
tnmurphy@4GBL06592.nokia.com
parents: 3
diff changeset
   353
$(call raptor_clean,$(CLEANTARGETS))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   354
# make the output directories while reading makefile - some build engines prefer this
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   355
$(call makepath,$(CREATABLEPATHS))
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   356
5
593a8820b912 Team Wip branch
tnmurphy@4GBL06592.nokia.com
parents: 3
diff changeset
   357
# for the --what option and the log file
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   358
RELEASABLES:=$(RELEASABLES) $(DESTRPP) $(INFOFILE)
5
593a8820b912 Team Wip branch
tnmurphy@4GBL06592.nokia.com
parents: 3
diff changeset
   359
$(call raptor_release,$(RELEASABLES),RESOURCE)
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   360