aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Poirier <mathieu.poirier@linaro.org>2017-12-11 13:39:56 -0700
committerMike Leach <mike.leach@linaro.org>2017-12-15 11:27:04 +0000
commit2b898fed3024364d3efc3282316c3ec64ff973a7 (patch)
tree9397c330d9518f6672b600a03923859247881c3d
parent7d833fdd9883d1695d932b3624d20af926402f07 (diff)
build: Adding "install" target
That way header and library files can end up in the right place on the file system, and perf tools compiled without having to specify any environment variable. Limit the header files copied to those necessary for installaion of C-API interface to the library. Install list maintained in the C-API makefile. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Mike Leach <mike.leach@linaro.org>
-rw-r--r--decoder/build/linux/makefile17
-rw-r--r--decoder/build/linux/rctdl_c_api_lib/makefile23
2 files changed, 40 insertions, 0 deletions
diff --git a/decoder/build/linux/makefile b/decoder/build/linux/makefile
index c9724bbfb371..24152d38c319 100644
--- a/decoder/build/linux/makefile
+++ b/decoder/build/linux/makefile
@@ -61,11 +61,18 @@ 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_CPP=$(CROSS_COMPILE)g++
export MASTER_LINKER=$(CROSS_COMPILE)g++
export MASTER_LIB=$(CROSS_COMPILE)ar
+INSTALL=install
+
+# installation directory
+INSTALL_LIB_DIR=/usr/lib/
+export INSTALL_INCLUDE_DIR=/usr/include/
# compile flags
MASTER_CC_FLAGS := -c -Wall -DLINUX
@@ -125,6 +132,11 @@ all: libs tests
libs: $(LIB_BASE_NAME)_lib $(LIB_CAPI_NAME)_lib
+install: libs
+ $(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so $(INSTALL_LIB_DIR)/
+ $(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so $(INSTALL_LIB_DIR)/
+ cd $(OCSD_ROOT)/build/linux/rctdl_c_api_lib && make install_inc
+
################################
# build OpenCSD trace decode library
#
@@ -177,3 +189,8 @@ clean_tests:
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
+
+clean_install:
+ rm -f $(INSTALL_LIB_DIR)/lib$(LIB_BASE_NAME).so
+ rm -f $(INSTALL_LIB_DIR)/lib$(LIB_CAPI_NAME).so
+ rm -rf $(INSTALL_INCLUDE_DIR)/$(LIB_UAPI_INC_DIR)
diff --git a/decoder/build/linux/rctdl_c_api_lib/makefile b/decoder/build/linux/rctdl_c_api_lib/makefile
index 1b8cf906b47b..4f70dc97c995 100644
--- a/decoder/build/linux/rctdl_c_api_lib/makefile
+++ b/decoder/build/linux/rctdl_c_api_lib/makefile
@@ -52,6 +52,8 @@ CPP_INCLUDES= \
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: build_dir $(OBJECTS)
mkdir -p $(LIB_TARGET_DIR)
@@ -80,3 +82,24 @@ clean:
rm -f $(DEPS)
rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).a
rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so
+
+#### install the necessary include files for the c-api library on linux
+install_inc:
+ mkdir -p $(INST_INC_DST)/
+ cp -d $(INST_INC_SRC)/trc_gen_elem_types.h $(INST_INC_DST)/.
+ cp -d $(INST_INC_SRC)/ocsd_if_types.h $(INST_INC_DST)/.
+ cp -d $(INST_INC_SRC)/trc_pkt_types.h $(INST_INC_DST)/.
+ mkdir -p $(INST_INC_DST)/ptm
+ cp -d $(INST_INC_SRC)/ptm/trc_pkt_types_ptm.h $(INST_INC_DST)/ptm/.
+ mkdir -p $(INST_INC_DST)/stm
+ cp -d $(INST_INC_SRC)/stm/trc_pkt_types_stm.h $(INST_INC_DST)/stm/.
+ mkdir -p $(INST_INC_DST)/etmv3
+ cp -d $(INST_INC_SRC)/etmv3/trc_pkt_types_etmv3.h $(INST_INC_DST)/etmv3/.
+ mkdir -p $(INST_INC_DST)/etmv4
+ cp -d $(INST_INC_SRC)/etmv4/trc_pkt_types_etmv4.h $(INST_INC_DST)/etmv4/.
+ mkdir -p $(INST_INC_DST)/c_api
+ cp -d $(INST_INC_SRC)/c_api/ocsd_c_api_types.h $(INST_INC_DST)/c_api/.
+ cp -d $(INST_INC_SRC)/c_api/opencsd_c_api.h $(INST_INC_DST)/c_api/.
+ cp -d $(INST_INC_SRC)/c_api/ocsd_c_api_custom.h $(INST_INC_DST)/c_api/.
+
+