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 | |
| 35 | HOSTCC ?= gcc |
| 36 | |
| 37 | .PHONY: all clean distclean |
| 38 | |
| 39 | all: ${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 | |
| 52 | clean: |
| 53 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) |