• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1########################################################
2# Copyright 2015 ARM Limited. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without modification,
5# are permitted provided that the following conditions are met:
6#
7# 1. Redistributions of source code must retain the above copyright notice,
8# this list of conditions and the following disclaimer.
9#
10# 2. Redistributions in binary form must reproduce the above copyright notice,
11# this list of conditions and the following disclaimer in the documentation
12# and/or other materials provided with the distribution.
13#
14# 3. Neither the name of the copyright holder nor the names of its contributors
15# may be used to endorse or promote products derived from this software without
16# specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29#################################################################################
30# OpenCSD - makefile for main trace decode library
31#
32
33CXX := $(MASTER_CXX)
34LINKER := $(MASTER_LINKER)
35LIB := $(MASTER_LIB)
36
37LIB_NAME= lib$(LIB_BASE_NAME)
38
39BUILD_DIR=./$(PLAT_DIR)
40
41VPATH=	$(OCSD_SOURCE) \
42		$(OCSD_SOURCE)/etmv3 \
43		$(OCSD_SOURCE)/etmv4 \
44		$(OCSD_SOURCE)/ptm \
45		$(OCSD_SOURCE)/i_dec \
46		$(OCSD_SOURCE)/mem_acc \
47		$(OCSD_SOURCE)/stm \
48		$(OCSD_SOURCE)/pkt_printers
49
50
51CXX_INCLUDES= \
52				-I$(OCSD_INCLUDE) \
53				-I$(OCSD_SOURCE)
54
55ETMV3OBJ=	$(BUILD_DIR)/trc_cmp_cfg_etmv3.o \
56			$(BUILD_DIR)/trc_pkt_decode_etmv3.o \
57			$(BUILD_DIR)/trc_pkt_elem_etmv3.o \
58			$(BUILD_DIR)/trc_pkt_proc_etmv3.o \
59			$(BUILD_DIR)/trc_pkt_proc_etmv3_impl.o
60
61ETMV4OBJ=	$(BUILD_DIR)/trc_cmp_cfg_etmv4.o \
62			$(BUILD_DIR)/trc_pkt_proc_etmv4i.o \
63			$(BUILD_DIR)/trc_pkt_decode_etmv4i.o \
64			$(BUILD_DIR)/trc_pkt_elem_etmv4i.o \
65			$(BUILD_DIR)/trc_etmv4_stack_elem.o
66
67PTMOBJ=		$(BUILD_DIR)/trc_cmp_cfg_ptm.o \
68			$(BUILD_DIR)/trc_pkt_elem_ptm.o \
69			$(BUILD_DIR)/trc_pkt_proc_ptm.o \
70			$(BUILD_DIR)/trc_pkt_decode_ptm.o
71
72IDECOBJ=	$(BUILD_DIR)/trc_i_decode.o \
73			$(BUILD_DIR)/trc_idec_arminst.o
74
75MEMACCOBJ=	$(BUILD_DIR)/trc_mem_acc_mapper.o \
76			$(BUILD_DIR)/trc_mem_acc_bufptr.o \
77			$(BUILD_DIR)/trc_mem_acc_file.o \
78			$(BUILD_DIR)/trc_mem_acc_base.o \
79			$(BUILD_DIR)/trc_mem_acc_cb.o \
80			$(BUILD_DIR)/trc_mem_acc_cache.o
81
82STMOBJ=		$(BUILD_DIR)/trc_pkt_elem_stm.o \
83			$(BUILD_DIR)/trc_pkt_proc_stm.o \
84			$(BUILD_DIR)/trc_pkt_decode_stm.o
85
86PKTPRNTOBJ=	$(BUILD_DIR)/raw_frame_printer.o \
87			$(BUILD_DIR)/trc_print_fact.o
88
89
90OBJECTS=$(BUILD_DIR)/ocsd_code_follower.o \
91		$(BUILD_DIR)/ocsd_dcd_tree.o \
92		$(BUILD_DIR)/ocsd_error.o \
93		$(BUILD_DIR)/ocsd_error_logger.o \
94		$(BUILD_DIR)/ocsd_gen_elem_list.o \
95		$(BUILD_DIR)/ocsd_gen_elem_stack.o \
96		$(BUILD_DIR)/ocsd_lib_dcd_register.o \
97		$(BUILD_DIR)/ocsd_msg_logger.o \
98		$(BUILD_DIR)/ocsd_version.o \
99		$(BUILD_DIR)/trc_component.o \
100		$(BUILD_DIR)/trc_core_arch_map.o \
101		$(BUILD_DIR)/trc_frame_deformatter.o \
102		$(BUILD_DIR)/trc_gen_elem.o \
103		$(BUILD_DIR)/trc_printable_elem.o \
104		$(BUILD_DIR)/trc_ret_stack.o \
105		$(ETMV3OBJ) \
106		$(ETMV4OBJ) \
107		$(IDECOBJ) \
108		$(MEMACCOBJ) \
109		$(STMOBJ) \
110		$(PTMOBJ) \
111		$(PKTPRNTOBJ)
112
113all: links
114
115links: $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER) $(LIB_TARGET_DIR)/$(LIB_NAME).so
116.PHONY: links
117
118LIBS:= $(LIB_TARGET_DIR)/$(LIB_NAME).a $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER)
119
120$(LIB_TARGET_DIR):
121	mkdir -p $(LIB_TARGET_DIR)
122
123$(BUILD_DIR):
124	mkdir -p $(BUILD_DIR)
125
126$(LIB_TARGET_DIR)/$(LIB_NAME).a: $(OBJECTS) | $(BUILD_DIR) $(LIB_TARGET_DIR)
127	$(LIB) $(ARFLAGS) $(LIB_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS)
128
129$(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER): $(OBJECTS) | $(BUILD_DIR) $(LIB_TARGET_DIR)
130	$(LINKER) $(LDFLAGS) -shared -o $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER) -Wl,-soname,$(LIB_NAME).so.$(SO_MAJOR_VER) $(OBJECTS)
131
132$(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER): $(LIBS) | $(LIB_TARGET_DIR)
133	( cd $(LIB_TARGET_DIR);  ln -sf $(LIB_NAME).so.$(SO_VER) $(LIB_NAME).so.$(SO_MAJOR_VER) )
134
135$(LIB_TARGET_DIR)/$(LIB_NAME).so: $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER) | $(LIB_TARGET_DIR)
136	( cd $(LIB_TARGET_DIR);  ln -sf $(LIB_NAME).so.$(SO_MAJOR_VER) $(LIB_NAME).so )
137
138
139##### build rules
140
141## object dependencies
142DEPS := $(OBJECTS:%.o=%.d)
143
144-include $(DEPS)
145
146## object compile
147$(BUILD_DIR)/%.o : %.cpp | $(BUILD_DIR)
148	$(CXX) $(CXXFLAGS) $(CXX_INCLUDES) -MMD  $< -o $@
149
150
151#### clean
152.PHONY: clean
153clean:
154	rm -f $(OBJECTS)
155	rm -f $(DEPS)
156	rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).a
157	rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so*
158	-rmdir $(BUILD_DIR)
159