-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile.target
64 lines (56 loc) · 2.33 KB
/
Makefile.target
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
#*******************************************************************************
# Ledger SDK
# (c) 2024 Ledger
#
# 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.
#*******************************************************************************
ifeq ($(__MAKEFILE_TARGET__),)
__MAKEFILE_TARGET__ := 1
# TARGET should be set as an environment variable otherwise it will be read from a `.target`
# file in the SDK root repository
TARGETS := nanos nanox nanos2 stax flex
ifeq ($(TARGET),)
ifeq ("$(wildcard $(BOLOS_SDK)/.target)","")
$(error No TARGET specified and no .target file in SDK repository $(BOLOS_SDK))
else
TARGET := $(shell cat $(BOLOS_SDK)/.target)
endif
endif
ifeq ($(filter $(TARGET),$(TARGETS)),)
$(error TARGET not set to a valid value (possible values: $(TARGETS)))
endif
TARGET_PATH := $(BOLOS_SDK)/target/$(TARGET)
BOLOS_TARGET_H := $(TARGET_PATH)/include/bolos_target.h
TARGET_ID := $(shell grep -E "^\#define\s*TARGET_ID" $(BOLOS_TARGET_H) | cut -f3 -d' ')
TARGET_NAME := $(shell grep -E "^\#define\s*TARGET_[^I]" $(BOLOS_TARGET_H) | cut -f2 -d' ')
SDK_NAME := "ledger-secure-sdk"
SDK_VERSION := $(shell git -C $(BOLOS_SDK) describe --tags --exact-match --match "v[0-9]*" --dirty)
SDK_HASH := $(shell git -C $(BOLOS_SDK) describe --always --dirty --exclude '*' --abbrev=40)
ifeq ($(SDK_VERSION),)
SDK_VERSION := "None"
endif
ifeq ($(SDK_HASH),)
SDK_HASH := "None"
endif
BUILD_DIR := build
TARGET_BUILD_DIR := $(BUILD_DIR)/$(TARGET)
BIN_DIR := $(TARGET_BUILD_DIR)/bin
OBJ_DIR := $(TARGET_BUILD_DIR)/obj
DBG_DIR := $(TARGET_BUILD_DIR)/dbg
DEP_DIR := $(TARGET_BUILD_DIR)/dep
GEN_SRC_DIR := $(TARGET_BUILD_DIR)/gen_src
# Debug mode disabled by default
DEBUG:=0
# define the default makefile target (high in include to avoid glyph.h or what not specific target to be the default one when no target passed on the make command line)
all: default
endif