Makefile 2.01 KB
Newer Older
1
#
2
# Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
3
#
dp-arm's avatar
dp-arm committed
4
# SPDX-License-Identifier: BSD-3-Clause
5
6
7
8
9
10
#

PROJECT		:= cert_create
PLAT		:= none
V		:= 0
DEBUG		:= 0
11
BINARY		:= ${PROJECT}${BIN_EXT}
12
OPENSSL_DIR	:= /usr
13
14

OBJECTS := src/cert.o \
15
           src/cmd_opt.o \
16
17
18
           src/ext.o \
           src/key.o \
           src/main.o \
19
20
21
22
           src/sha.o \
           src/tbbr/tbb_cert.o \
           src/tbbr/tbb_ext.o \
           src/tbbr/tbb_key.o
23
24
25

CFLAGS := -Wall -std=c99

26
27
MAKE_HELPERS_DIRECTORY := ../../make_helpers/
include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
28
include ${MAKE_HELPERS_DIRECTORY}build_env.mk
29

30
31
32
33
34
35
36
ifeq (${USE_TBBR_DEFS},1)
# In this case, cert_tool is platform-independent
PLAT_MSG		:=	TBBR Generic
PLAT_INCLUDE		:=	../../include/tools_share
else
PLAT_MSG		:=	${PLAT}

37
38
39
40
41
PLATFORM_ROOT		:=	../../plat/
include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk

PLAT_INCLUDE		:=	$(wildcard ${PLAT_DIR}include)

42
ifeq ($(PLAT_INCLUDE),)
43
  $(error "Error: Invalid platform '${PLAT}' has no include directory.")
44
endif
45
endif
46
47
48
49
50
51
52
53
54
55
56
57

ifeq (${DEBUG},1)
  CFLAGS += -g -O0 -DDEBUG -DLOG_LEVEL=40
else
  CFLAGS += -O2 -DLOG_LEVEL=20
endif
ifeq (${V},0)
	Q := @
else
	Q :=
endif

58
59
60
$(eval $(call add_define,USE_TBBR_DEFS))
CFLAGS += ${DEFINES}

61
62
# Make soft links and include from local directory otherwise wrong headers
# could get pulled in from firmware tree.
63
64
INC_DIR := -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include
LIB_DIR := -L ${OPENSSL_DIR}/lib
65
66
67
68
LIB := -lssl -lcrypto

CC := gcc

Evan Lloyd's avatar
Evan Lloyd committed
69
.PHONY: all clean realclean
70
71
72
73
74
75

all: clean ${BINARY}

${BINARY}: ${OBJECTS} Makefile
	@echo "  LD      $@"
	@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \
76
                const char platform_msg[] = "${PLAT_MSG}";' | \
77
78
79
80
81
82
83
84
                ${CC} -c ${CFLAGS} -xc - -o src/build_msg.o
	${Q}${CC} src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@

%.o: %.c
	@echo "  CC      $<"
	${Q}${CC} -c ${CFLAGS} ${INC_DIR} $< -o $@

clean:
85
	$(call SHELL_DELETE_ALL, src/build_msg.o ${OBJECTS})
86
87

realclean: clean
88
89
	$(call SHELL_DELETE, ${BINARY})