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