|
1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of the License "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # Run Trace Compiler on source files to generate trace headers and decode files |
|
16 # |
|
17 |
|
18 TRACE_PRJNAME:=$(basename $(notdir $(PROJECT_META))) |
|
19 # Find out TRACE_PATH |
|
20 TRACE_PATH:=$(strip $(foreach DIR,$(USERINCLUDE),$(filter %/traces_$(TRACE_PRJNAME),$(DIR)))) |
|
21 ifeq ($(TRACE_PATH),) |
|
22 TRACE_PATH:=$(strip $(foreach DIR,$(USERINCLUDE),$(filter %/traces,$(DIR)))) |
|
23 endif |
|
24 |
|
25 # Run trace compiler only if TRACE_PATH exists |
|
26 ifneq ($(TRACE_PATH),) |
|
27 TRACE_MARKER:=$(TRACE_MARKER_PATH)/tracecompile_$(TRACE_PRJNAME)_$(UID_TC).done |
|
28 TRACE_HEADERS:= |
|
29 |
|
30 TRACE_SOURCE_LIST:=$(TRACE_MARKER_PATH)/tracecompile_$(TRACE_PRJNAME)_$(UID_TC).sourcelist |
|
31 |
|
32 # 1. Append to or create the list of source files for trace compiler to process |
|
33 # 2. Check if the hash in trace marker remain unchanged. If not, remove marker so trace compiler will run again. |
|
34 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)) |
|
35 |
|
36 $(if $(FLMDEBUG),$(info <debug>Trace Compiler sourcelist generation output: $(X)</debug>)) |
|
37 |
|
38 $(TRACE_MARKER) : $(SOURCE) |
|
39 |
|
40 ifeq ($(GUARD_$(call sanitise,$(TRACE_MARKER))),) |
|
41 GUARD_$(call sanitise,$(TRACE_MARKER)):=1 |
|
42 |
|
43 JAVA_COMMAND:=$(SBS_JAVATC) |
|
44 TRACE_COMPILER_PATH:=$(EPOCROOT)/epoc32/tools |
|
45 TRACE_COMPILER_START:=-classpath $(TRACE_COMPILER_PATH)/tracecompiler com.nokia.tracecompiler.TraceCompiler |
|
46 |
|
47 TRACE_HEADERS:=$(foreach SRC,$(SOURCE),$(TRACE_PATH)/$(basename $(notdir $(SRC)))Traces.h) |
|
48 |
|
49 # 1. Use pipe to send inputs to trace compiler to process |
|
50 # 2. Create a hash regarding to source names and put it in marker. |
|
51 # 3. Show source names that are processed by trace compiler |
|
52 define trace_compile |
|
53 $(TRACE_MARKER) : $(PROJECT_META) |
|
54 $(call startrule,tracecompile) \ |
|
55 ( echo -en "$(TRACE_PRJNAME)\n$(PROJECT_META)\n"; \ |
|
56 $(GNUCAT) $(TRACE_SOURCE_LIST); \ |
|
57 echo -en "*ENDOFSOURCEFILES*\n" ) | \ |
|
58 $(JAVA_COMMAND) $(TRACE_COMPILER_START) $(UID_TC) && \ |
|
59 $(GNUMD5SUM) $(TRACE_SOURCE_LIST) > $(TRACE_MARKER) ; \ |
|
60 $(GNUCAT) $(TRACE_SOURCE_LIST) \ |
|
61 $(call endrule,tracecompile) |
|
62 endef |
|
63 |
|
64 $(eval $(trace_compile)) |
|
65 |
|
66 $(eval $(call GenerateStandardCleanTarget,$(TRACE_HEADERS) $(TRACE_PATH)/tracebuilder.cache $(TRACE_MARKER) $(TRACE_SOURCE_LIST),,)) |
|
67 |
|
68 # End sanity guard |
|
69 endif |
|
70 |
|
71 else |
|
72 # Indicate to following parts of the FLM that we actually won't run |
|
73 # trace compiler so they can set dependencies accordingly. |
|
74 USE_TRACE_COMPILER:= |
|
75 endif |
|
76 |