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 | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 12 | include ${MAKE_HELPERS_DIRECTORY}toolchain.mk |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 13 | |
Manish V Badarkhe | b9adb52 | 2020-09-05 04:40:41 +0100 | [diff] [blame] | 14 | SPTOOL ?= sptool${BIN_EXT} |
Manish V Badarkhe | 635482e | 2020-08-13 05:56:33 +0100 | [diff] [blame] | 15 | PROJECT := $(notdir ${SPTOOL}) |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 16 | OBJECTS := sptool.o |
| 17 | V ?= 0 |
| 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 | |
| 27 | ifeq (${V},0) |
| 28 | Q := @ |
| 29 | else |
| 30 | Q := |
| 31 | endif |
| 32 | |
| 33 | INCLUDE_PATHS := -I../../include/tools_share |
| 34 | |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 35 | .PHONY: all clean distclean |
| 36 | |
| 37 | all: ${PROJECT} |
| 38 | |
| 39 | ${PROJECT}: ${OBJECTS} Makefile |
| 40 | @echo " HOSTLD $@" |
Chris Kay | 523e864 | 2023-12-04 12:03:51 +0000 | [diff] [blame] | 41 | ${Q}$(host-cc) ${OBJECTS} -o $@ ${LDLIBS} |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 42 | @${ECHO_BLANK_LINE} |
| 43 | @echo "Built $@ successfully" |
| 44 | @${ECHO_BLANK_LINE} |
| 45 | |
| 46 | %.o: %.c Makefile |
| 47 | @echo " HOSTCC $<" |
Chris Kay | 523e864 | 2023-12-04 12:03:51 +0000 | [diff] [blame] | 48 | ${Q}$(host-cc) -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 49 | |
| 50 | clean: |
| 51 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) |