Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2017-2018, ARM Limited and Contributors. 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 := stm32image${BIN_EXT} |
| 12 | OBJECTS := stm32image.o |
| 13 | V := 0 |
| 14 | |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 15 | HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE |
| 16 | |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 17 | ifeq (${DEBUG},1) |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 18 | HOSTCCFLAGS += -g -O0 -DDEBUG |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 19 | else |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 20 | HOSTCCFLAGS += -O2 |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 21 | endif |
| 22 | |
| 23 | ifeq (${V},0) |
| 24 | Q := @ |
| 25 | else |
| 26 | Q := |
| 27 | endif |
| 28 | |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 29 | HOSTCC := gcc |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 30 | |
| 31 | .PHONY: all clean distclean |
| 32 | |
| 33 | all: ${PROJECT} |
| 34 | |
| 35 | ${PROJECT}: ${OBJECTS} Makefile |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 36 | @echo " HOSTLD $@" |
| 37 | ${Q}${HOSTCC} ${OBJECTS} -o $@ |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 38 | @${ECHO_BLANK_LINE} |
| 39 | @echo "Built $@ successfully" |
| 40 | @${ECHO_BLANK_LINE} |
| 41 | |
Jan Kiszka | 67f2f54 | 2018-10-02 09:28:00 +0200 | [diff] [blame] | 42 | %.o: %.c Makefile |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 43 | @echo " HOSTCC $<" |
| 44 | ${Q}${HOSTCC} -c ${HOSTCCFLAGS} $< -o $@ |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 45 | |
| 46 | clean: |
| 47 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) |
| 48 | |
| 49 | distclean: clean |