aboutsummaryrefslogtreecommitdiff
path: root/tools/build_system/lib.mk
blob: 66d35bbed4e0cbcdb757e0c9a42667676c7adb32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#
# Arm SCP/MCP Software
# Copyright (c) 2015-2020, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#

ifndef BS_LIB_MK
BS_LIB_MK := 1

include $(BS_DIR)/defs.mk

$(info == Building $(BS_LIB_NAME) for $(BS_FIRMWARE_CPU))

SOURCES := $(BS_LIB_SOURCES)
INCLUDES += $(BS_LIB_INCLUDES)
DEFINES += $(BS_LIB_DEFINES)

ifeq ($(BUILD_FIRMWARE_DIR),)
    # We are not building underneath a particular firmware, so we use the target
    # CPU to identify where to build this library
    BUILD_FIRMWARE_DIR := $(BUILD_DIR)/$(BS_FIRMWARE_CPU)
endif

# Discard the product-specific path part of product-specific modules
LIB_BASE := $(subst product/$(PRODUCT)/,,$(shell pwd))

# Extract the part of the path that will be used as the build subdirectory
LIB_BASE := $(patsubst $(TOP_DIR)/%/src,%,$(LIB_BASE))

#
# Generate the name of the list that holds all of the disabled APIS for this
# library
#
DISABLED_APIS_LIST_NAME = \
    $(subst MODULE/,,$(call to_upper,$(LIB_BASE)))_DISABLED_APIS

# Define BUILD_DISABLE_API_<API> in this library for every disabled API
$(foreach api, \
          $($(DISABLED_APIS_LIST_NAME)), \
          $(eval DEFINES += BUILD_DISABLE_API_$(api)))


ifeq ($(BS_FIRMWARE_HAS_MULTITHREADING),yes)
    LIB_BASE := $(LIB_BASE)$(MULTHREADING_SUFFIX)
endif

ifeq ($(BS_FIRMWARE_HAS_NOTIFICATION),yes)
    LIB_BASE := $(LIB_BASE)$(NOTIFICATION_SUFFIX)
endif

LIB_DIR = $(BUILD_FIRMWARE_DIR)/$(LIB_BASE)/$(MODE)/lib
OBJ_DIR = $(BUILD_FIRMWARE_DIR)/$(LIB_BASE)/$(MODE)/obj

LIB = $(LIB_DIR)/lib.a

goal: $(LIB)

INCLUDES += $(shell pwd)
INCLUDES += $(TOP_DIR)/$(LIB_BASE)/include

include $(BS_DIR)/rules.mk

endif