blob: 7bfee7d7c35edf66eadf19f2fa1b22f552833b12 [file] [log] [blame]
Remi Pommarel21d2e3e2019-03-30 15:58:45 +01001#
2# Copyright (C) 2019 Remi Pommarel <repk@triplefau.lt>
3#
4# SPDX-License-Identifier: BSD-3-Clause
5# https://spdx.org/licenses
6#
Chris Kayc8a47ba2023-10-20 09:17:33 +00007
Remi Pommarel21d2e3e2019-03-30 15:58:45 +01008MAKE_HELPERS_DIRECTORY := ../../make_helpers/
9include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
10include ${MAKE_HELPERS_DIRECTORY}build_env.mk
Chris Kay1870c722024-05-02 17:52:37 +000011include ${MAKE_HELPERS_DIRECTORY}common.mk
Chris Kayc8a47ba2023-10-20 09:17:33 +000012include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
Remi Pommarel21d2e3e2019-03-30 15:58:45 +010013
14PROJECT := doimage${BIN_EXT}
15OBJECTS := doimage.o
Remi Pommarel21d2e3e2019-03-30 15:58:45 +010016
17HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE
18
19ifeq (${DEBUG},1)
20 HOSTCCFLAGS += -g -O0 -DDEBUG
21else
22 HOSTCCFLAGS += -O2
23endif
24
Remi Pommarel21d2e3e2019-03-30 15:58:45 +010025.PHONY: all clean distclean
26
27all: ${PROJECT}
28
29${PROJECT}: ${OBJECTS} Makefile
Chris Kay1870c722024-05-02 17:52:37 +000030 $(s)echo " HOSTLD $@"
31 $(q)$(host-cc) ${OBJECTS} -o $@
32 $(s)echo
33 $(s)echo "Built $@ successfully"
34 $(s)echo
Remi Pommarel21d2e3e2019-03-30 15:58:45 +010035
36%.o: %.c Makefile
Chris Kay1870c722024-05-02 17:52:37 +000037 $(s)echo " HOSTCC $<"
38 $(q)$(host-cc) -c ${HOSTCCFLAGS} $< -o $@
Remi Pommarel21d2e3e2019-03-30 15:58:45 +010039
40clean:
41 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
42
43distclean: clean