author | Jon Chatten |
Tue, 30 Mar 2010 15:24:50 +0100 | |
branch | fix |
changeset 421 | 7db5250b5d4c |
parent 300 | e87b08dc4b44 |
child 511 | 7581d432643a |
permissions | -rw-r--r-- |
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 | 2 |
# All rights reserved. |
3 |
# This component and the accompanying materials are made available |
|
4 |
# under the terms of the License "Eclipse Public License v1.0" |
|
5 |
# which accompanies this distribution, and is available |
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
# |
|
8 |
# Initial Contributors: |
|
9 |
# Nokia Corporation - initial contribution. |
|
10 |
# |
|
11 |
# Contributors: |
|
12 |
# |
|
13 |
# Description: |
|
14 |
# Run Trace Compiler on source files to generate trace headers and decode files |
|
15 |
||
277
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
16 |
# Set project name as <mmp_name> |
3 | 17 |
TRACE_PRJNAME:=$(basename $(notdir $(PROJECT_META))) |
277
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
18 |
|
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
19 |
TARGETEXT:=$(if $(REQUESTEDTARGETEXT),$(REQUESTEDTARGETEXT),$(POSTLINKFILETYPE)) |
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
20 |
|
3 | 21 |
# Find out TRACE_PATH |
277
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
22 |
# first look for .*/traces/traces_<target_name>_<target_extension> |
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
23 |
TRACE_PATH:=$(strip $(foreach DIR,$(USERINCLUDE),$(filter %/traces/traces_$(TARGET)_$(TARGETEXT),$(DIR)))) |
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
24 |
|
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
25 |
ifneq ($(TRACE_PATH),) |
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
26 |
# set project name as <target_name>_<target_extension> instead of <mmp_name> |
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
27 |
TRACE_PRJNAME:=$(TARGET)_$(TARGETEXT) |
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
28 |
endif |
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
29 |
|
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
30 |
# if not found look for .*/traces_<mmp_name> |
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
31 |
ifeq ($(TRACE_PATH),) |
3 | 32 |
TRACE_PATH:=$(strip $(foreach DIR,$(USERINCLUDE),$(filter %/traces_$(TRACE_PRJNAME),$(DIR)))) |
277
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
33 |
endif |
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
34 |
|
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
35 |
# if not found look for .*/traces |
3 | 36 |
ifeq ($(TRACE_PATH),) |
37 |
TRACE_PATH:=$(strip $(foreach DIR,$(USERINCLUDE),$(filter %/traces,$(DIR)))) |
|
38 |
endif |
|
277
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
39 |
|
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
40 |
# if not found look for .*/traces_<target_name>_<target_type> |
3 | 41 |
ifeq ($(TRACE_PATH),) |
42 |
TRACE_PATH:=$(strip $(foreach DIR,$(USERINCLUDE),$(filter %/traces_$(TARGET)_$(TARGETTYPE),$(DIR)))) |
|
277
dbd582b8c0ab
SF Bug 1562 - [Raptor] Tracecompiler SYSTEMINCLUDE should be based on TARGETEXT not TARGETTYPE
timothy.murphy@nokia.com
parents:
236
diff
changeset
|
43 |
# set project name as <target_name>_<target_type> instead of <mmp_name> |
3 | 44 |
TRACE_PRJNAME:=$(TARGET)_$(TARGETTYPE) |
45 |
endif |
|
46 |
||
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
|
47 |
# 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
|
48 |
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
|
49 |
AUTOGEN_HEADER:= |
161
62c28226cde4
Bug 1494 - Trace compiler files not in whatlog - FIX and TESTS though UNTESTED
Iain Williamson <iain.williamson@nokia.com>
parents:
3
diff
changeset
|
50 |
|
3 | 51 |
$(if $(FLMDEBUG),$(info <debug>TRACE_PATH = $(TRACE_PATH)</debug>)) |
52 |
||
53 |
# Run trace compiler only if TRACE_PATH exists |
|
54 |
ifneq ($(TRACE_PATH),) |
|
55 |
TRACE_MARKER:=$(TRACE_MARKER_PATH)/tracecompile_$(TRACE_PRJNAME)_$(UID_TC).done |
|
56 |
TRACE_HEADERS:= |
|
57 |
||
58 |
TRACE_SOURCE_LIST:=$(TRACE_MARKER_PATH)/tracecompile_$(TRACE_PRJNAME)_$(UID_TC).sourcelist |
|
59 |
||
60 |
# 1. Append to or create the list of source files for trace compiler to process |
|
61 |
# 2. Check if the hash in trace marker remain unchanged. If not, remove marker so trace compiler will run again. |
|
62 |
X:=$(shell set -x ; $(GNUMKDIR) -p $(TRACE_MARKER_PATH) ; $(GNUTOUCH) $(TRACE_SOURCE_LIST) ; echo -e "$(subst $(CHAR_SPACE),\\n,$(SOURCE))" | $(GNUSORT) -u $(TRACE_SOURCE_LIST) - > $(TRACE_SOURCE_LIST).tmp && $(GNUMV) $(TRACE_SOURCE_LIST).tmp $(TRACE_SOURCE_LIST) ; $(GNUMD5SUM) -c $(TRACE_MARKER) || $(GNURM) $(TRACE_MARKER)) |
|
63 |
||
64 |
$(if $(FLMDEBUG),$(info <debug>Trace Compiler sourcelist generation output: $(X)</debug>)) |
|
65 |
||
66 |
$(TRACE_MARKER) : $(SOURCE) |
|
67 |
||
68 |
TRACE_HEADERS:=$(foreach SRC,$(SOURCE),$(TRACE_PATH)/$(basename $(notdir $(SRC)))Traces.h) |
|
69 |
||
70 |
$(TRACE_HEADERS): $(TRACE_MARKER) |
|
71 |
||
72 |
ifeq ($(GUARD_$(call sanitise,$(TRACE_MARKER))),) |
|
73 |
GUARD_$(call sanitise,$(TRACE_MARKER)):=1 |
|
74 |
||
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
|
75 |
# 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
|
76 |
# 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
|
77 |
TRACE_PRJNAME_SANITISED:=$(subst .,_,$(TRACE_PRJNAME)) |
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
|
78 |
|
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
|
79 |
TRACE_DICTIONARY:=$(EPOCROOT)/epoc32/ost_dictionaries/$(TRACE_PRJNAME_SANITISED)_0x$(UID_TC)_Dictionary.xml |
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
|
80 |
AUTOGEN_HEADER:=$(EPOCROOT)/epoc32/include/internal/SymbianTraces/autogen/$(TRACE_PRJNAME_SANITISED)_0x$(UID_TC)_TraceDefinitions.h |
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
|
81 |
|
3 | 82 |
JAVA_COMMAND:=$(SBS_JAVATC) |
83 |
TRACE_COMPILER_PATH:=$(EPOCROOT)/epoc32/tools |
|
84 |
TRACE_COMPILER_START:=-classpath $(TRACE_COMPILER_PATH)/tracecompiler com.nokia.tracecompiler.TraceCompiler |
|
85 |
||
86 |
||
87 |
# 1. Use pipe to send inputs to trace compiler to process |
|
88 |
# 2. Create a hash regarding to source names and put it in marker. |
|
89 |
# 3. Show source names that are processed by trace compiler |
|
90 |
define trace_compile |
|
91 |
$(TRACE_MARKER) : $(PROJECT_META) |
|
92 |
$(call startrule,tracecompile) \ |
|
93 |
( echo -en "$(TRACE_PRJNAME)\n$(PROJECT_META)\n"; \ |
|
94 |
$(GNUCAT) $(TRACE_SOURCE_LIST); \ |
|
95 |
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
|
96 |
$(JAVA_COMMAND) $(TRACE_COMPILER_START) $(UID_TC) && \ |
89
315b0aa777bd
Make TC fail when there is an error. This is hypothetical in this version but the next version of the TC is in testing.
timothy.murphy@nokia.com
parents:
3
diff
changeset
|
97 |
$(GNUMD5SUM) $(TRACE_SOURCE_LIST) > $(TRACE_MARKER) && \ |
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
|
98 |
{ $(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
|
99 |
$(GNUCAT) $(TRACE_SOURCE_LIST) ; true ; } \ |
3 | 100 |
$(call endrule,tracecompile) |
101 |
endef |
|
102 |
||
103 |
$(eval $(trace_compile)) |
|
104 |
||
105 |
$(eval $(call GenerateStandardCleanTarget, $(TRACE_PATH)/tracebuilder.cache $(TRACE_MARKER) $(TRACE_SOURCE_LIST),,)) |
|
106 |
||
107 |
# End sanity guard |
|
108 |
endif |
|
109 |
||
110 |
$(eval $(call GenerateStandardCleanTarget,$(TRACE_HEADERS),,)) |
|
111 |
||
112 |
else |
|
113 |
# Indicate to following parts of the FLM that we actually won't run |
|
114 |
# trace compiler so they can set dependencies accordingly. |
|
115 |
USE_TRACE_COMPILER:= |
|
116 |
endif |
|
117 |