sbsv2/raptor/lib/flm/tracecompiler.mk
author timothy.murphy@nokia.com
Tue, 18 May 2010 22:13:09 +0100
branchfix
changeset 567 d420c77a7248
parent 566 d242e2b48221
child 568 d4ab34a8c6dc
permissions -rw-r--r--
release note and review comment tidyup for tcom speedup
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
277
dbd582b8c0ab SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents: 236
diff changeset
     1
# Copyright (c) 2009-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
# Run Trace Compiler on source files to generate trace headers and decode files
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    15
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    16
# Expected inputs:
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    17
# TARGETEXT
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    18
277
dbd582b8c0ab SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents: 236
diff changeset
    19
# Set project name as <mmp_name>
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    20
TRACE_PRJNAME:=$(basename $(notdir $(PROJECT_META)))
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    21
OLDTC_TRACE_PRJNAME:=$(TRACE_PRJNAME)
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    22
TRACE_RELEASABLE_ID:=$(TARGET)_$(TARGETEXT)
277
dbd582b8c0ab SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents: 236
diff changeset
    23
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    24
define get_trace_path
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    25
$(firstword $(filter %$1, $(USERINCLUDE) $(SYSTEMINCLUDE)))
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    26
endef
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    27
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    28
$(if $(FLMDEBUG),$(info <debug>INCLUDES=$(USERINCLUDE) $(SYSTEMINCLUDE)</debug>))
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    29
$(if $(FLMDEBUG),$(info <debug>TARGET=$(TARGET) TARGETEXT=$(TARGETEXT)</debug>))
277
dbd582b8c0ab SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents: 236
diff changeset
    30
519
206fd7d7ef46 Use TRACE_RELEASABLE_ID more consistently. Fix comment spelling.
timothy.murphy@nokia.com
parents: 517
diff changeset
    31
# Find out TRACE_PATH  by looking for the trace folder in SYSTEMINCLUDE and USERINCLUDES
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    32
# traces/traces_<target_name>_<target_extension>
519
206fd7d7ef46 Use TRACE_RELEASABLE_ID more consistently. Fix comment spelling.
timothy.murphy@nokia.com
parents: 517
diff changeset
    33
TRACE_PATH:=$(call get_trace_path,/traces/traces_$(TRACE_RELEASABLE_ID))
277
dbd582b8c0ab SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents: 236
diff changeset
    34
ifneq ($(TRACE_PATH),)
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    35
  TRACE_PRJNAME:=$(TRACE_RELEASABLE_ID)
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    36
else # obsolete forms for compatibility
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    37
  # traces_<target_name>_<target_ext>
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    38
  TRACE_PATH:=$(call get_trace_path,/traces_$(TARGET)_$(TARGETEXT))
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    39
  ifneq ($(TRACE_PATH),)
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    40
    # set project name as <target_name>_<target_ext> instead of <mmp_name>
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    41
    # to trick old TCom into finding the path.
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    42
    OLDTC_TRACE_PRJNAME:=$(TARGET)_$(TARGETEXT)
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    43
  else
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    44
    # traces_<target_name>_<target_type>
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    45
    TRACE_PATH:=$(call get_trace_path,/traces_$(TARGET)_$(TARGETTYPE))
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    46
    ifneq ($(TRACE_PATH),)
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    47
      # set project name as <target_name>_<target_type> instead of <mmp_name>
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    48
      # to trick old TCom into finding the path.
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    49
      OLDTC_TRACE_PRJNAME:=$(TARGET)_$(TARGETTYPE)
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    50
    else
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    51
      # traces_<mmp_name>
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    52
      TRACE_PATH:=$(call get_trace_path,/traces_$(TRACE_PRJNAME))
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    53
   
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    54
      # traces
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    55
      ifeq ($(TRACE_PATH),)
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    56
       TRACE_PATH:=$(call get_trace_path,/traces)
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    57
      endif
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    58
    endif
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    59
  endif
277
dbd582b8c0ab SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents: 236
diff changeset
    60
endif
dbd582b8c0ab SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents: 236
diff changeset
    61
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
    62
236
a2dc04c8e649 fix: Don't print what information if we have no intention of running the trace compiler.
timothy.murphy@nokia.com
parents: 173
diff changeset
    63
