2014-10-21 11:30:42 +01:00
|
|
|
#
|
2018-10-04 14:35:38 +01:00
|
|
|
# Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
|
2014-10-21 11:30:42 +01:00
|
|
|
#
|
2017-05-03 09:38:09 +01:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2014-10-21 11:30:42 +01:00
|
|
|
#
|
|
|
|
|
|
|
|
PROJECT := cert_create
|
|
|
|
PLAT := none
|
2017-05-02 11:14:29 +01:00
|
|
|
V ?= 0
|
2014-10-21 11:30:42 +01:00
|
|
|
DEBUG := 0
|
2015-12-03 11:35:40 +00:00
|
|
|
BINARY := ${PROJECT}${BIN_EXT}
|
2015-06-01 16:34:23 +01:00
|
|
|
OPENSSL_DIR := /usr
|
2017-09-08 10:54:12 +01:00
|
|
|
USE_TBBR_DEFS := 1
|
2014-10-21 11:30:42 +01:00
|
|
|
|
|
|
|
OBJECTS := src/cert.o \
|
2015-07-03 16:23:16 +01:00
|
|
|
src/cmd_opt.o \
|
2014-10-21 11:30:42 +01:00
|
|
|
src/ext.o \
|
|
|
|
src/key.o \
|
|
|
|
src/main.o \
|
2015-06-12 11:27:59 +01:00
|
|
|
src/sha.o \
|
|
|
|
src/tbbr/tbb_cert.o \
|
|
|
|
src/tbbr/tbb_ext.o \
|
|
|
|
src/tbbr/tbb_key.o
|
2014-10-21 11:30:42 +01:00
|
|
|
|
2018-10-04 14:35:38 +01:00
|
|
|
HOSTCCFLAGS := -Wall -std=c99
|
2014-10-21 11:30:42 +01:00
|
|
|
|
2015-12-02 18:17:37 +00:00
|
|
|
MAKE_HELPERS_DIRECTORY := ../../make_helpers/
|
|
|
|
include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
|
2015-12-02 18:56:06 +00:00
|
|
|
include ${MAKE_HELPERS_DIRECTORY}build_env.mk
|
2015-12-02 18:17:37 +00:00
|
|
|
|
2017-05-22 04:11:24 +01:00
|
|
|
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}
|
|
|
|
|
2018-03-01 10:57:58 +00:00
|
|
|
TF_PLATFORM_ROOT := ../../plat/
|
2015-12-02 18:17:37 +00:00
|
|
|
include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
|
|
|
|
|
|
|
|
PLAT_INCLUDE := $(wildcard ${PLAT_DIR}include)
|
|
|
|
|
2015-03-27 17:44:35 +00:00
|
|
|
ifeq ($(PLAT_INCLUDE),)
|
2015-12-02 18:17:37 +00:00
|
|
|
$(error "Error: Invalid platform '${PLAT}' has no include directory.")
|
2014-10-21 11:30:42 +01:00
|
|
|
endif
|
2017-05-22 04:11:24 +01:00
|
|
|
endif
|
2014-10-21 11:30:42 +01:00
|
|
|
|
|
|
|
ifeq (${DEBUG},1)
|
2018-10-04 14:35:38 +01:00
|
|
|
HOSTCCFLAGS += -g -O0 -DDEBUG -DLOG_LEVEL=40
|
2014-10-21 11:30:42 +01:00
|
|
|
else
|
2018-10-04 14:35:38 +01:00
|
|
|
HOSTCCFLAGS += -O2 -DLOG_LEVEL=20
|
2014-10-21 11:30:42 +01:00
|
|
|
endif
|
|
|
|
ifeq (${V},0)
|
2017-05-02 11:14:29 +01:00
|
|
|
Q := @
|
2014-10-21 11:30:42 +01:00
|
|
|
else
|
2017-05-02 11:14:29 +01:00
|
|
|
Q :=
|
2014-10-21 11:30:42 +01:00
|
|
|
endif
|
|
|
|
|
2017-05-22 04:11:24 +01:00
|
|
|
$(eval $(call add_define,USE_TBBR_DEFS))
|
2018-10-04 14:35:38 +01:00
|
|
|
HOSTCCFLAGS += ${DEFINES}
|
2017-05-22 04:11:24 +01:00
|
|
|
|
2014-10-21 11:30:42 +01:00
|
|
|
# Make soft links and include from local directory otherwise wrong headers
|
|
|
|
# could get pulled in from firmware tree.
|
2015-06-01 16:34:23 +01:00
|
|
|
INC_DIR := -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include
|
|
|
|
LIB_DIR := -L ${OPENSSL_DIR}/lib
|
2014-10-21 11:30:42 +01:00
|
|
|
LIB := -lssl -lcrypto
|
|
|
|
|
2017-05-02 11:09:11 +01:00
|
|
|
HOSTCC ?= gcc
|
2014-10-21 11:30:42 +01:00
|
|
|
|
2015-12-02 18:22:22 +00:00
|
|
|
.PHONY: all clean realclean
|
2014-10-21 11:30:42 +01:00
|
|
|
|
|
|
|
all: clean ${BINARY}
|
|
|
|
|
|
|
|
${BINARY}: ${OBJECTS} Makefile
|
2018-10-04 14:35:38 +01:00
|
|
|
@echo " HOSTLD $@"
|
2014-10-21 11:30:42 +01:00
|
|
|
@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \
|
2017-05-22 04:11:24 +01:00
|
|
|
const char platform_msg[] = "${PLAT_MSG}";' | \
|
2018-10-04 14:35:38 +01:00
|
|
|
${HOSTCC} -c ${HOSTCCFLAGS} -xc - -o src/build_msg.o
|
2017-05-02 11:09:11 +01:00
|
|
|
${Q}${HOSTCC} src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@
|
2014-10-21 11:30:42 +01:00
|
|
|
|
|
|
|
%.o: %.c
|
2018-10-04 14:35:38 +01:00
|
|
|
@echo " HOSTCC $<"
|
|
|
|
${Q}${HOSTCC} -c ${HOSTCCFLAGS} ${INC_DIR} $< -o $@
|
2014-10-21 11:30:42 +01:00
|
|
|
|
|
|
|
clean:
|
2015-12-02 18:33:55 +00:00
|
|
|
$(call SHELL_DELETE_ALL, src/build_msg.o ${OBJECTS})
|
2014-10-21 11:30:42 +01:00
|
|
|
|
|
|
|
realclean: clean
|
2018-04-30 15:04:02 +01:00
|
|
|
$(call SHELL_DELETE,${BINARY})
|
2015-12-02 18:33:55 +00:00
|
|
|
|