diff options
Diffstat (limited to 'decoder/build/linux')
-rw-r--r-- | decoder/build/linux/makefile | 213 | ||||
-rw-r--r-- | decoder/build/linux/makefile.dev | 70 | ||||
-rw-r--r-- | decoder/build/linux/rctdl_c_api_lib/makefile | 123 | ||||
-rw-r--r-- | decoder/build/linux/ref_trace_decode_lib/makefile | 160 |
4 files changed, 566 insertions, 0 deletions
diff --git a/decoder/build/linux/makefile b/decoder/build/linux/makefile new file mode 100644 index 0000000..5515737 --- /dev/null +++ b/decoder/build/linux/makefile @@ -0,0 +1,213 @@ +######################################################## +# Copyright 2015 ARM Limited. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +################################################################################# +# OpenCSD - master makefile for libraries and tests +# +# command line options +# DEBUG=1 create a debug build +# + +# Set project root - relative to build makefile +ifeq ($(OCSD_ROOT),) +OCSD_ROOT := $(shell echo $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) | sed 's,/build/linux.*,,') +export OCSD_ROOT +endif + +# library names +LIB_BASE_NAME=opencsd +export LIB_BASE_NAME +LIB_CAPI_NAME=$(LIB_BASE_NAME)_c_api +export LIB_CAPI_NAME + +# source root directories +export OCSD_LIB_ROOT=$(OCSD_ROOT)/lib + +export OCSD_INCLUDE=$(OCSD_ROOT)/include +export OCSD_SOURCE=$(OCSD_ROOT)/source + +export OCSD_TESTS=$(OCSD_ROOT)/tests +export LIB_UAPI_INC_DIR=opencsd + +# tools +export MASTER_CC=$(CROSS_COMPILE)gcc +export MASTER_CXX=$(CROSS_COMPILE)g++ +export MASTER_LINKER=$(CROSS_COMPILE)g++ +export MASTER_LIB=$(CROSS_COMPILE)ar +export INSTALL=install + + +# installation directory +PREFIX ?=/usr +LIB_PATH ?= lib +INSTALL_LIB_DIR=$(DESTDIR)$(PREFIX)/$(LIB_PATH) +INSTALL_BIN_DIR=$(DESTDIR)$(PREFIX)/bin +export INSTALL_INCLUDE_DIR=$(DESTDIR)$(PREFIX)/include/ +INSTALL_MAN_DIR=$(DESTDIR)$(PREFIX)/share/man/man1 + +# compile flags +CFLAGS += $(CPPFLAGS) -c -Wall -DLINUX -Wno-switch -Wlogical-op -fPIC +CXXFLAGS += $(CPPFLAGS) -c -Wall -DLINUX -Wno-switch -Wlogical-op -fPIC -std=c++11 +LDFLAGS += -Wl,-z,defs +ARFLAGS ?= rcs + +# debug variant +ifdef DEBUG +CFLAGS += -g -O0 -DDEBUG +CXXFLAGS += -g -O0 -DDEBUG +BUILD_VARIANT=dbg +else +CFLAGS += -O2 -DNDEBUG +CXXFLAGS += -O2 -DNDEBUG +BUILD_VARIANT=rel +endif + +# export build flags +export CFLAGS +export CXXFLAGS +export LDFLAGS +export ARFLAGS + +# target directories - fixed for default packaging build +PLAT_DIR ?= builddir +export PLAT_DIR +export LIB_TARGET_DIR=$(OCSD_LIB_ROOT)/$(PLAT_DIR) +export LIB_TEST_TARGET_DIR=$(OCSD_TESTS)/lib/$(PLAT_DIR) +export BIN_TEST_TARGET_DIR=$(OCSD_TESTS)/bin/$(PLAT_DIR) + +# Fish version out of header file (converting from hex) +getver:=printf "%d" $$(awk '/\#define VARNAME/ { print $$3 }' $(OCSD_ROOT)/include/opencsd/ocsd_if_version.h) +export SO_MAJOR_VER := $(shell $(subst VARNAME,OCSD_VER_MAJOR,$(getver))) +SO_MINOR_VER := $(shell $(subst VARNAME,OCSD_VER_MINOR,$(getver))) +SO_PATCH_VER := $(shell $(subst VARNAME,OCSD_VER_PATCH,$(getver))) +export SO_VER := $(SO_MAJOR_VER).$(SO_MINOR_VER).$(SO_PATCH_VER) + + +########################################################### +# build targets + +all: libs tests + +libs: $(LIB_BASE_NAME)_lib $(LIB_CAPI_NAME)_lib + +DEF_SO_PERM ?= 644 + +install: libs tests + mkdir -p $(INSTALL_LIB_DIR) $(INSTALL_INCLUDE_DIR) $(INSTALL_BIN_DIR) + cp -d $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so $(INSTALL_LIB_DIR)/ + cp -d $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so.$(SO_MAJOR_VER) $(INSTALL_LIB_DIR)/ + $(INSTALL) --mode=$(DEF_SO_PERM) $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so.$(SO_VER) $(INSTALL_LIB_DIR)/ + cp -d $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so $(INSTALL_LIB_DIR)/ + cp -d $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so.$(SO_MAJOR_VER) $(INSTALL_LIB_DIR)/ + $(INSTALL) --mode=$(DEF_SO_PERM) $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so.$(SO_VER) $(INSTALL_LIB_DIR)/ +ifndef DISABLE_STATIC + $(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).a $(INSTALL_LIB_DIR)/ + $(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).a $(INSTALL_LIB_DIR)/ +endif + cd $(OCSD_ROOT)/build/linux/rctdl_c_api_lib && make install_inc + $(INSTALL) --mode=755 $(BIN_TEST_TARGET_DIR)/trc_pkt_lister $(INSTALL_BIN_DIR)/ + +install_man: + mkdir -p $(INSTALL_MAN_DIR) + $(INSTALL) --mode=644 $(OCSD_ROOT)/docs/man/trc_pkt_lister.1 $(INSTALL_MAN_DIR)/ + + +################################ +# build OpenCSD trace decode library +# +$(LIB_BASE_NAME)_lib: $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).a $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so + +$(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so: $(LIB_BASE_NAME)_all +$(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).a: $(LIB_BASE_NAME)_all + +# single command builds both .a and .so targets in sub-makefile +$(LIB_BASE_NAME)_all: + mkdir -p $(LIB_TARGET_DIR) + cd $(OCSD_ROOT)/build/linux/ref_trace_decode_lib && $(MAKE) + +################################ +# build OpenCSD trace decode C API library +# +$(LIB_CAPI_NAME)_lib: $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).a $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so + +$(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so: $(LIB_CAPI_NAME)_all +$(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).a: $(LIB_CAPI_NAME)_all + +# single command builds both .a and .so targets in sub-makefile +$(LIB_CAPI_NAME)_all: $(LIB_BASE_NAME)_lib + mkdir -p $(LIB_TARGET_DIR) + cd $(OCSD_ROOT)/build/linux/rctdl_c_api_lib && $(MAKE) + +################################# +# build tests + +.PHONY: tests +tests: libs + cd $(OCSD_ROOT)/tests/build/linux/echo_test_dcd_lib && $(MAKE) + cd $(OCSD_ROOT)/tests/build/linux/snapshot_parser_lib && $(MAKE) + cd $(OCSD_ROOT)/tests/build/linux/trc_pkt_lister && $(MAKE) + cd $(OCSD_ROOT)/tests/build/linux/c_api_pkt_print_test && $(MAKE) + cd $(OCSD_ROOT)/tests/build/linux/mem_buffer_eg && $(MAKE) + cd $(OCSD_ROOT)/tests/build/linux/frame_demux_test && $(MAKE) + +# +# build docs +.PHONY: docs +docs: + (cd $(OCSD_ROOT)/docs; doxygen doxygen_config.dox) + + +############################################################# +# clean targets +# +clean: clean_libs clean_tests clean_docs + +.PHONY: clean_libs clean_tests clean_docs clean_install + +clean_libs: + cd $(OCSD_ROOT)/build/linux/ref_trace_decode_lib && $(MAKE) clean + cd $(OCSD_ROOT)/build/linux/rctdl_c_api_lib && $(MAKE) clean + +clean_tests: + cd $(OCSD_ROOT)/tests/build/linux/echo_test_dcd_lib && $(MAKE) clean + cd $(OCSD_ROOT)/tests/build/linux/snapshot_parser_lib && $(MAKE) clean + cd $(OCSD_ROOT)/tests/build/linux/trc_pkt_lister && $(MAKE) clean + cd $(OCSD_ROOT)/tests/build/linux/c_api_pkt_print_test && $(MAKE) clean + cd $(OCSD_ROOT)/tests/build/linux/mem_buffer_eg && $(MAKE) clean + cd $(OCSD_ROOT)/tests/build/linux/frame_demux_test && $(MAKE) clean + -rmdir $(OCSD_TESTS)/lib + +clean_docs: + -rm -r $(OCSD_ROOT)/docs/html + +clean_install: + -rm $(INSTALL_LIB_DIR)/lib$(LIB_BASE_NAME).* + -rm $(INSTALL_LIB_DIR)/lib$(LIB_CAPI_NAME).* + -rm -r $(INSTALL_INCLUDE_DIR)/$(LIB_UAPI_INC_DIR) + -rm $(INSTALL_BIN_DIR)/trc_pkt_lister + -rm $(INSTALL_MAN_DIR)/trc_pkt_lister.1 diff --git a/decoder/build/linux/makefile.dev b/decoder/build/linux/makefile.dev new file mode 100644 index 0000000..aaaa983 --- /dev/null +++ b/decoder/build/linux/makefile.dev @@ -0,0 +1,70 @@ +######################################################## +# Copyright 2018 ARM Limited. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +################################################################################# + +## Set up some addtional parameters for development environment builds. ## + +## define arch/build sub-dirs for non installed dev builds +ifndef ARCH +ARCH := $(shell dpkg-architecture -q DEB_HOST_GNU_CPU || echo not) +endif + +# platform bit size variant +ifeq ($(ARCH),x86) + MFLAG:="-m32" + BIT_VARIANT=32 +else ifeq ($(ARCH),x86_64) + MFLAG:="-m64" + BIT_VARIANT=64 +else ifeq ($(ARCH),arm) + BIT_VARIANT=-arm +else ifeq ($(ARCH),arm64) + BIT_VARIANT=-arm64 +else ifeq ($(ARCH),aarch64) + BIT_VARIANT=-arm64 +else ifeq ($(ARCH),aarch32) + BIT_VARIANT=-arm +endif + +CXXFLAGS += $(MFLAG) +CFLAGS += $(MFLAG) +LDFLAGS += $(MFLAG) + +ifdef GCCDIR +GCCVER:= $(shell $(CROSS_COMPILE)gcc -dumpversion | cut -c 1-3) +PLAT_DIR=builddir/linux$(BIT_VARIANT)/GCC_$(GCCVER) +else +PLAT_DIR=linux$(BIT_VARIANT)/$(BUILD_VARIANT) +endif + +# for dev env, enable static link build test +export TEST_STATIC_LINKING=1 + +# include the main makefile +include makefile diff --git a/decoder/build/linux/rctdl_c_api_lib/makefile b/decoder/build/linux/rctdl_c_api_lib/makefile new file mode 100644 index 0000000..7b4055d --- /dev/null +++ b/decoder/build/linux/rctdl_c_api_lib/makefile @@ -0,0 +1,123 @@ +######################################################## +# Copyright 2015 ARM Limited. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +################################################################################# +# OpenCSD - makefile for C API wrapper library +# + +CXX := $(MASTER_CXX) +LINKER := $(MASTER_LINKER) +LIB := $(MASTER_LIB) + +LIB_NAME = lib$(LIB_CAPI_NAME) +SO_LIB_DEPS= -L$(LIB_TARGET_DIR) -l$(LIB_BASE_NAME) + +BUILD_DIR=./$(PLAT_DIR) + +VPATH= $(OCSD_SOURCE)/c_api + +CXX_INCLUDES= \ + -I$(OCSD_INCLUDE) \ + -I$(OCSD_SOURCE)/c_api + +OBJECTS=$(BUILD_DIR)/ocsd_c_api.o \ + $(BUILD_DIR)/ocsd_c_api_custom_obj.o + +INST_INC_SRC=$(OCSD_INCLUDE)/$(LIB_UAPI_INC_DIR) +INST_INC_DST=$(INSTALL_INCLUDE_DIR)/$(LIB_UAPI_INC_DIR) + +all: links + +links: $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER) $(LIB_TARGET_DIR)/$(LIB_NAME).so +.PHONY: links + +LIBS:= $(LIB_TARGET_DIR)/$(LIB_NAME).a $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER) + +$(LIB_TARGET_DIR): + mkdir -p $(LIB_TARGET_DIR) + +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) + +$(LIB_TARGET_DIR)/$(LIB_NAME).a: $(OBJECTS) | $(BUILD_DIR) $(LIB_TARGET_DIR) + $(LIB) $(ARFLAGS) $(LIB_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS) + +$(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER): $(OBJECTS) | $(BUILD_DIR) $(LIB_TARGET_DIR) + $(LINKER) $(LDFLAGS) -shared -o $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER) -Wl,-soname,$(LIB_NAME).so.$(SO_MAJOR_VER) $(OBJECTS) $(SO_LIB_DEPS) + +$(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER): $(LIBS) | $(LIB_TARGET_DIR) + ( cd $(LIB_TARGET_DIR); ln -sf $(LIB_NAME).so.$(SO_VER) $(LIB_NAME).so.$(SO_MAJOR_VER) ) + +$(LIB_TARGET_DIR)/$(LIB_NAME).so: $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER) | $(LIB_TARGET_DIR) + ( cd $(LIB_TARGET_DIR); ln -sf $(LIB_NAME).so.$(SO_MAJOR_VER) $(LIB_NAME).so ) + + +##### build rules + +## object dependencies +DEPS := $(OBJECTS:%.o=%.d) + +-include $(DEPS) + +## object compile +$(BUILD_DIR)/%.o : %.cpp | $(BUILD_DIR) + $(CXX) $(CXXFLAGS) $(CXX_INCLUDES) -MMD $< -o $@ + + +#### clean +.PHONY: clean +clean: + rm -f $(OBJECTS) + rm -f $(DEPS) + rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).a + rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so* + -rmdir $(BUILD_DIR) + +#### install the necessary include files for the c-api library on linux +install_inc: + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/trc_gen_elem_types.h $(INST_INC_DST)/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/ocsd_if_types.h $(INST_INC_DST)/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/ocsd_if_version.h $(INST_INC_DST)/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/trc_pkt_types.h $(INST_INC_DST)/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/ptm + $(INSTALL) --mode=0644 $(INST_INC_SRC)/ptm/trc_pkt_types_ptm.h $(INST_INC_DST)/ptm/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/stm + $(INSTALL) --mode=0644 $(INST_INC_SRC)/stm/trc_pkt_types_stm.h $(INST_INC_DST)/stm/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/etmv3 + $(INSTALL) --mode=0644 $(INST_INC_SRC)/etmv3/trc_pkt_types_etmv3.h $(INST_INC_DST)/etmv3/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/etmv4 + $(INSTALL) --mode=0644 $(INST_INC_SRC)/etmv4/trc_pkt_types_etmv4.h $(INST_INC_DST)/etmv4/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/ete + $(INSTALL) --mode=0644 $(INST_INC_SRC)/ete/trc_pkt_types_ete.h $(INST_INC_DST)/ete/ + $(INSTALL) -d --mode=0755 $(INST_INC_DST)/c_api + $(INSTALL) --mode=0644 $(INST_INC_SRC)/c_api/ocsd_c_api_types.h $(INST_INC_DST)/c_api/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/c_api/opencsd_c_api.h $(INST_INC_DST)/c_api/ + $(INSTALL) --mode=0644 $(INST_INC_SRC)/c_api/ocsd_c_api_custom.h $(INST_INC_DST)/c_api/ + + diff --git a/decoder/build/linux/ref_trace_decode_lib/makefile b/decoder/build/linux/ref_trace_decode_lib/makefile new file mode 100644 index 0000000..58d5c6e --- /dev/null +++ b/decoder/build/linux/ref_trace_decode_lib/makefile @@ -0,0 +1,160 @@ +######################################################## +# Copyright 2015 ARM Limited. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +################################################################################# +# OpenCSD - makefile for main trace decode library +# + +CXX := $(MASTER_CXX) +LINKER := $(MASTER_LINKER) +LIB := $(MASTER_LIB) + +LIB_NAME= lib$(LIB_BASE_NAME) + +BUILD_DIR=./$(PLAT_DIR) + +VPATH= $(OCSD_SOURCE) \ + $(OCSD_SOURCE)/etmv3 \ + $(OCSD_SOURCE)/etmv4 \ + $(OCSD_SOURCE)/ete \ + $(OCSD_SOURCE)/ptm \ + $(OCSD_SOURCE)/i_dec \ + $(OCSD_SOURCE)/mem_acc \ + $(OCSD_SOURCE)/stm \ + $(OCSD_SOURCE)/pkt_printers + + +CXX_INCLUDES= \ + -I$(OCSD_INCLUDE) \ + -I$(OCSD_SOURCE) + +ETMV3OBJ= $(BUILD_DIR)/trc_cmp_cfg_etmv3.o \ + $(BUILD_DIR)/trc_pkt_decode_etmv3.o \ + $(BUILD_DIR)/trc_pkt_elem_etmv3.o \ + $(BUILD_DIR)/trc_pkt_proc_etmv3.o \ + $(BUILD_DIR)/trc_pkt_proc_etmv3_impl.o + +ETMV4OBJ= $(BUILD_DIR)/trc_cmp_cfg_etmv4.o \ + $(BUILD_DIR)/trc_etmv4_stack_elem.o \ + $(BUILD_DIR)/trc_pkt_proc_etmv4i.o \ + $(BUILD_DIR)/trc_pkt_decode_etmv4i.o \ + $(BUILD_DIR)/trc_pkt_elem_etmv4i.o \ + $(BUILD_DIR)/trc_cmp_cfg_ete.o + +PTMOBJ= $(BUILD_DIR)/trc_cmp_cfg_ptm.o \ + $(BUILD_DIR)/trc_pkt_elem_ptm.o \ + $(BUILD_DIR)/trc_pkt_proc_ptm.o \ + $(BUILD_DIR)/trc_pkt_decode_ptm.o + +IDECOBJ= $(BUILD_DIR)/trc_i_decode.o \ + $(BUILD_DIR)/trc_idec_arminst.o + +MEMACCOBJ= $(BUILD_DIR)/trc_mem_acc_mapper.o \ + $(BUILD_DIR)/trc_mem_acc_bufptr.o \ + $(BUILD_DIR)/trc_mem_acc_file.o \ + $(BUILD_DIR)/trc_mem_acc_base.o \ + $(BUILD_DIR)/trc_mem_acc_cb.o \ + $(BUILD_DIR)/trc_mem_acc_cache.o + +STMOBJ= $(BUILD_DIR)/trc_pkt_elem_stm.o \ + $(BUILD_DIR)/trc_pkt_proc_stm.o \ + $(BUILD_DIR)/trc_pkt_decode_stm.o + +PKTPRNTOBJ= $(BUILD_DIR)/raw_frame_printer.o \ + $(BUILD_DIR)/trc_print_fact.o + + +OBJECTS=$(BUILD_DIR)/ocsd_code_follower.o \ + $(BUILD_DIR)/ocsd_dcd_tree.o \ + $(BUILD_DIR)/ocsd_error.o \ + $(BUILD_DIR)/ocsd_error_logger.o \ + $(BUILD_DIR)/ocsd_gen_elem_list.o \ + $(BUILD_DIR)/ocsd_gen_elem_stack.o \ + $(BUILD_DIR)/ocsd_lib_dcd_register.o \ + $(BUILD_DIR)/ocsd_msg_logger.o \ + $(BUILD_DIR)/ocsd_version.o \ + $(BUILD_DIR)/trc_component.o \ + $(BUILD_DIR)/trc_core_arch_map.o \ + $(BUILD_DIR)/trc_frame_deformatter.o \ + $(BUILD_DIR)/trc_gen_elem.o \ + $(BUILD_DIR)/trc_printable_elem.o \ + $(BUILD_DIR)/trc_ret_stack.o \ + $(ETMV3OBJ) \ + $(ETMV4OBJ) \ + $(IDECOBJ) \ + $(MEMACCOBJ) \ + $(STMOBJ) \ + $(PTMOBJ) \ + $(PKTPRNTOBJ) + +all: links + +links: $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER) $(LIB_TARGET_DIR)/$(LIB_NAME).so +.PHONY: links + +LIBS:= $(LIB_TARGET_DIR)/$(LIB_NAME).a $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER) + +$(LIB_TARGET_DIR): + mkdir -p $(LIB_TARGET_DIR) + +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) + +$(LIB_TARGET_DIR)/$(LIB_NAME).a: $(OBJECTS) | $(BUILD_DIR) $(LIB_TARGET_DIR) + $(LIB) $(ARFLAGS) $(LIB_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS) + +$(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER): $(OBJECTS) | $(BUILD_DIR) $(LIB_TARGET_DIR) + $(LINKER) $(LDFLAGS) -shared -o $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER) -Wl,-soname,$(LIB_NAME).so.$(SO_MAJOR_VER) $(OBJECTS) + +$(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER): $(LIBS) | $(LIB_TARGET_DIR) + ( cd $(LIB_TARGET_DIR); ln -sf $(LIB_NAME).so.$(SO_VER) $(LIB_NAME).so.$(SO_MAJOR_VER) ) + +$(LIB_TARGET_DIR)/$(LIB_NAME).so: $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER) | $(LIB_TARGET_DIR) + ( cd $(LIB_TARGET_DIR); ln -sf $(LIB_NAME).so.$(SO_MAJOR_VER) $(LIB_NAME).so ) + + +##### build rules + +## object dependencies +DEPS := $(OBJECTS:%.o=%.d) + +-include $(DEPS) + +## object compile +$(BUILD_DIR)/%.o : %.cpp | $(BUILD_DIR) + $(CXX) $(CXXFLAGS) $(CXX_INCLUDES) -MMD $< -o $@ + + +#### clean +.PHONY: clean +clean: + rm -f $(OBJECTS) + rm -f $(DEPS) + rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).a + rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so* + -rmdir $(BUILD_DIR) |