blob: f724c265a2c6b9bcdb78be55627e92ef2a5fd9b0 [file] [log] [blame]
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +00001#
Manish V Badarkhe635482e2020-08-13 05:56:33 +01002# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +00003#
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
Manish V Badarkhe635482e2020-08-13 05:56:33 +010011PROJECT := $(notdir ${SPTOOL})
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000012OBJECTS := 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})