Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 1 | # |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 2 | # Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved. |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 3 | # |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 5 | # |
| 6 | |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 7 | MAKE_HELPERS_DIRECTORY := ../../make_helpers/ |
| 8 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 9 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 10 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 11 | PROJECT := fiptool${BIN_EXT} |
| 12 | OBJECTS := fiptool.o tbbr_config.o |
| 13 | V := 0 |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 14 | COPIED_H_FILES := uuid.h firmware_image_package.h |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 15 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 16 | override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 |
Evan Lloyd | f4ba5ca | 2015-12-03 09:47:51 +0000 | [diff] [blame] | 17 | CFLAGS := -Wall -Werror -pedantic -std=c99 |
Jeenu Viswambharan | 2f2cef4 | 2014-02-19 09:38:18 +0000 | [diff] [blame] | 18 | ifeq (${DEBUG},1) |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 19 | CFLAGS += -g -O0 -DDEBUG |
| 20 | else |
| 21 | CFLAGS += -O2 |
| 22 | endif |
dp-arm | 12e893b | 2016-08-24 13:21:08 +0100 | [diff] [blame] | 23 | LDLIBS := -lcrypto |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 24 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 25 | ifeq (${V},0) |
| 26 | Q := @ |
| 27 | else |
| 28 | Q := |
| 29 | endif |
| 30 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 31 | # Only include from local directory (see comment below). |
Evan Lloyd | f4ba5ca | 2015-12-03 09:47:51 +0000 | [diff] [blame] | 32 | INCLUDE_PATHS := -I. |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 33 | |
| 34 | CC := gcc |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 35 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 36 | .PHONY: all clean distclean |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 37 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 38 | all: ${PROJECT} fip_create |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 39 | |
Jeenu Viswambharan | 2f2cef4 | 2014-02-19 09:38:18 +0000 | [diff] [blame] | 40 | ${PROJECT}: ${OBJECTS} Makefile |
| 41 | @echo " LD $@" |
dp-arm | 12e893b | 2016-08-24 13:21:08 +0100 | [diff] [blame] | 42 | ${Q}${CC} ${OBJECTS} -o $@ ${LDLIBS} |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 43 | @${ECHO_BLANK_LINE} |
Sandrine Bailleux | 152c17f | 2014-10-27 17:10:46 +0000 | [diff] [blame] | 44 | @echo "Built $@ successfully" |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 45 | @${ECHO_BLANK_LINE} |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 46 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 47 | fip_create: fip_create.sh |
dp-arm | 65dfe4c | 2016-08-10 13:39:42 +0100 | [diff] [blame] | 48 | ${Q}mkdir -p ../fip_create |
| 49 | ${Q}install -m 755 fip_create.sh ../fip_create/fip_create |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 50 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 51 | %.o: %.c %.h ${COPIED_H_FILES} Makefile |
Jeenu Viswambharan | 2f2cef4 | 2014-02-19 09:38:18 +0000 | [diff] [blame] | 52 | @echo " CC $<" |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 53 | ${Q}${CC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 54 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 55 | # |
| 56 | # Copy required library headers to a local directory so they can be included |
| 57 | # by this project without adding the library directories to the system include |
| 58 | # path. This avoids conflicts with definitions in the compiler standard |
| 59 | # include path. |
| 60 | # |
Dan Handley | d7b59e4 | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 61 | uuid.h : ../../include/lib/stdlib/sys/uuid.h |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 62 | $(call SHELL_COPY,$<,$@) |
| 63 | |
| 64 | firmware_image_package.h : ../../include/common/firmware_image_package.h |
| 65 | $(call SHELL_COPY,$<,$@) |
| 66 | |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 67 | clean: |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 68 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} fip_create) |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 69 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 70 | distclean: clean |
| 71 | $(call SHELL_DELETE_ALL, ${COPIED_H_FILES}) |