blob: 5ff26e5d411e3d5b9d26f2cf7b37c8381add2d32 [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
8toolchains := host
9
Remi Pommarel21d2e3e2019-03-30 15:58:45 +010010MAKE_HELPERS_DIRECTORY := ../../make_helpers/
11include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
12include ${MAKE_HELPERS_DIRECTORY}build_env.mk
Chris Kayc8a47ba2023-10-20 09:17:33 +000013include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
Remi Pommarel21d2e3e2019-03-30 15:58:45 +010014
15PROJECT := doimage${BIN_EXT}
16OBJECTS := doimage.o
17V := 0
18
19HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -D_GNU_SOURCE
20
21ifeq (${DEBUG},1)
22 HOSTCCFLAGS += -g -O0 -DDEBUG
23else
24 HOSTCCFLAGS += -O2
25endif
26
27ifeq (${V},0)
28 Q := @
29else
30 Q :=
31endif
32
Remi Pommarel21d2e3e2019-03-30 15:58:45 +010033.PHONY: all clean distclean
34
35all: ${PROJECT}
36
37${PROJECT}: ${OBJECTS} Makefile
38 @echo " HOSTLD $@"
Chris Kay523e8642023-12-04 12:03:51 +000039 ${Q}$(host-cc) ${OBJECTS} -o $@
Remi Pommarel21d2e3e2019-03-30 15:58:45 +010040 @${ECHO_BLANK_LINE}
41 @echo "Built $@ successfully"
42 @${ECHO_BLANK_LINE}
43
44%.o: %.c Makefile
45 @echo " HOSTCC $<"
Chris Kay523e8642023-12-04 12:03:51 +000046 ${Q}$(host-cc) -c ${HOSTCCFLAGS} $< -o $@
Remi Pommarel21d2e3e2019-03-30 15:58:45 +010047
48clean:
49 $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
50
51distclean: clean