# initialise (so what output will be correct if we don't actually run the TC)
a2dc04c8e649 fix: Don't print what information if we have no intention of running the trace compiler.
timothy.murphy@nokia.com
parents: 173
diff changeset
    64
TRACE_DICTIONARY:=
a2dc04c8e649 fix: Don't print what information if we have no intention of running the trace compiler.
timothy.murphy@nokia.com
parents: 173
diff changeset
    65
AUTOGEN_HEADER:=
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    66
$(if $(FLMDEBUG),$(info <debug>TRACE_PATH='$(TRACE_PATH)'   TRACE_RELEASABLE_ID='$(TRACE_RELEASABLE_ID)'</debug>))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    67
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    68
# Run trace compiler only if TRACE_PATH exists
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    69
ifneq ($(TRACE_PATH),)
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    70
TRACE_MARKER:=$(TRACE_MARKER_PATH)/tracecompile_$(TRACE_RELEASABLE_ID)_$(UID_TC).done
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    71
TRACE_HEADERS:=
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    72
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
    73
TRACE_SOURCE_LIST:=$(TRACE_MARKER_PATH)/tracecompile_$(TRACE_RELEASABLE_ID)_$(UID_TC).sourcelist
563
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
    74
TRACE_VARIANT_SOURCE_LIST:=$(OUTPUTPATH)/$(VARIANTPLATFORM)/$(VARIANTTYPE)/tracecompile_$(TRACE_RELEASABLE_ID)_$(UID_TC).sourcelist
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
    75
566
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    76
# The sourcelist_grouped_write macro allows us to construct a source list file, 10 objects at a time
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    77
# to avoid limits on argument lengths and sizes on Windows.
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    78
# $1 = list of source files
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    79
# $2 = ">" or ">>" i.e. for creating the file.
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    80
define sourcelist_grouped_write
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    81
	$(call startrule,sourcelist_write) \
567
d420c77a7248 release note and review comment tidyup for tcom speedup
timothy.murphy@nokia.com
parents: 566
diff changeset
    82
	$(if $1,echo -en '$(subst $(CHAR_SPACE),\n,$(strip $(wordlist 1,10,$1)))\n' $2 $$@,true) \
566
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    83
	$(call endrule,sourcelist_write) 
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    84
	$(if $1,$(call sourcelist_grouped_write,$(wordlist 11,$(words $1),$1),>>),)
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    85
endef
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    86
563
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
    87
# Write the list of sources for this variant to a file
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
    88
# Make the combined sourcelist for this target depend on it
566
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    89
# It's all to do with how make treats this file when it 
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    90
# does exist. We are forcing it evaluate the target rule here 
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    91
# even if the file is in place by making it PHONY. In other 
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    92
# words, this is forcing the variant source list to always 
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    93
# be written but later on we might not write to the combined 
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
    94
# source list if it isn't going to change.
563
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
    95
define sourcelist_write
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
    96
$(TRACE_SOURCE_LIST): $(TRACE_VARIANT_SOURCE_LIST)
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
    97
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
    98
.PHONY:: $(TRACE_VARIANT_SOURCE_LIST)
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
    99
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   100
$(TRACE_VARIANT_SOURCE_LIST): $(SOURCE) 
566
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
   101
	$(call sourcelist_grouped_write,$(SOURCE),>)
563
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   102
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   103
endef
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   104
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   105
$(eval $(sourcelist_write))
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   106
$(eval $(call GenerateStandardCleanTarget,$(TRACE_VARIANT_SOURCE_LIST),,))
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   107
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   108
566
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
   109
$(if $(FLMDEBUG),$(info <debug>Trace Compiler SOURCES: $(SOURCE)</debug>))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   110
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   111
$(TRACE_MARKER) : $(SOURCE)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   112
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   113
TRACE_HEADERS:=$(foreach SRC,$(SOURCE),$(TRACE_PATH)/$(basename $(notdir $(SRC)))Traces.h)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   114
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   115
$(TRACE_HEADERS): $(TRACE_MARKER)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   116
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   117
ifeq ($(GUARD_$(call sanitise,$(TRACE_MARKER))),)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   118
GUARD_$(call sanitise,$(TRACE_MARKER)):=1
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   119
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
   120
