Makefile 2.05 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
#

PROJECT		:= cert_create
PLAT		:= none
9
V		?= 0
10
DEBUG		:= 0
11
BINARY		:= ${PROJECT}${BIN_EXT}
12
OPENSSL_DIR	:= /usr
13
USE_TBBR_DEFS   := 1
14
15

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

CFLAGS := -Wall -std=c99

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

31
32
33
34
35
36
37
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}

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

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

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

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

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

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

dp-arm's avatar
dp-arm committed
68
HOSTCC ?= gcc
69

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

all: clean ${BINARY}

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

%.o: %.c
	@echo "  CC      $<"
dp-arm's avatar
dp-arm committed
83
	${Q}${HOSTCC} -c ${CFLAGS} ${INC_DIR} $< -o $@
84
85

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

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