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