blob: e336a0c545827b0383fb99707fe1cade04dd78df [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 Kay1870c722024-05-02 17:52:37 +000012include ${MAKE_HELPERS_DIRECTORY}common.mk
Chris Kayc8a47ba2023-10-20 09:17:33 +000013include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000014
Manish V Badarkheb9adb522020-09-05 04:40:41 +010015SPTOOL ?= sptool${BIN_EXT}
Manish V Badarkhe635482e2020-08-13 05:56:33 +010016PROJECT := $(notdir ${SPTOOL})
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000017OBJECTS := sptool.o
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000018
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
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000027INCLUDE_PATHS := -I../../include/tools_share
28
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000029.PHONY: all clean distclean
30
31all: ${PROJECT}
32
33${PROJECT}: ${OBJECTS} Makefile
Chris Kay1870c722024-05-02 17:52:37 +000034 $(s)echo " HOSTLD $@"
35 $(q)$(host-cc) ${OBJECTS} -o $@ ${LDLIBS}
36 $(s)echo
37 $(s)echo "Built $@ successfully"
38 $(s)echo
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000039
40%.o: %.c Makefile
Chris Kay1870c722024-05-02 17:52:37 +000041 $(s)echo " HOSTCC $<"
42 $(q)$(host-cc) -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
Antonio Nino Diaza830a4d2018-11-27 14:58:04 +000043
44clean:
45 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})