Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 1 | # |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 2 | # Copyright (c) 2018-2024, Arm Limited. All rights reserved. |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 7 | toolchains := host |
| 8 | |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 9 | MAKE_HELPERS_DIRECTORY := ../../make_helpers/ |
| 10 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
| 11 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 12 | include ${MAKE_HELPERS_DIRECTORY}common.mk |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 13 | include ${MAKE_HELPERS_DIRECTORY}toolchain.mk |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 14 | |
Manish V Badarkhe | b9adb52 | 2020-09-05 04:40:41 +0100 | [diff] [blame] | 15 | SPTOOL ?= sptool${BIN_EXT} |
Manish V Badarkhe | 635482e | 2020-08-13 05:56:33 +0100 | [diff] [blame] | 16 | PROJECT := $(notdir ${SPTOOL}) |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 17 | OBJECTS := sptool.o |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 18 | |
| 19 | override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 |
| 20 | HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 |
| 21 | ifeq (${DEBUG},1) |
| 22 | HOSTCCFLAGS += -g -O0 -DDEBUG |
| 23 | else |
| 24 | HOSTCCFLAGS += -O2 |
| 25 | endif |
| 26 | |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 27 | INCLUDE_PATHS := -I../../include/tools_share |
| 28 | |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 29 | .PHONY: all clean distclean |
| 30 | |
| 31 | all: ${PROJECT} |
| 32 | |
| 33 | ${PROJECT}: ${OBJECTS} Makefile |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 34 | $(s)echo " HOSTLD $@" |
| 35 | $(q)$(host-cc) ${OBJECTS} -o $@ ${LDLIBS} |
| 36 | $(s)echo |
| 37 | $(s)echo "Built $@ successfully" |
| 38 | $(s)echo |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 39 | |
| 40 | %.o: %.c Makefile |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 41 | $(s)echo " HOSTCC $<" |
| 42 | $(q)$(host-cc) -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 43 | |
| 44 | clean: |
| 45 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) |