Remi Pommarel | 9f52e88 | 2019-03-30 15:58:45 +0100 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2019 Remi Pommarel <repk@triplefau.lt> |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # https://spdx.org/licenses |
| 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 := doimage${BIN_EXT} |
| 12 | OBJECTS := doimage.o |
| 13 | V := 0 |
| 14 | |
| 15 | HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE |
| 16 | |
| 17 | ifeq (${DEBUG},1) |
| 18 | HOSTCCFLAGS += -g -O0 -DDEBUG |
| 19 | else |
| 20 | HOSTCCFLAGS += -O2 |
| 21 | endif |
| 22 | |
| 23 | ifeq (${V},0) |
| 24 | Q := @ |
| 25 | else |
| 26 | Q := |
| 27 | endif |
| 28 | |
| 29 | HOSTCC := gcc |
| 30 | |
| 31 | .PHONY: all clean distclean |
| 32 | |
| 33 | all: ${PROJECT} |
| 34 | |
| 35 | ${PROJECT}: ${OBJECTS} Makefile |
| 36 | @echo " HOSTLD $@" |
| 37 | ${Q}${HOSTCC} ${OBJECTS} -o $@ |
| 38 | @${ECHO_BLANK_LINE} |
| 39 | @echo "Built $@ successfully" |
| 40 | @${ECHO_BLANK_LINE} |
| 41 | |
| 42 | %.o: %.c Makefile |
| 43 | @echo " HOSTCC $<" |
| 44 | ${Q}${HOSTCC} -c ${HOSTCCFLAGS} $< -o $@ |
| 45 | |
| 46 | clean: |
| 47 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) |
| 48 | |
| 49 | distclean: clean |