blob: 453daaebaa845887e183a88101bcced1934ab985 [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
7MAKE_HELPERS_DIRECTORY := ../../make_helpers/
8include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
9include ${MAKE_HELPERS_DIRECTORY}build_env.mk
Chris Kay1870c722024-05-02 17:52:37 +000010include ${MAKE_HELPERS_DIRECTORY}common.mk
Chris Kayc8a47ba2023-10-20 09:17:33 +000011include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
Yann Gautierba46a932018-07-05 16:50:22 +020012
13PROJECT := stm32image${BIN_EXT}
14OBJECTS := stm32image.o
Yann Gautierba46a932018-07-05 16:50:22 +020015
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010016HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE
17
Yann Gautierba46a932018-07-05 16:50:22 +020018ifeq (${DEBUG},1)
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010019 HOSTCCFLAGS += -g -O0 -DDEBUG
Yann Gautierba46a932018-07-05 16:50:22 +020020else
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010021 HOSTCCFLAGS += -O2
Yann Gautierba46a932018-07-05 16:50:22 +020022endif
23
Yann Gautierba46a932018-07-05 16:50:22 +020024.PHONY: all clean distclean
25
26all: ${PROJECT}
27
28${PROJECT}: ${OBJECTS} Makefile
Chris Kay1870c722024-05-02 17:52:37 +000029 $(s)echo " HOSTLD $@"
30 $(q)$(host-cc) ${OBJECTS} -o $@
31 $(s)echo
32 $(s)echo "Built $@ successfully"
33 $(s)echo
Yann Gautierba46a932018-07-05 16:50:22 +020034
Jan Kiszka67f2f542018-10-02 09:28:00 +020035%.o: %.c Makefile
Chris Kay1870c722024-05-02 17:52:37 +000036 $(s)echo " HOSTCC $<"
37 $(q)$(host-cc) -c ${HOSTCCFLAGS} $< -o $@
Yann Gautierba46a932018-07-05 16:50:22 +020038
39clean:
40 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
41
42distclean: clean