Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 1 | # |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 2 | # Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 3 | # |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 5 | # |
| 6 | |
| 7 | PROJECT := cert_create |
| 8 | PLAT := none |
| 9 | V := 0 |
| 10 | DEBUG := 0 |
Evan Lloyd | 004c9a5 | 2015-12-03 11:35:40 +0000 | [diff] [blame] | 11 | BINARY := ${PROJECT}${BIN_EXT} |
Juan Castillo | f9f39c3 | 2015-06-01 16:34:23 +0100 | [diff] [blame] | 12 | OPENSSL_DIR := /usr |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 13 | |
| 14 | OBJECTS := src/cert.o \ |
Juan Castillo | 1218dd5 | 2015-07-03 16:23:16 +0100 | [diff] [blame] | 15 | src/cmd_opt.o \ |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 16 | src/ext.o \ |
| 17 | src/key.o \ |
| 18 | src/main.o \ |
Juan Castillo | e6d30e9 | 2015-06-12 11:27:59 +0100 | [diff] [blame] | 19 | src/sha.o \ |
| 20 | src/tbbr/tbb_cert.o \ |
| 21 | src/tbbr/tbb_ext.o \ |
| 22 | src/tbbr/tbb_key.o |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 23 | |
| 24 | CFLAGS := -Wall -std=c99 |
| 25 | |
Evan Lloyd | f269714 | 2015-12-02 18:17:37 +0000 | [diff] [blame] | 26 | MAKE_HELPERS_DIRECTORY := ../../make_helpers/ |
| 27 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 28 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Evan Lloyd | f269714 | 2015-12-02 18:17:37 +0000 | [diff] [blame] | 29 | |
| 30 | PLATFORM_ROOT := ../../plat/ |
| 31 | include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk |
| 32 | |
| 33 | PLAT_INCLUDE := $(wildcard ${PLAT_DIR}include) |
| 34 | |
Dan Handley | 81be100 | 2015-03-27 17:44:35 +0000 | [diff] [blame] | 35 | ifeq ($(PLAT_INCLUDE),) |
Evan Lloyd | f269714 | 2015-12-02 18:17:37 +0000 | [diff] [blame] | 36 | $(error "Error: Invalid platform '${PLAT}' has no include directory.") |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 37 | endif |
| 38 | |
| 39 | ifeq (${DEBUG},1) |
| 40 | CFLAGS += -g -O0 -DDEBUG -DLOG_LEVEL=40 |
| 41 | else |
| 42 | CFLAGS += -O2 -DLOG_LEVEL=20 |
| 43 | endif |
| 44 | ifeq (${V},0) |
| 45 | Q := @ |
| 46 | else |
| 47 | Q := |
| 48 | endif |
| 49 | |
| 50 | # Make soft links and include from local directory otherwise wrong headers |
| 51 | # could get pulled in from firmware tree. |
Juan Castillo | f9f39c3 | 2015-06-01 16:34:23 +0100 | [diff] [blame] | 52 | INC_DIR := -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include |
| 53 | LIB_DIR := -L ${OPENSSL_DIR}/lib |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 54 | LIB := -lssl -lcrypto |
| 55 | |
| 56 | CC := gcc |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 57 | |
Evan Lloyd | c0f970d | 2015-12-02 18:22:22 +0000 | [diff] [blame] | 58 | .PHONY: all clean realclean |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 59 | |
| 60 | all: clean ${BINARY} |
| 61 | |
| 62 | ${BINARY}: ${OBJECTS} Makefile |
| 63 | @echo " LD $@" |
| 64 | @echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \ |
| 65 | const char platform_msg[] = "${PLAT}";' | \ |
| 66 | ${CC} -c ${CFLAGS} -xc - -o src/build_msg.o |
| 67 | ${Q}${CC} src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@ |
| 68 | |
| 69 | %.o: %.c |
| 70 | @echo " CC $<" |
| 71 | ${Q}${CC} -c ${CFLAGS} ${INC_DIR} $< -o $@ |
| 72 | |
| 73 | clean: |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 74 | $(call SHELL_DELETE_ALL, src/build_msg.o ${OBJECTS}) |
Juan Castillo | 11abdcd | 2014-10-21 11:30:42 +0100 | [diff] [blame] | 75 | |
| 76 | realclean: clean |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 77 | $(call SHELL_DELETE, ${BINARY}) |
| 78 | |