blob: 5dbcbadcf3eb64fcf378e6478b1fd0c9bd227f13 [file] [log] [blame]
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +00001#
Chris Kayc8a47ba2023-10-20 09:17:33 +00002# Copyright (c) 2018-2024, Arm Limited. All rights reserved.
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +00003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Chris Kayc8a47ba2023-10-20 09:17:33 +00007toolchains := host
8
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +00009MAKE_HELPERS_DIRECTORY := ../../make_helpers/
10include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
11include ${MAKE_HELPERS_DIRECTORY}build_env.mk
Chris Kayc8a47ba2023-10-20 09:17:33 +000012include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000013
Manish V Badarkheb9adb522020-09-05 04:40:41 +010014SPTOOL ?= sptool${BIN_EXT}
Manish V Badarkhe635482e2020-08-13 05:56:33 +010015PROJECT := $(notdir ${SPTOOL})
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000016OBJECTS := sptool.o
17V ?= 0
18
19override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
20HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
21ifeq (${DEBUG},1)
22 HOSTCCFLAGS += -g -O0 -DDEBUG
23else
24 HOSTCCFLAGS += -O2
25endif
26
27ifeq (${V},0)
28 Q := @
29else
30 Q :=
31endif
32
33INCLUDE_PATHS := -I../../include/tools_share
34
35HOSTCC ?= gcc
36
37.PHONY: all clean distclean
38
39all: ${PROJECT}
40
41${PROJECT}: ${OBJECTS} Makefile
42 @echo " HOSTLD $@"
43 ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
44 @${ECHO_BLANK_LINE}
45 @echo "Built $@ successfully"
46 @${ECHO_BLANK_LINE}
47
48%.o: %.c Makefile
49 @echo " HOSTCC $<"
50 ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
51
52clean:
53 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})