diff options
Diffstat (limited to 'nsframework/framework_unified/client/NativeServices/cfg/common.mk')
-rwxr-xr-x | nsframework/framework_unified/client/NativeServices/cfg/common.mk | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/nsframework/framework_unified/client/NativeServices/cfg/common.mk b/nsframework/framework_unified/client/NativeServices/cfg/common.mk new file mode 100755 index 0000000..10a9a6b --- /dev/null +++ b/nsframework/framework_unified/client/NativeServices/cfg/common.mk @@ -0,0 +1,175 @@ +# +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#################################################################### +# DO NOT EDIT THIS FILE +# Common Project Makefile definitions shared by all types of makefiles +# +# +# Please use project.mk in your build folder to customize your build +####################################################################### + +include $(PRJ_ROOT)cfg/depends.mk + +ifndef COMPONENT_ROOT +export COMPONENT_ROOT=$(COMPONENT_NAME) +endif + +# Additive Compile Flags (Flags from initiating make process will still apply) +DEFS += $(PROJECT_FLAGS) + +# Set local includes and then the reference includes (priority order determines search path) +INCLUDES = \ + $(CC_IFLAG)./ \ + $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_ROOT)/inc \ + $(addprefix $(CC_IFLAG),$(PROJECT_INCLUDE_PATHS)) \ + $(DEPENDS_INCLUDES) \ + + +# Do the same if you need to include library paths as well +LIB_PATHS += \ + $(PROJECT_LIB_PATHS) \ + $(DEPENDS_LIB_PATHS) \ + + +LD_STATIC_LIBS += \ + $(PROJECT_STATIC_LIBS) + +LD_DYNAMIC_LIBS += \ + $(PROJECT_DYNAMIC_LIBS) + +## Sources Section + +# Define Library & Executable Sources (on a per deliverable basis) +# This includes sources located in subdirectories. + +# Define generic line that pulls all c, cc, cpp files +# since your in the src folder is pull only files from there +COMPONENT_SRCS = \ + $(wildcard *.cpp) + +# Define sources that my not be local to your component +# here, you can define indivial files or wildcard from +# a different folder. +NON_LOCAL_SRCS = \ + + +# List of all sources to be built. Can be assembled from the other defintitions. +# This only defines sources for the current directory, so if there are subdirectories +# those are not included. (Those are found in simple subdirectory makefiles that only +# direct the building of sources, but no linking into a binary) +SOURCES = \ + $(COMPONENT_SRCS) \ + $(NON_LOCAL_SRCS) \ + + +# Convert the source files to object files with correct folder location. +C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) ) +CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) ) + + +# List of all sources to be generated. Can be assembled from the other defintitions. +OBJECTS = \ + $(C_LANG_OBJECTS) \ + $(CPP_LANG_OBJECTS) + +D_FILES = $(OBJECTS:.o=.d) + +# pull in dependency info for existing .o files +-include $(D_FILES) + + +ifeq ($(BUILDTYPE),APP) +COMPONENT_EXEC = $(BIN_PATH)$(COMPONENT_NAME)$(DEBUG_EXT) +BINARIES = \ + $(COMPONENT_EXEC) + +$(COMPONENT_EXEC): $(OBJECTS) + $(LD_CMD) $(LD_OFLAG) $(@) $(OBJECTS) $(addprefix -L , $(LIB_PATHS)) -Bstatic $(addprefix -l , $(LD_STATIC_LIBS)) -Bdynamic $(addprefix -l , $(LD_DYNAMIC_LIBS)) + +endif + +ifeq ($(BUILDTYPE),DLL) +COMPONENT_SOLIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT) +LIBRARIES = \ + $(COMPONENT_SOLIB) \ + +$(COMPONENT_SOLIB): $(OBJECTS) + $(SO_CMD) $(OBJECTS) $(LD_OFLAG) $(@) $(addprefix -L, $(LIB_PATHS)) \ + -Bstatic $(addprefix -l,$(STATIC_LIBS)) -Bdynamic $(addprefix -l,$(DYNAMIC_LIBS)) + +endif + +ifeq ($(BUILDTYPE),LIB) +COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT) +LIBRARIES = \ + $(COMPONENT_LIB) \ + +$(COMPONENT_LIB): $(OBJECTS) + $(AR_CMD) + +endif + + + +# Make targets +# Standard +all: banner module_dirs subdirs local library binary + +base: banner module_dirs subdirs local + + +$(BLD_PATH)/%.o: %.cpp + $(CPP_CMD) + $(CPP_D_CMD) + @mv -f $(@:.o=.d) $(@:.o=.d).tmp + @sed -e 's|.*: |$@: |' < $(@:.o=.d).tmp > $(@:.o=.d) + @rm -f $(@:.o=.d).tmp + +local: $(OBJECTS) + +# Standard set of derived targets +library: base \ + $(LIBRARIES) + @echo "***** `date` Done building library: $(COMPONENT_NAME) ******" + +binary: base \ + $(BINARIES) + +# Subdirs should be to jump to subdirectories +# standard form is of +# $(MAKE) -C subdirectory_name $(MAKECMDGOALS) +subdirs: + +clean: + -rm -f $(BINARIES) + -rm -f $(LIBRARIES) + -rm -f $(OBJECTS) + -rm -f $(D_FILES) + +-v: + @echo "objs: --> $(OBJECTS)" + @echo "sources: --> $(SOURCES)" + @echo "headers: --> $(HEADERS)" + @echo "includes: --> $(INCLUDES)" + @echo "lib paths: --> $(LIB_PATHS)" + @echo "static libs: --> $(LD_STATIC_LIBS)" + @echo "dynamic libs: --> $(LD_DYNAMIC_LIBS)" + @echo "lib: --> $(LIBRARIES)" + @echo "bin: --> $(BINARIES)" + + +module_dirs: build_dirs |