blob: 9325207c40521611b36e7a2ddced10c770406ed0 [file] [log] [blame]
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +00001#
2# Copyright (c) 2018, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7MAKE_HELPERS_DIRECTORY := ../../make_helpers/
8include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
9include ${MAKE_HELPERS_DIRECTORY}build_env.mk
10
11PROJECT := sptool${BIN_EXT}
12OBJECTS := sptool.o
13V ?= 0
14
15override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
16HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
17ifeq (${DEBUG},1)
18 HOSTCCFLAGS += -g -O0 -DDEBUG
19else
20 HOSTCCFLAGS += -O2
21endif
22
23ifeq (${V},0)
24 Q := @
25else
26 Q :=
27endif
28
29INCLUDE_PATHS := -I../../include/tools_share
30
31HOSTCC ?= gcc
32
33.PHONY: all clean distclean
34
35all: ${PROJECT}
36
37${PROJECT}: ${OBJECTS} Makefile
38 @echo " HOSTLD $@"
39 ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
40 @${ECHO_BLANK_LINE}
41 @echo "Built $@ successfully"
42 @${ECHO_BLANK_LINE}
43
44%.o: %.c Makefile
45 @echo " HOSTCC $<"
46 ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
47
48clean:
49 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})