95 lines
3.1 KiB
Plaintext
95 lines
3.1 KiB
Plaintext
# defs.library - build system
|
|
|
|
#
|
|
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
|
#
|
|
# 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 Wind River Systems 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.
|
|
#
|
|
|
|
OUTPUT_DIR ?= outdir
|
|
|
|
#####
|
|
# user may set these variables
|
|
#
|
|
# COMPILER_OPT with a compiler opt flag (toolchain-specific)
|
|
# STACK_CANARIES with y or n
|
|
#
|
|
|
|
vOUT_DIR = $(strip ${OUTPUT_DIR})
|
|
iOUT_DIR_OBJ = ${vOUT_DIR}/obj.${LIB_NAME}
|
|
|
|
iLIB_NAME = $(strip ${LIB_NAME})
|
|
|
|
iSRC_FROM_PATH = $(strip \
|
|
$(foreach path,${${LIB_NAME}_SRCPATH},$(wildcard ${path}/*.$c)) \
|
|
$(foreach path,${${LIB_NAME}_SRCPATH},$(wildcard ${path}/*.$s)) \
|
|
)
|
|
|
|
iSRC_IN_CURDIR = $(strip \
|
|
$(wildcard *.$c) \
|
|
$(wildcard *.$s) \
|
|
)
|
|
|
|
iSRC_EXPLICIT = $(strip ${${LIB_NAME}_SRC} ${iSRC_FROM_PATH})
|
|
iSRC = $(or ${iSRC_EXPLICIT},${iSRC_IN_CURDIR})
|
|
|
|
iSRC_C = $(filter %.$c,${iSRC})
|
|
iSRC_ASM = $(filter %.$s,${iSRC})
|
|
|
|
include ${vMAKE}/target/library/defs.objects
|
|
|
|
${LIB_NAME}_OBJ = ${iOBJ}
|
|
|
|
iINCLUDE_DIR = ${${LIB_NAME}_INCLUDE_DIR}
|
|
|
|
include ${vMAKE}/target/env/defs.target
|
|
|
|
$(if ${vCPU},,$(error CPU is not set!))
|
|
$(if ${vARCH},,$(error ARCH is not set!))
|
|
|
|
#####
|
|
# preempt the variables from the tools
|
|
|
|
iHAS_COMPILER_OPT = $(lastword ${OVERRIDE_COMPILER_OPT})
|
|
OVERRIDE_COMPILER_OPT = ${COMPILER_OPT}
|
|
|
|
#####
|
|
# STDLIB will be set by the library's Makefile if it requires any stdlib
|
|
# header files to build. If set, include the defs.stdlib for the desired set
|
|
# of standard libraries.
|
|
vSTDLIB = $(strip ${STDLIB})
|
|
sinclude ${vMAKE}/target/stdlib/${vSTDLIB}/defs.stdlib
|
|
|
|
#####
|
|
|
|
sinclude ${vMAKE}/target/toolchain/${vTOOL}/defs.flags.library
|
|
include ${vMAKE}/target/toolchain/${vTOOL}/defs.${vTOOL}
|
|
|
|
$(foreach src,${iSRC_C} ${iSRC_ASM},\
|
|
$(eval $(call src_to_module__defs,${LIB_NAME},${src},${iOUT_DIR_OBJ}))\
|
|
)
|