Makefile 1.6 KB
Newer Older
1
#
2
# Copyright (c) 2015-2020, 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

14
15
16
17
18
MAKE_HELPERS_DIRECTORY := ../../make_helpers/
include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
include ${MAKE_HELPERS_DIRECTORY}build_env.mk

# Common source files.
19
OBJECTS := src/cert.o \
20
           src/cmd_opt.o \
21
22
23
           src/ext.o \
           src/key.o \
           src/main.o \
24
           src/sha.o
25

26
27
# TBBR chain of trust definitions.
include src/tbbr/tbbr.mk
28

29
HOSTCCFLAGS := -Wall -std=c99
30
31

ifeq (${DEBUG},1)
32
  HOSTCCFLAGS += -g -O0 -DDEBUG -DLOG_LEVEL=40
33
else
34
  HOSTCCFLAGS += -O2 -DLOG_LEVEL=20
35
endif
36

37
ifeq (${V},0)
38
  Q := @
39
else
40
  Q :=
41
42
endif

43
HOSTCCFLAGS += ${DEFINES}
44

45
46
# Make soft links and include from local directory otherwise wrong headers
# could get pulled in from firmware tree.
47
48
INC_DIR := -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include
LIB_DIR := -L ${OPENSSL_DIR}/lib
49
50
LIB := -lssl -lcrypto

dp-arm's avatar
dp-arm committed
51
HOSTCC ?= gcc
52

Evan Lloyd's avatar
Evan Lloyd committed
53
.PHONY: all clean realclean
54
55
56
57

all: clean ${BINARY}

${BINARY}: ${OBJECTS} Makefile
58
	@echo "  HOSTLD  $@"
59
	@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \
60
                const char platform_msg[] = "${PLAT_MSG}";' | \
61
                ${HOSTCC} -c ${HOSTCCFLAGS} -xc - -o src/build_msg.o
dp-arm's avatar
dp-arm committed
62
	${Q}${HOSTCC} src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@
63
64

%.o: %.c
65
66
	@echo "  HOSTCC  $<"
	${Q}${HOSTCC} -c ${HOSTCCFLAGS} ${INC_DIR} $< -o $@
67
68

clean:
69
	$(call SHELL_DELETE_ALL, src/build_msg.o ${OBJECTS})
70
71

realclean: clean
72
	$(call SHELL_DELETE,${BINARY})
73