$(if $(FLMDEBUG),$(info <debug>PAST MARKER='$(TRACE_RELEASABLE_ID)'</debug>))
300
e87b08dc4b44 SF Bug 2125 - [Raptor] - tracecompiler what output incorrect if mmp basename contains '.' e.g. fred.prd.mmp
timothy.murphy@nokia.com
parents: 293
diff changeset
   121
# The trace compiler likes to change . into _ so we must do the same in the case of mmps with a name like
e87b08dc4b44 SF Bug 2125 - [Raptor] - tracecompiler what output incorrect if mmp basename contains '.' e.g. fred.prd.mmp
timothy.murphy@nokia.com
parents: 293
diff changeset
   122
# fred.prd.mmp we want fred_prd
e87b08dc4b44 SF Bug 2125 - [Raptor] - tracecompiler what output incorrect if mmp basename contains '.' e.g. fred.prd.mmp
timothy.murphy@nokia.com
parents: 293
diff changeset
   123
TRACE_PRJNAME_SANITISED:=$(subst .,_,$(TRACE_PRJNAME))
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
   124
OLDTC_TRACE_PRJNAME_SANITISED:=$(subst .,_,$(OLDTC_TRACE_PRJNAME))
300
e87b08dc4b44 SF Bug 2125 - [Raptor] - tracecompiler what output incorrect if mmp basename contains '.' e.g. fred.prd.mmp
timothy.murphy@nokia.com
parents: 293
diff changeset
   125
236
a2dc04c8e649 fix: Don't print what information if we have no intention of running the trace compiler.
timothy.murphy@nokia.com
parents: 173
diff changeset
   126
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   127
JAVA_COMMAND:=$(SBS_JAVATC)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   128
TRACE_COMPILER_PATH:=$(EPOCROOT)/epoc32/tools
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   129
521
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   130
# declare the trace_compile macro but only do it once in the build
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   131
ifeq ($(trace_compile),)
521
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   132
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   133
# Find out which macro to declare - the one supporting the new CLI 
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   134
# or the old one.  First try to find TraceCompilerMain.class 
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   135
# If it is there then it might be the new posix-like interface
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   136
TRACE_VER:=
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   137
TRACE_VSTR:=
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   138
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   139
TCClass:=$(wildcard  $(TRACE_COMPILER_PATH)/tracecompiler/com/nokia/tracecompiler/TraceCompilerMain.class)
521
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   140
ifneq ($(TCClass),) 
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   141
# Get the version string from the TC (assume it's the new one)
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   142
TRACE_COMPILER_START:=-classpath $(TRACE_COMPILER_PATH)/tracecompiler com.nokia.tracecompiler.TraceCompilerMain
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   143
TRACE_VSTR:=$(firstword $(subst TraceCompiler version ,,$(shell $(JAVA_COMMAND) $(TRACE_COMPILER_START) --version)))
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   144
# check if it looks like a version that supports the new cli interface: supporting up to verion 9 in the future.
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   145
TRACE_VER:=$(findstring new,$(foreach version,2 3 4 5 6 7 8 9,$(patsubst $(version).%,new,$(TRACE_VSTR))))
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   146
endif
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   147
$(if $(FLMDEBUG),$(info <debug>TRACE_VSTR=$(TRACE_VSTR) TRACE_VER=$(TRACE_VER)</debug>))
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   148
563
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   149
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   150
# 0. Generate a combined sourcelist from all variants. 
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   151
# 0.1 Write the combined list to a temporary file
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   152
# 0.2 Check if there are new files since the last build
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   153
#      md5 stored in the trace marker.
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   154
# 0.3 Rewrite the combined sourcelist if new sourcefiles have appeared
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   155
#      since the last build
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   156
# 1. Use pipe to send inputs to trace compiler to process
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   157
# 2. Create a hash regarding to source names and put it in marker.
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   158
# 3. Show source names that are processed by trace compiler
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   159
521
53251dd57e58 fix: tracecompiler - recognise old versions which do have a Main class but don't have a CLI.
timothy.murphy@nokia.com
parents: 519
diff changeset
   160
