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 | # |
| 4 | # Redistribution and use in source and binary forms, with or without |
| 5 | # modification, are permitted provided that the following conditions are met: |
| 6 | # |
| 7 | # Redistributions of source code must retain the above copyright notice, this |
| 8 | # list of conditions and the following disclaimer. |
| 9 | # |
| 10 | # Redistributions in binary form must reproduce the above copyright notice, |
| 11 | # this list of conditions and the following disclaimer in the documentation |
| 12 | # and/or other materials provided with the distribution. |
| 13 | # |
| 14 | # Neither the name of ARM nor the names of its contributors may be used |
| 15 | # to endorse or promote products derived from this software without specific |
| 16 | # prior written permission. |
| 17 | # |
| 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 22 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 26 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | # POSSIBILITY OF SUCH DAMAGE. |
| 29 | # |
| 30 | |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 31 | MAKE_HELPERS_DIRECTORY := ../../make_helpers/ |
| 32 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 33 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 34 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 35 | PROJECT := fiptool${BIN_EXT} |
| 36 | OBJECTS := fiptool.o tbbr_config.o |
| 37 | V := 0 |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 38 | COPIED_H_FILES := uuid.h firmware_image_package.h |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 39 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 40 | override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 |
Evan Lloyd | f4ba5ca | 2015-12-03 09:47:51 +0000 | [diff] [blame] | 41 | CFLAGS := -Wall -Werror -pedantic -std=c99 |
Jeenu Viswambharan | 2f2cef4 | 2014-02-19 09:38:18 +0000 | [diff] [blame] | 42 | ifeq (${DEBUG},1) |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 43 | CFLAGS += -g -O0 -DDEBUG |
| 44 | else |
| 45 | CFLAGS += -O2 |
| 46 | endif |
dp-arm | 12e893b | 2016-08-24 13:21:08 +0100 | [diff] [blame] | 47 | LDLIBS := -lcrypto |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 48 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 49 | ifeq (${V},0) |
| 50 | Q := @ |
| 51 | else |
| 52 | Q := |
| 53 | endif |
| 54 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 55 | # Only include from local directory (see comment below). |
Evan Lloyd | f4ba5ca | 2015-12-03 09:47:51 +0000 | [diff] [blame] | 56 | INCLUDE_PATHS := -I. |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 57 | |
| 58 | CC := gcc |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 59 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 60 | .PHONY: all clean distclean |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 61 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 62 | all: ${PROJECT} fip_create |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 63 | |
Jeenu Viswambharan | 2f2cef4 | 2014-02-19 09:38:18 +0000 | [diff] [blame] | 64 | ${PROJECT}: ${OBJECTS} Makefile |
| 65 | @echo " LD $@" |
dp-arm | 12e893b | 2016-08-24 13:21:08 +0100 | [diff] [blame] | 66 | ${Q}${CC} ${OBJECTS} -o $@ ${LDLIBS} |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 67 | @${ECHO_BLANK_LINE} |
Sandrine Bailleux | 152c17f | 2014-10-27 17:10:46 +0000 | [diff] [blame] | 68 | @echo "Built $@ successfully" |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 69 | @${ECHO_BLANK_LINE} |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 70 | |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 71 | fip_create: fip_create.sh |
dp-arm | 65dfe4c | 2016-08-10 13:39:42 +0100 | [diff] [blame] | 72 | ${Q}mkdir -p ../fip_create |
| 73 | ${Q}install -m 755 fip_create.sh ../fip_create/fip_create |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 74 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 75 | %.o: %.c %.h ${COPIED_H_FILES} Makefile |
Jeenu Viswambharan | 2f2cef4 | 2014-02-19 09:38:18 +0000 | [diff] [blame] | 76 | @echo " CC $<" |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 77 | ${Q}${CC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 78 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 79 | # |
| 80 | # Copy required library headers to a local directory so they can be included |
| 81 | # by this project without adding the library directories to the system include |
| 82 | # path. This avoids conflicts with definitions in the compiler standard |
| 83 | # include path. |
| 84 | # |
Dan Handley | d7b59e4 | 2016-06-02 17:15:13 +0100 | [diff] [blame] | 85 | uuid.h : ../../include/lib/stdlib/sys/uuid.h |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 86 | $(call SHELL_COPY,$<,$@) |
| 87 | |
| 88 | firmware_image_package.h : ../../include/common/firmware_image_package.h |
| 89 | $(call SHELL_COPY,$<,$@) |
| 90 | |
Harry Liebel | f58ad36 | 2014-01-10 18:00:33 +0000 | [diff] [blame] | 91 | clean: |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 92 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} fip_create) |
Evan Lloyd | 26c6cb4 | 2015-12-02 18:33:55 +0000 | [diff] [blame] | 93 | |
Evan Lloyd | 93a7640 | 2015-12-02 20:30:13 +0000 | [diff] [blame] | 94 | distclean: clean |
| 95 | $(call SHELL_DELETE_ALL, ${COPIED_H_FILES}) |