1# 2# Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved. 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 31MAKE_HELPERS_DIRECTORY := ../../make_helpers/ 32include ${MAKE_HELPERS_DIRECTORY}build_macros.mk 33include ${MAKE_HELPERS_DIRECTORY}build_env.mk 34 35PROJECT := fiptool${BIN_EXT} 36OBJECTS := fiptool.o tbbr_config.o 37V := 0 38COPIED_H_FILES := uuid.h firmware_image_package.h 39 40override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 41CFLAGS := -Wall -Werror -pedantic -std=c99 42ifeq (${DEBUG},1) 43 CFLAGS += -g -O0 -DDEBUG 44else 45 CFLAGS += -O2 46endif 47 48ifeq (${V},0) 49 Q := @ 50else 51 Q := 52endif 53 54# Only include from local directory (see comment below). 55INCLUDE_PATHS := -I. 56 57CC := gcc 58 59.PHONY: all clean distclean 60 61all: ${PROJECT} fip_create 62 63${PROJECT}: ${OBJECTS} Makefile 64 @echo " LD $@" 65 ${Q}${CC} ${OBJECTS} -o $@ 66 @${ECHO_BLANK_LINE} 67 @echo "Built $@ successfully" 68 @${ECHO_BLANK_LINE} 69 70fip_create: fip_create.sh 71 mkdir -p ../fip_create 72 install -m 755 fip_create.sh ../fip_create/fip_create 73 74%.o: %.c %.h ${COPIED_H_FILES} Makefile 75 @echo " CC $<" 76 ${Q}${CC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ 77 78# 79# Copy required library headers to a local directory so they can be included 80# by this project without adding the library directories to the system include 81# path. This avoids conflicts with definitions in the compiler standard 82# include path. 83# 84uuid.h : ../../include/lib/stdlib/sys/uuid.h 85 $(call SHELL_COPY,$<,$@) 86 87firmware_image_package.h : ../../include/common/firmware_image_package.h 88 $(call SHELL_COPY,$<,$@) 89 90clean: 91 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} fip_create) 92 93distclean: clean 94 $(call SHELL_DELETE_ALL, ${COPIED_H_FILES}) 95