ifeq ($(TRACE_VER),new)
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   161
define trace_compile
563
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   162
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   163
$(TRACE_SOURCE_LIST):
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   164
	$(call startrule,sourcelist_combine) \
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   165
	$(GNUCAT) $$^ | $(GNUSORT) -u > $$@.new && \
564
ee6b33f2ef0e fix: tracecompiler speedup. Don't trigger scanlog with md5sum errors since they are expected. Use a grouping macro to avoid commandline length limits.
timothy.murphy@nokia.com
parents: 563
diff changeset
   166
	$(GNUMD5SUM) -c $(TRACE_MARKER) 2>/dev/null ||  \
563
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   167
	  $(GNUCP) $$@.new $$@ \
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   168
	$(call endrule,sourcelist_combine)
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   169
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   170
$(TRACE_MARKER) : $(PROJECT_META) $(TRACE_SOURCE_LIST)
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   171
	$(call startrule,tracecompile) \
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   172
	( $(GNUCAT) $(TRACE_SOURCE_LIST); \
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   173
	  echo -en "*ENDOFSOURCEFILES*\n" ) | \
519
206fd7d7ef46 Use TRACE_RELEASABLE_ID more consistently. Fix comment spelling.
timothy.murphy@nokia.com
parents: 517
diff changeset
   174
	$(JAVA_COMMAND) $(TRACE_COMPILER_START) $(if $(FLMDEBUG),-d,) --uid=$(UID_TC) --project=$(TRACE_PRJNAME) --mmp=$(PROJECT_META) --traces=$(TRACE_PATH) &&  \
566
d242e2b48221 fix: enable large sourcefile lists with TCom
timothy.murphy@nokia.com
parents: 564
diff changeset
   175
	$(GNUMD5SUM) $(TRACE_SOURCE_LIST).new > $$@ 2>/dev/null && \
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   176
	{ $(GNUTOUCH) $(TRACE_DICTIONARY) $(AUTOGEN_HEADER); \
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   177
	 $(GNUCAT) $(TRACE_SOURCE_LIST) ; true ; } \
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   178
	$(call endrule,tracecompile)
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   179
endef
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
   180
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   181
else # Old inteface
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   182
TRACE_COMPILER_START:=-classpath $(TRACE_COMPILER_PATH)/tracecompiler com.nokia.tracecompiler.TraceCompiler
563
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   183
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   184
define trace_compile
563
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   185
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   186
$(TRACE_SOURCE_LIST):
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   187
	$(call startrule,sourcelist_combine) \
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   188
	$(GNUCAT) $$^ | $(GNUSORT) -u > $$@.new && \
567
d420c77a7248 release note and review comment tidyup for tcom speedup
timothy.murphy@nokia.com
parents: 566
diff changeset
   189
	$(GNUMD5SUM) -c $(TRACE_MARKER) 2>/dev/null ||  \
563
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   190
	  $(GNUCP) $$@.new $$@ \
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   191
	$(call endrule,sourcelist_combine)
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   192
51b77162794b fix: trace compiler speedup
timothy.murphy@nokia.com
parents: 521
diff changeset
   193
$(TRACE_MARKER) : $(PROJECT_META) $(TRACE_SOURCE_LIST)
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   194
	$(call startrule,tracecompile) \
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
   195
	( echo -en "$(OLDTC_TRACE_PRJNAME)\n$(PROJECT_META)\n"; \
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   196
	  $(GNUCAT) $(TRACE_SOURCE_LIST); \
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   197
	  echo -en "*ENDOFSOURCEFILES*\n" ) | \
293
5bbbb5fd2a8a fix: remove OSTv2 dependency so we will still work with the old one
timothy.murphy@nokia.com
parents: 291
diff changeset
   198
	$(JAVA_COMMAND) $(TRACE_COMPILER_START) $(UID_TC) &&  \
567
d420c77a7248 release note and review comment tidyup for tcom speedup
timothy.murphy@nokia.com
parents: 566
diff changeset
   199
	$(GNUMD5SUM) $(TRACE_SOURCE_LIST).new > $$@ 2>/dev/null && \
