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

PLATFORM_ROOT		:=	../../plat/
include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk

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

35
ifeq ($(PLAT_INCLUDE),)
36
  $(error "Error: Invalid platform '${PLAT}' has no include directory.")
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
endif

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

# Make soft links and include from local directory otherwise wrong headers
# could get pulled in from firmware tree.
52
53
INC_DIR := -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include
LIB_DIR := -L ${OPENSSL_DIR}/lib
54
55
56
57
LIB := -lssl -lcrypto

CC := gcc

Evan Lloyd's avatar
Evan Lloyd committed
58
.PHONY: all clean realclean
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

all: clean ${BINARY}

${BINARY}: ${OBJECTS} Makefile
	@echo "  LD      $@"
	@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \
                const char platform_msg[] = "${PLAT}";' | \
                ${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:
74
	$(call SHELL_DELETE_ALL, src/build_msg.o ${OBJECTS})
75
76

realclean: clean
77
78
	$(call SHELL_DELETE, ${BINARY})