blob: 9c9b7b5fb64faa13e52edb63c4a4b120259759ad [file] [log] [blame]
Yann Gautierba46a932018-07-05 16:50:22 +02001#
2# Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
3#
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
10
11PROJECT := stm32image${BIN_EXT}
12OBJECTS := stm32image.o
13V := 0
14
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010015HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE
16
Yann Gautierba46a932018-07-05 16:50:22 +020017ifeq (${DEBUG},1)
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010018 HOSTCCFLAGS += -g -O0 -DDEBUG
Yann Gautierba46a932018-07-05 16:50:22 +020019else
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010020 HOSTCCFLAGS += -O2
Yann Gautierba46a932018-07-05 16:50:22 +020021endif
22
23ifeq (${V},0)
24 Q := @
25else
26 Q :=
27endif
28
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010029HOSTCC := gcc
Yann Gautierba46a932018-07-05 16:50:22 +020030
31.PHONY: all clean distclean
32
33all: ${PROJECT}
34
35${PROJECT}: ${OBJECTS} Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010036 @echo " HOSTLD $@"
37 ${Q}${HOSTCC} ${OBJECTS} -o $@
Yann Gautierba46a932018-07-05 16:50:22 +020038 @${ECHO_BLANK_LINE}
39 @echo "Built $@ successfully"
40 @${ECHO_BLANK_LINE}
41
Jan Kiszka67f2f542018-10-02 09:28:00 +020042%.o: %.c Makefile
Antonio Nino Diaz1c4d3622018-10-04 14:35:38 +010043 @echo " HOSTCC $<"
44 ${Q}${HOSTCC} -c ${HOSTCCFLAGS} $< -o $@
Yann Gautierba46a932018-07-05 16:50:22 +020045
46clean:
47 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
48
49distclean: clean