Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 1 | # |
Manish V Badarkhe | 635482e | 2020-08-13 05:56:33 +0100 | [diff] [blame] | 2 | # Copyright (c) 2018-2020, 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 | |
| 7 | MAKE_HELPERS_DIRECTORY := ../../make_helpers/ |
| 8 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
| 9 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
| 10 | |
Manish V Badarkhe | b9adb52 | 2020-09-05 04:40:41 +0100 | [diff] [blame] | 11 | SPTOOL ?= sptool${BIN_EXT} |
Manish V Badarkhe | 635482e | 2020-08-13 05:56:33 +0100 | [diff] [blame] | 12 | PROJECT := $(notdir ${SPTOOL}) |
Antonio Nino Diaz | a830a4d | 2018-11-27 14:58:04 +0000 | [diff] [blame] | 13 | OBJECTS := sptool.o |
| 14 | V ?= 0 |
| 15 | |
| 16 | override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 |
| 17 | HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 |
| 18 | ifeq (${DEBUG},1) |
| 19 | HOSTCCFLAGS += -g -O0 -DDEBUG |
| 20 | else |
| 21 | HOSTCCFLAGS += -O2 |
| 22 | endif |
| 23 | |
| 24 | ifeq (${V},0) |
| 25 | Q := @ |
| 26 | else |
| 27 | Q := |
| 28 | endif |
| 29 | |
| 30 | INCLUDE_PATHS := -I../../include/tools_share |
| 31 | |
| 32 | HOSTCC ?= gcc |
| 33 | |
| 34 | .PHONY: all clean distclean |
| 35 | |
| 36 | all: ${PROJECT} |
| 37 | |
| 38 | ${PROJECT}: ${OBJECTS} Makefile |
| 39 | @echo " HOSTLD $@" |
| 40 | ${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS} |
| 41 | @${ECHO_BLANK_LINE} |
| 42 | @echo "Built $@ successfully" |
| 43 | @${ECHO_BLANK_LINE} |
| 44 | |
| 45 | %.o: %.c Makefile |
| 46 | @echo " HOSTCC $<" |
| 47 | ${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@ |
| 48 | |
| 49 | clean: |
| 50 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) |