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