blob: a913ce541ded99ed4f3e6be6e2dc56b29d53de04 [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
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000035.PHONY: all clean distclean
36
37all: ${PROJECT}
38
39${PROJECT}: ${OBJECTS} Makefile
40 @echo " HOSTLD $@"
Chris Kay523e8642023-12-04 12:03:51 +000041 ${Q}$(host-cc) ${OBJECTS} -o $@ ${LDLIBS}
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000042 @${ECHO_BLANK_LINE}
43 @echo "Built $@ successfully"
44 @${ECHO_BLANK_LINE}
45
46%.o: %.c Makefile
47 @echo " HOSTCC $<"
Chris Kay523e8642023-12-04 12:03:51 +000048 ${Q}$(host-cc) -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000049
50clean:
51 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})