Makefile 1.13 KB
Newer Older
1
#
2
# Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
3
#
dp-arm's avatar
dp-arm committed
4
# SPDX-License-Identifier: BSD-3-Clause
5
6
#

7
8
MAKE_HELPERS_DIRECTORY := ../../make_helpers/
include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
9
include ${MAKE_HELPERS_DIRECTORY}build_env.mk
10

dp-arm's avatar
dp-arm committed
11
12
PROJECT := fiptool${BIN_EXT}
OBJECTS := fiptool.o tbbr_config.o
13
V ?= 0
14

dp-arm's avatar
dp-arm committed
15
override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
16
CFLAGS := -Wall -Werror -pedantic -std=c99
17
ifeq (${DEBUG},1)
18
19
20
21
  CFLAGS += -g -O0 -DDEBUG
else
  CFLAGS += -O2
endif
22
LDLIBS := -lcrypto
23

dp-arm's avatar
dp-arm committed
24
25
26
27
28
29
ifeq (${V},0)
  Q := @
else
  Q :=
endif

30
INCLUDE_PATHS := -I. -I../../include/tools_share
31

dp-arm's avatar
dp-arm committed
32
HOSTCC ?= gcc
33

34
.PHONY: all clean distclean
35

dp-arm's avatar
dp-arm committed
36
all: ${PROJECT} fip_create
37

38
39
${PROJECT}: ${OBJECTS} Makefile
	@echo "  LD      $@"
dp-arm's avatar
dp-arm committed
40
	${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
41
	@${ECHO_BLANK_LINE}
42
	@echo "Built $@ successfully"
43
	@${ECHO_BLANK_LINE}
44

dp-arm's avatar
dp-arm committed
45
fip_create: fip_create.sh
46
47
	${Q}mkdir -p ../fip_create
	${Q}install -m 755 fip_create.sh ../fip_create/fip_create
dp-arm's avatar
dp-arm committed
48

49
%.o: %.c %.h Makefile
50
	@echo "  CC      $<"
dp-arm's avatar
dp-arm committed
51
	${Q}${HOSTCC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@
52
53

clean:
dp-arm's avatar
dp-arm committed
54
	$(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} fip_create)