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