Remi Pommarel | 21d2e3e | 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 | # |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 7 | |
| 8 | toolchains := host |
| 9 | |
Remi Pommarel | 21d2e3e | 2019-03-30 15:58:45 +0100 | [diff] [blame] | 10 | MAKE_HELPERS_DIRECTORY := ../../make_helpers/ |
| 11 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
| 12 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 13 | include ${MAKE_HELPERS_DIRECTORY}toolchain.mk |
Remi Pommarel | 21d2e3e | 2019-03-30 15:58:45 +0100 | [diff] [blame] | 14 | |
| 15 | PROJECT := doimage${BIN_EXT} |
| 16 | OBJECTS := doimage.o |
| 17 | V := 0 |
| 18 | |
| 19 | HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE |
| 20 | |
| 21 | ifeq (${DEBUG},1) |
| 22 | HOSTCCFLAGS += -g -O0 -DDEBUG |
| 23 | else |
| 24 | HOSTCCFLAGS += -O2 |
| 25 | endif |
| 26 | |
| 27 | ifeq (${V},0) |
| 28 | Q := @ |
| 29 | else |
| 30 | Q := |
| 31 | endif |
| 32 | |
Remi Pommarel | 21d2e3e | 2019-03-30 15:58:45 +0100 | [diff] [blame] | 33 | .PHONY: all clean distclean |
| 34 | |
| 35 | all: ${PROJECT} |
| 36 | |
| 37 | ${PROJECT}: ${OBJECTS} Makefile |
| 38 | @echo " HOSTLD $@" |
Chris Kay | 523e864 | 2023-12-04 12:03:51 +0000 | [diff] [blame] | 39 | ${Q}$(host-cc) ${OBJECTS} -o $@ |
Remi Pommarel | 21d2e3e | 2019-03-30 15:58:45 +0100 | [diff] [blame] | 40 | @${ECHO_BLANK_LINE} |
| 41 | @echo "Built $@ successfully" |
| 42 | @${ECHO_BLANK_LINE} |
| 43 | |
| 44 | %.o: %.c Makefile |
| 45 | @echo " HOSTCC $<" |
Chris Kay | 523e864 | 2023-12-04 12:03:51 +0000 | [diff] [blame] | 46 | ${Q}$(host-cc) -c ${HOSTCCFLAGS} $< -o $@ |
Remi Pommarel | 21d2e3e | 2019-03-30 15:58:45 +0100 | [diff] [blame] | 47 | |
| 48 | clean: |
| 49 | $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS}) |
| 50 | |
| 51 | distclean: clean |