blob: c75e9411b6b74f2f851e8f07e229e2640a2dc6c2 [file] [log] [blame]
Yann Gautierba46a932018-07-05 16:50:22 +02001#
Chris Kayc8a47ba2023-10-20 09:17:33 +00002# Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
Yann Gautierba46a932018-07-05 16:50:22 +02003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Chris Kayc8a47ba2023-10-20 09:17:33 +00007toolchains := host
8
Yann Gautierba46a932018-07-05 16:50:22 +02009MAKE_HELPERS_DIRECTORY := ../../make_helpers/
10include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
11include ${MAKE_HELPERS_DIRECTORY}build_env.mk
Chris Kayc8a47ba2023-10-20 09:17:33 +000012include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
Yann Gautierba46a932018-07-05 16:50:22 +020013
14PROJECT := stm32image${BIN_EXT}
15OBJECTS := stm32image.o
16V := 0
17
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010018HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE
19
Yann Gautierba46a932018-07-05 16:50:22 +020020ifeq (${DEBUG},1)
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010021 HOSTCCFLAGS += -g -O0 -DDEBUG
Yann Gautierba46a932018-07-05 16:50:22 +020022else
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010023 HOSTCCFLAGS += -O2
Yann Gautierba46a932018-07-05 16:50:22 +020024endif
25
26ifeq (${V},0)
27 Q := @
28else
29 Q :=
30endif
31
Yann Gautierba46a932018-07-05 16:50:22 +020032.PHONY: all clean distclean
33
34all: ${PROJECT}
35
36${PROJECT}: ${OBJECTS} Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010037 @echo " HOSTLD $@"
Chris Kay523e8642023-12-04 12:03:51 +000038 ${Q}$(host-cc) ${OBJECTS} -o $@
Yann Gautierba46a932018-07-05 16:50:22 +020039 @${ECHO_BLANK_LINE}
40 @echo "Built $@ successfully"
41 @${ECHO_BLANK_LINE}
42
Jan Kiszka67f2f542018-10-02 09:28:00 +020043%.o: %.c Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010044 @echo " HOSTCC $<"
Chris Kay523e8642023-12-04 12:03:51 +000045 ${Q}$(host-cc) -c ${HOSTCCFLAGS} $< -o $@
Yann Gautierba46a932018-07-05 16:50:22 +020046
47clean:
48 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
49
50distclean: clean