2020# Default user QEMU flags. These are appended to the QEMU command calls.
2121QEMUFLAGS := -m 2G
2222
23+ # User controllable host C compiler.
24+ HOST_CC := cc
25+
2326# User controllable toolchain and toolchain prefix.
2427TOOLCHAIN :=
2528TOOLCHAIN_PREFIX :=
@@ -77,6 +80,20 @@ override USER_CFLAGS := $(CFLAGS)
7780override USER_CPPFLAGS := $(CPPFLAGS )
7881override USER_LDFLAGS := $(LDFLAGS )
7982
83+ override define SEABIOS_CALL =
84+ $(MAKE ) -C seabios $(1 ) \
85+ HOSTCC="$(HOST_CC ) " \
86+ CC="$(CC ) " \
87+ LD="$(LD ) " \
88+ OBJCOPY="$(OBJCOPY ) " \
89+ OBJDUMP="$(OBJDUMP ) " \
90+ STRIP="$(STRIP ) " \
91+ CFLAGS="$(USER_CFLAGS ) " \
92+ CPPFLAGS="$(USER_CPPFLAGS ) " \
93+ LDFLAGS="$(USER_LDFLAGS ) " \
94+ EXTRAVERSION=\"$(SEABIOS_EXTRAVERSION ) \"
95+ endef
96+
8097# Internal C flags that should not be changed by the user.
8198override CFLAGS += \
8299 -Wall \
@@ -99,7 +116,7 @@ override CPPFLAGS := \
99116 -I uACPI/include \
100117 -DUACPI_OVERRIDE_CONFIG \
101118 -DBUILD_VERSION=\"$(BUILD_VERSION ) \" \
102- -isystem freestnd-c-hdrs \
119+ -isystem freestnd-c-hdrs/include \
103120 $(CPPFLAGS ) \
104121 -MMD \
105122 -MP
@@ -261,13 +278,13 @@ endif
261278# Remove object files and the final executable.
262279.PHONY : clean
263280clean : seabios/.config
264- $(MAKE ) -C seabios clean
281+ $(call SEABIOS_CALL, clean)
265282 rm -rf bin-$(ARCH ) obj-$(ARCH )
266283
267284# Remove everything built and generated including downloaded dependencies.
268285.PHONY : distclean
269286distclean : seabios/.config
270- $(MAKE ) -C seabios distclean
287+ $(call SEABIOS_CALL, distclean)
271288 rm -rf src/bins
272289 rm -rf bin-* obj-* ovmf
273290
@@ -287,16 +304,7 @@ uninstall:
287304SEABIOS_EXTRAVERSION := -CSMWrap-$(BUILD_VERSION )
288305.PHONY : seabios
289306seabios : seabios/.config
290- $(MAKE ) -C seabios \
291- CC=" $( CC) " \
292- LD=" $( LD) " \
293- OBJCOPY=" $( OBJCOPY) " \
294- OBJDUMP=" $( OBJDUMP) " \
295- STRIP=" $( STRIP) " \
296- CFLAGS=" $( USER_CFLAGS) " \
297- CPPFLAGS=" $( USER_CPPFLAGS) " \
298- LDFLAGS=" $( USER_LDFLAGS) " \
299- EXTRAVERSION=\" $(SEABIOS_EXTRAVERSION ) \"
307+ $(call SEABIOS_CALL,)
300308
301309src/bins/Csm16.h : GNUmakefile seabios/out/Csm16.bin
302310 mkdir -p src/bins
@@ -308,13 +316,4 @@ src/bins/vgabios.h: GNUmakefile seabios/out/vgabios.bin
308316
309317seabios/.config : GNUmakefile seabios-config
310318 cp seabios-config seabios/.config
311- $(MAKE ) -C seabios olddefconfig \
312- CC=" $( CC) " \
313- LD=" $( LD) " \
314- OBJCOPY=" $( OBJCOPY) " \
315- OBJDUMP=" $( OBJDUMP) " \
316- STRIP=" $( STRIP) " \
317- CFLAGS=" $( USER_CFLAGS) " \
318- CPPFLAGS=" $( USER_CPPFLAGS) " \
319- LDFLAGS=" $( USER_LDFLAGS) " \
320- EXTRAVERSION=\" $(SEABIOS_EXTRAVERSION ) \"
319+ $(call SEABIOS_CALL,olddefconfig)
0 commit comments