Rework makefile variables and some operations for compatibility with normal distribution pratices. Single build directory for all archs / rel /debug variants.
Extract lib .so versions based on ocsd_version.h
Add in development makefile to retain multiple simultaneous build arch / types in dir structure.
Based on original patchset created-by: Wookey wookey@wookware.org Signed-off-by: Mike Leach mike.leach@linaro.org --- decoder/build/linux/makefile | 120 +++++++++++---------- decoder/build/linux/makefile.dev | 62 +++++++++++ decoder/build/linux/rctdl_c_api_lib/makefile | 43 +++++--- decoder/build/linux/ref_trace_decode_lib/makefile | 41 ++++--- .../build/linux/c_api_pkt_print_test/makefile | 12 +-- .../tests/build/linux/echo_test_dcd_lib/makefile | 16 ++- .../tests/build/linux/snapshot_parser_lib/makefile | 18 ++-- decoder/tests/build/linux/trc_pkt_lister/makefile | 18 ++-- 8 files changed, 210 insertions(+), 120 deletions(-) create mode 100644 decoder/build/linux/makefile.dev
diff --git a/decoder/build/linux/makefile b/decoder/build/linux/makefile index 330829b..4cd2f5f 100644 --- a/decoder/build/linux/makefile +++ b/decoder/build/linux/makefile @@ -33,9 +33,9 @@ # DEBUG=1 create a debug build #
-# Set project root - relative to build directory +# Set project root - relative to build makefile ifeq ($(OCSD_ROOT),) -OCSD_ROOT := $(shell pwd | sed 's,/build/linux.*,,') +OCSD_ROOT := $(shell echo $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) | sed 's,/build/linux.*,,') export OCSD_ROOT endif
@@ -45,14 +45,6 @@ export LIB_BASE_NAME LIB_CAPI_NAME=$(LIB_BASE_NAME)_c_api export LIB_CAPI_NAME
-# determine base architecture, heavily borrowed from the Linux kernel v4.4's -# tools/perf/config/Makefile.arch -# For example, to compile for arm64 on a X86 PC, you can issue the command: -# "export ARCH=arm64" -ifndef ARCH -ARCH := $(shell uname -m 2>/dev/null || echo not) -endif - # source root directories export OCSD_LIB_ROOT=$(OCSD_ROOT)/lib
@@ -60,71 +52,61 @@ 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_CPP=$(CROSS_COMPILE)g++ +export MASTER_CXX=$(CROSS_COMPILE)g++ export MASTER_LINKER=$(CROSS_COMPILE)g++ export MASTER_LIB=$(CROSS_COMPILE)ar export INSTALL=install
+ # installation directory -INSTALL_LIB_DIR=/usr/lib/ -export INSTALL_INCLUDE_DIR=/usr/include/ +PREFIX ?=/usr +LIB_PATH ?= lib +INSTALL_LIB_DIR=$(PREFIX)/$(LIB_PATH) +INSTALL_BIN_DIR=$(PREFIX)/bin +export INSTALL_INCLUDE_DIR=$(PREFIX)/include/
# compile flags -MASTER_CC_FLAGS := -c -Wall -DLINUX -MASTER_CPP_FLAGS := -c -Wall -DLINUX -std=c++11 -MASTER_LINKER_FLAGS := -Wl,-z,defs -MASTER_LIB_FLAGS := rcs +CFLAGS += $(CPPFLAGS) -c -Wall -DLINUX -Wno-switch -fpic +CXXFLAGS += $(CPPFLAGS) -c -Wall -DLINUX -Wno-switch -fpic -std=c++11 +LDFLAGS += -Wl,-z,defs +ARFLAGS ?= rcs
# debug variant ifdef DEBUG -MASTER_CC_FLAGS += -g -O0 -DDEBUG -MASTER_CPP_FLAGS += -g -O0 -DDEBUG +CFLAGS += -g -O0 -DDEBUG +CXXFLAGS += -g -O0 -DDEBUG BUILD_VARIANT=dbg else -MASTER_CC_FLAGS += -g -O2 -DNDEBUG -MASTER_CPP_FLAGS += -g -O2 -DNDEBUG +CFLAGS += -g -O2 -DNDEBUG +CXXFLAGS += -g -O2 -DNDEBUG BUILD_VARIANT=rel 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 - -MASTER_CC_FLAGS += $(MFLAG) -MASTER_CPP_FLAGS += $(MFLAG) -MASTER_LINKER_FLAGS += $(MFLAG) - # export build flags -export MASTER_CC_FLAGS -export MASTER_CPP_FLAGS -export MASTER_LINKER_FLAGS -export MASTER_LIB_FLAGS - -# target directories -export PLAT_DIR=linux$(BIT_VARIANT)/$(BUILD_VARIANT) +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/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
@@ -132,10 +114,19 @@ 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)/ +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=644 $(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=644 $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so.$(SO_VER) $(INSTALL_LIB_DIR)/ + $(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)/ 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)/ +
################################ # build OpenCSD trace decode library @@ -173,12 +164,19 @@ tests: libs cd $(OCSD_ROOT)/tests/build/linux/trc_pkt_lister && make cd $(OCSD_ROOT)/tests/build/linux/c_api_pkt_print_test && make
+# +# build docs +.PHONY: docs +docs: + (cd $(OCSD_ROOT)/docs; doxygen doxygen_config.dox) + + ############################################################# # clean targets # -clean: clean_libs clean_tests +clean: clean_libs clean_tests clean_docs
-.PHONY: clean_libs clean_tests +.PHONY: clean_libs clean_tests clean_docs clean_install
clean_libs: cd $(OCSD_ROOT)/build/linux/ref_trace_decode_lib && make clean @@ -189,8 +187,12 @@ 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 + -rmdir $(OCSD_TESTS)/lib + +clean_docs: + -rm -r $(OCSD_ROOT)/docs/html
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) + -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) diff --git a/decoder/build/linux/makefile.dev b/decoder/build/linux/makefile.dev new file mode 100644 index 0000000..7c02328 --- /dev/null +++ b/decoder/build/linux/makefile.dev @@ -0,0 +1,62 @@ +######################################################## +# 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) + +PLAT_DIR=linux$(BIT_VARIANT)/$(BUILD_VARIANT) + +# 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 index fb54d3a..d93db7d 100644 --- a/decoder/build/linux/rctdl_c_api_lib/makefile +++ b/decoder/build/linux/rctdl_c_api_lib/makefile @@ -30,14 +30,10 @@ # OpenCSD - makefile for C API wrapper library #
-CPP := $(MASTER_CPP) +CXX := $(MASTER_CXX) LINKER := $(MASTER_LINKER) LIB := $(MASTER_LIB)
-CPP_FLAGS := $(MASTER_CPP_FLAGS) -fpic -Wno-switch -LIB_FLAGS := $(MASTER_LIB_FLAGS) -LINKER_FLAGS := $(MASTER_LINKER_FLAGS) -shared - LIB_NAME = lib$(LIB_CAPI_NAME) SO_LIB_DEPS= -L$(LIB_TARGET_DIR) -l$(LIB_BASE_NAME)
@@ -45,7 +41,7 @@ BUILD_DIR=./$(PLAT_DIR)
VPATH= $(OCSD_SOURCE)/c_api
-CPP_INCLUDES= \ +CXX_INCLUDES= \ -I$(OCSD_INCLUDE) \ -I$(OCSD_SOURCE)/c_api
@@ -55,14 +51,32 @@ OBJECTS=$(BUILD_DIR)/ocsd_c_api.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) - $(LIB) $(LIB_FLAGS) $(LIB_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS) - $(LINKER) $(LINKER_FLAGS) -o $(LIB_TARGET_DIR)/$(LIB_NAME).so -Wl,-soname,$(LIB_NAME).so $(OBJECTS) $(SO_LIB_DEPS) +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)
-build_dir: +$(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 @@ -71,8 +85,8 @@ DEPS := $(OBJECTS:%.o=%.d) -include $(DEPS)
## object compile -$(BUILD_DIR)/%.o : %.cpp - $(CPP) $(CPP_FLAGS) $(CPP_INCLUDES) -MMD $< -o $@ +$(BUILD_DIR)/%.o : %.cpp | $(BUILD_DIR) + $(CXX) $(CXXFLAGS) $(CXX_INCLUDES) -MMD $< -o $@
#### clean @@ -81,7 +95,8 @@ clean: rm -f $(OBJECTS) rm -f $(DEPS) rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).a - rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so + 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: diff --git a/decoder/build/linux/ref_trace_decode_lib/makefile b/decoder/build/linux/ref_trace_decode_lib/makefile index a356066..ad2aca9 100644 --- a/decoder/build/linux/ref_trace_decode_lib/makefile +++ b/decoder/build/linux/ref_trace_decode_lib/makefile @@ -30,14 +30,10 @@ # OpenCSD - makefile for main trace decode library #
-CPP := $(MASTER_CPP) +CXX := $(MASTER_CXX) LINKER := $(MASTER_LINKER) LIB := $(MASTER_LIB)
-CPP_FLAGS := $(MASTER_CPP_FLAGS) -fpic -Wno-switch -LIB_FLAGS := $(MASTER_LIB_FLAGS) -LINKER_FLAGS := $(MASTER_LINKER_FLAGS) -shared - LIB_NAME= lib$(LIB_BASE_NAME)
BUILD_DIR=./$(PLAT_DIR) @@ -52,7 +48,7 @@ VPATH= $(OCSD_SOURCE) \ $(OCSD_SOURCE)/pkt_printers
-CPP_INCLUDES= \ +CXX_INCLUDES= \ -I$(OCSD_INCLUDE) \ -I$(OCSD_SOURCE)
@@ -114,14 +110,32 @@ OBJECTS=$(BUILD_DIR)/ocsd_code_follower.o \ $(PTMOBJ) \ $(PKTPRNTOBJ)
-all: build_dir $(OBJECTS) +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) - $(LIB) $(LIB_FLAGS) $(LIB_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS) - $(LINKER) $(LINKER_FLAGS) -o $(LIB_TARGET_DIR)/$(LIB_NAME).so -Wl,-soname,$(LIB_NAME).so $(OBJECTS)
-build_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 @@ -130,8 +144,8 @@ DEPS := $(OBJECTS:%.o=%.d) -include $(DEPS)
## object compile -$(BUILD_DIR)/%.o : %.cpp - $(CPP) $(CPP_FLAGS) $(CPP_INCLUDES) -MMD $< -o $@ +$(BUILD_DIR)/%.o : %.cpp | $(BUILD_DIR) + $(CXX) $(CXXFLAGS) $(CXX_INCLUDES) -MMD $< -o $@
#### clean @@ -140,4 +154,5 @@ clean: rm -f $(OBJECTS) rm -f $(DEPS) rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).a - rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so + rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so* + -rmdir $(BUILD_DIR) diff --git a/decoder/tests/build/linux/c_api_pkt_print_test/makefile b/decoder/tests/build/linux/c_api_pkt_print_test/makefile index 9fe7247..ba4526d 100644 --- a/decoder/tests/build/linux/c_api_pkt_print_test/makefile +++ b/decoder/tests/build/linux/c_api_pkt_print_test/makefile @@ -33,9 +33,7 @@ #
CC := $(MASTER_CC) -CC_FLAGS := $(MASTER_CC_FLAGS) -Wno-switch LINKER := $(MASTER_LINKER) -LINKER_FLAGS := $(MASTER_LINKER_FLAGS)
PROG = c_api_pkt_print_test
@@ -60,7 +58,7 @@ test_app: $(OBJECTS) $(BIN_TEST_TARGET_DIR)/$(PROG)
$(BIN_TEST_TARGET_DIR)/$(PROG): mkdir -p $(BIN_TEST_TARGET_DIR) - $(LINKER) $(LINKER_FLAGS) $(OBJECTS) -Wl,--start-group $(LIBS) -Wl,--end-group -o $(BIN_TEST_TARGET_DIR)/$(PROG) + $(LINKER) $(LDFLAGS) $(OBJECTS) -Wl,--start-group $(LIBS) -Wl,--end-group -o $(BIN_TEST_TARGET_DIR)/$(PROG) cp $(LIB_TARGET_DIR)/*.so .
build_dir: @@ -81,12 +79,14 @@ DEPS := $(OBJECTS:%.o=%.d)
## object compile $(BUILD_DIR)/%.o : %.c - $(CC) $(CC_FLAGS) $(CC_INCLUDES) -MMD $< -o $@ + $(CC) $(CFLAGS) $(CC_INCLUDES) -MMD $< -o $@
#### clean .PHONY: clean clean : - rm -f $(BIN_TEST_TARGET_DIR)/$(PROG) $(OBJECTS) - rm -f $(DEPS) + -rm $(BIN_TEST_TARGET_DIR)/$(PROG) $(OBJECTS) + -rm $(DEPS) + -rm ./*.so + -rmdir $(BUILD_DIR)
# end of file makefile diff --git a/decoder/tests/build/linux/echo_test_dcd_lib/makefile b/decoder/tests/build/linux/echo_test_dcd_lib/makefile index 2483170..2b26035 100644 --- a/decoder/tests/build/linux/echo_test_dcd_lib/makefile +++ b/decoder/tests/build/linux/echo_test_dcd_lib/makefile @@ -31,13 +31,8 @@ #
CC := $(MASTER_CC) -LINKER := $(MASTER_LINKER) LIB := $(MASTER_LIB)
-CC_FLAGS := $(MASTER_CC_FLAGS) -fpic -Wno-switch -LIB_FLAGS := $(MASTER_LIB_FLAGS) -LINKER_FLAGS := $(MASTER_LINKER_FLAGS) -shared - LIB_NAME = lib_echo_test_dcd
BUILD_DIR=./$(PLAT_DIR) @@ -57,7 +52,7 @@ all: build_dir $(OBJECTS) $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a
$(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a: mkdir -p $(LIB_TEST_TARGET_DIR) - $(LIB) $(LIB_FLAGS) $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS) + $(LIB) $(ARFLAGS) $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS)
build_dir: mkdir -p $(BUILD_DIR) @@ -76,13 +71,14 @@ DEPS := $(OBJECTS:%.o=%.d)
## object compile $(BUILD_DIR)/%.o : %.c - $(CC) $(CC_FLAGS) $(CC_INCLUDES) -MMD $< -o $@ + $(CC) $(CFLAGS) $(CC_INCLUDES) -MMD $< -o $@
#### clean .PHONY: clean clean: - rm -f $(OBJECTS) - rm -f $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a - rm -f $(DEPS) + -rm $(OBJECTS) + -rm $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a + -rm $(DEPS) + -rmdir $(BUILD_DIR) $(LIB_TEST_TARGET_DIR)
# end of file makefile diff --git a/decoder/tests/build/linux/snapshot_parser_lib/makefile b/decoder/tests/build/linux/snapshot_parser_lib/makefile index ae3863f..685e8d4 100644 --- a/decoder/tests/build/linux/snapshot_parser_lib/makefile +++ b/decoder/tests/build/linux/snapshot_parser_lib/makefile @@ -32,15 +32,14 @@ # ########################################################################
-CPP := $(MASTER_CPP) +CXX := $(MASTER_CXX) LINKER := $(MASTER_LINKER) LIB := $(MASTER_LIB)
# avoid build warnings in donated test code WSUPPRESS= -Wno-deprecated-declarations -Wno-unused-variable -Wno-reorder
-CPP_FLAGS := $(MASTER_CPP_FLAGS) -fpic -Wno-switch $(WSUPPRESS) -LIB_FLAGS := $(MASTER_LIB_FLAGS) +CXXFLAGS += $(WSUPPRESS)
LIB_NAME = libsnapshot_parser
@@ -53,7 +52,7 @@ PARSER_INCLUDE=$(PARSER_ROOT)/include VPATH= $(PARSER_SOURCE)
-CPP_INCLUDES= \ +CXX_INCLUDES= \ -I$(PARSER_INCLUDE) \ -I$(OCSD_INCLUDE)
@@ -68,7 +67,7 @@ all: build_dir $(OBJECTS) $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a
$(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a: mkdir -p $(LIB_TEST_TARGET_DIR) - $(LIB) $(LIB_FLAGS) $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS) + $(LIB) $(ARFLAGS) $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS)
build_dir: mkdir -p $(BUILD_DIR) @@ -82,11 +81,12 @@ DEPS := $(OBJECTS:%.o=%.d)
## object compile $(BUILD_DIR)/%.o : %.cpp - $(CPP) $(CPP_FLAGS) $(CPP_INCLUDES) -MMD $< -o $@ + $(CXX) $(CXXFLAGS) $(CXX_INCLUDES) -MMD $< -o $@
### clean .PHONY: clean clean: - rm -f $(OBJECTS) - rm -f $(DEPS) - rm -f $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a + -rm $(OBJECTS) + -rm $(DEPS) + -rm $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a + -rmdir $(BUILD_DIR) $(LIB_TEST_TARGET_DIR) diff --git a/decoder/tests/build/linux/trc_pkt_lister/makefile b/decoder/tests/build/linux/trc_pkt_lister/makefile index 3447b93..cd45758 100644 --- a/decoder/tests/build/linux/trc_pkt_lister/makefile +++ b/decoder/tests/build/linux/trc_pkt_lister/makefile @@ -32,10 +32,8 @@ # RCTDL - test makefile for snapshot lister test. #
-CPP := $(MASTER_CPP) -CPP_FLAGS := $(MASTER_CPP_FLAGS) -Wno-switch +CXX := $(MASTER_CXX) LINKER := $(MASTER_LINKER) -LINKER_FLAGS := $(MASTER_LINKER_FLAGS)
PROG = trc_pkt_lister
@@ -43,7 +41,7 @@ BUILD_DIR=./$(PLAT_DIR)
VPATH = $(OCSD_TESTS)/source
-CPP_INCLUDES = \ +CXX_INCLUDES = \ -I$(OCSD_TESTS)/source \ -I$(OCSD_INCLUDE) \ -I$(OCSD_TESTS)/snapshot_parser_lib/include @@ -60,7 +58,7 @@ test_app: $(OBJECTS) $(BIN_TEST_TARGET_DIR)/$(PROG)
$(BIN_TEST_TARGET_DIR)/$(PROG): mkdir -p $(BIN_TEST_TARGET_DIR) - $(LINKER) $(LINKER_FLAGS) $(OBJECTS) -Wl,--start-group $(LIBS) -Wl,--end-group -o $(BIN_TEST_TARGET_DIR)/$(PROG) + $(LINKER) $(LDFLAGS) $(OBJECTS) -Wl,--start-group $(LIBS) -Wl,--end-group -o $(BIN_TEST_TARGET_DIR)/$(PROG)
build_dir: mkdir -p $(BUILD_DIR) @@ -68,7 +66,7 @@ build_dir: .PHONY: copy_libs
copy_libs: - cp $(LIB_TARGET_DIR)/*.so $(BIN_TEST_TARGET_DIR)/. + cp $(LIB_TARGET_DIR)/*.so* $(BIN_TEST_TARGET_DIR)/.
@@ -80,12 +78,14 @@ DEPS := $(OBJECTS:%.o=%.d)
## object compile $(BUILD_DIR)/%.o : %.cpp - $(CPP) $(CPP_FLAGS) $(CPP_INCLUDES) -MMD $< -o $@ + $(CXX) $(CXXFLAGS) $(CXX_INCLUDES) -MMD $< -o $@
#### clean .PHONY: clean clean : - rm -f $(BIN_TEST_TARGET_DIR)/$(PROG) $(OBJECTS) - rm -f $(DEPS) + -rm $(BIN_TEST_TARGET_DIR)/$(PROG) $(OBJECTS) + -rm $(DEPS) + -rm $(BIN_TEST_TARGET_DIR)/*.so* + -rmdir $(BUILD_DIR)
# end of file makefile