300
e87b08dc4b44 SF Bug 2125 - [Raptor] - tracecompiler what output incorrect if mmp basename contains '.' e.g. fred.prd.mmp
timothy.murphy@nokia.com
parents: 293
diff changeset
   200
	{ $(GNUTOUCH) $(TRACE_DICTIONARY) $(AUTOGEN_HEADER); \
e87b08dc4b44 SF Bug 2125 - [Raptor] - tracecompiler what output incorrect if mmp basename contains '.' e.g. fred.prd.mmp
timothy.murphy@nokia.com
parents: 293
diff changeset
   201
	 $(GNUCAT) $(TRACE_SOURCE_LIST) ; true ; } \
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   202
	$(call endrule,tracecompile)
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   203
endef
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
   204
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
   205
# End - new/old trace compiler
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   206
endif
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   207
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
   208
# End - tracecompile is defined
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   209
endif
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   210
517
b97b96f395b6 fix: calculate autogen header locations every time.
timothy.murphy@nokia.com
parents: 516
diff changeset
   211
ifeq ($(TRACE_VER),new)
b97b96f395b6 fix: calculate autogen header locations every time.
timothy.murphy@nokia.com
parents: 516
diff changeset
   212
TRACE_DICTIONARY:=$(EPOCROOT)/epoc32/ost_dictionaries/$(TRACE_PRJNAME_SANITISED)_0x$(UID_TC)_Dictionary.xml
b97b96f395b6 fix: calculate autogen header locations every time.
timothy.murphy@nokia.com
parents: 516
diff changeset
   213
AUTOGEN_HEADER:=$(EPOCROOT)/epoc32/include/platform/symbiantraces/autogen/$(TRACE_PRJNAME_SANITISED)_0x$(UID_TC)_TraceDefinitions.h
b97b96f395b6 fix: calculate autogen header locations every time.
timothy.murphy@nokia.com
parents: 516
diff changeset
   214
else
b97b96f395b6 fix: calculate autogen header locations every time.
timothy.murphy@nokia.com
parents: 516
diff changeset
   215
TRACE_DICTIONARY:=$(EPOCROOT)/epoc32/ost_dictionaries/$(OLDTC_TRACE_PRJNAME_SANITISED)_0x$(UID_TC)_Dictionary.xml
b97b96f395b6 fix: calculate autogen header locations every time.
timothy.murphy@nokia.com
parents: 516
diff changeset
   216
AUTOGEN_HEADER:=$(EPOCROOT)/epoc32/include/internal/symbiantraces/autogen/$(OLDTC_TRACE_PRJNAME_SANITISED)_0x$(UID_TC)_TraceDefinitions.h
b97b96f395b6 fix: calculate autogen header locations every time.
timothy.murphy@nokia.com
parents: 516
diff changeset
   217
endif
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   218
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   219
$(eval $(trace_compile))
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   220
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   221
$(eval $(call GenerateStandardCleanTarget, $(TRACE_PATH)/tracebuilder.cache $(TRACE_MARKER) $(TRACE_SOURCE_LIST),,))
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   222
511
7581d432643a fix: support new trace compiler features for preventing clashes. Automatically turn on OST_TRACE_COMPILER_IN_USE macro. Look for trace header in systemincludes. Make directories in makefile parse to prevent clashes during build. Correct path for autogen headers. Correct case issue with autogen headers on Linux.
timothy.murphy@nokia.com
parents: 300
diff changeset
   223
$(call makepath,$(TRACE_PATH) $(dir $(TRACE_DICTIONARY) $(AUTOGEN_HEADER)))
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
   224
# End  - guard that prevents repeated calls to TCom
3
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
$(eval $(call GenerateStandardCleanTarget,$(TRACE_HEADERS),,))
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   228
516
cd8318d5fb3a Somewhat more sane choice of directory.
timothy.murphy@nokia.com
parents: 515
diff changeset
   229
# End - Nothing to trace (not trace path in include)
3
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   230
else
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   231
# Indicate to following parts of the FLM that we actually won't run
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   232
# trace compiler so they can set dependencies accordingly.
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   233
USE_TRACE_COMPILER:=
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   234
endif
e1eecf4d390d Team sf branch.
tnmurphy@4GBL06592.nokia.com
parents: 0
diff changeset
   235