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 | |
| 7 | MAKE_HELPERS_DIRECTORY := ../../make_helpers/ |
| 8 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
| 9 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 10 | include ${MAKE_HELPERS_DIRECTORY}common.mk |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 11 | include ${MAKE_HELPERS_DIRECTORY}toolchain.mk |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 12 | |
| 13 | PROJECT := stm32image${BIN_EXT} |
| 14 | OBJECTS := stm32image.o |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 15 | |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 16 | HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE |
| 17 | |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 18 | ifeq (${DEBUG},1) |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 19 | HOSTCCFLAGS += -g -O0 -DDEBUG |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 20 | else |
Antonio Nino Diaz | 1c4d362 | 2018-10-04 14:35:38 +0100 | [diff] [blame] | 21 | HOSTCCFLAGS += -O2 |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 22 | endif |
| 23 | |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 24 | .PHONY: all clean distclean |
| 25 | |
| 26 | all: ${PROJECT} |
| 27 | |
| 28 | ${PROJECT}: ${OBJECTS} Makefile |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 29 | $(s)echo " HOSTLD $@" |
| 30 | $(q)$(host-cc) ${OBJECTS} -o $@ |
| 31 | $(s)echo |
| 32 | $(s)echo "Built $@ successfully" |
| 33 | $(s)echo |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 34 | |
Jan Kiszka | 67f2f54 | 2018-10-02 09:28:00 +0200 | [diff] [blame] | 35 | %.o: %.c Makefile |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 36 | $(s)echo " HOSTCC $<" |
| 37 | $(q)$(host-cc) -c ${HOSTCCFLAGS} $< -o $@ |
Yann Gautier | ba46a93 | 2018-07-05 16:50:22 +0200 | [diff] [blame] | 38 | |
| 39 | clean: |
| 40 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) |
| 41 | |
| 42 | distclean: clean |