[SeaBIOS] [PATCH v2 3/9] Makefile: Invlode preprocessor and assembler with CC

Jiaxun Yang posted 9 patches 2 weeks, 4 days ago
There is a newer version of this series
[SeaBIOS] [PATCH v2 3/9] Makefile: Invlode preprocessor and assembler with CC
Posted by Jiaxun Yang 2 weeks, 4 days ago
Our build system was using host CPP preprocessor which is
not gaurenteed to have necessaey target macros set, convert
to use target CC to invole preprocessor.

The same change is applied to assembler as well for simplicity.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 Makefile | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 1e03a0e5af9a974b0c8c0c8c95269b7635737315..f2f4ebc5b69be1d4b9ecfc99b63f09ecaecd9474 100644
--- a/Makefile
+++ b/Makefile
@@ -16,13 +16,11 @@ export LC_ALL             := C
 
 CROSS_PREFIX              :=
 CC=$(CROSS_PREFIX)gcc
-AS=$(CROSS_PREFIX)as
 LD=$(CROSS_PREFIX)ld
 OBJCOPY=$(CROSS_PREFIX)objcopy
 OBJDUMP=$(CROSS_PREFIX)objdump
 STRIP=$(CROSS_PREFIX)strip
 PYTHON=python
-CPP=cpp
 LD32BIT_FLAG:=-melf_i386
 
 # Source files
@@ -141,7 +139,7 @@ $(OUT)%.o: %.c $(OUT)autoconf.h
 
 $(OUT)%.lds: %.lds.S
 	@echo "  Precompiling $@"
-	$(Q)$(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $@
+	$(Q)$(CC) -E $(COMMONCFLAGS) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $@
 
 
 ################ Main BIOS build rules
@@ -164,7 +162,7 @@ $(OUT)romlayout.o: src/romlayout.S $(OUT)autoconf.h $(OUT)asm-offsets.h
 
 $(OUT)romlayout16.lds: $(OUT)ccode32flat.o $(OUT)code32seg.o $(OUT)ccode16.o $(OUT)romlayout.o src/version.c scripts/layoutrom.py scripts/buildversion.py
 	@echo "  Building ld scripts"
-	$(Q)$(PYTHON) ./scripts/buildversion.py -e "$(EXTRAVERSION)" -t "$(CC);$(AS);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)autoversion.h
+	$(Q)$(PYTHON) ./scripts/buildversion.py -e "$(EXTRAVERSION)" -t "$(CC);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)autoversion.h
 	$(Q)$(CC) $(CFLAGS32FLAT) -c src/version.c -o $(OUT)version.o
 	$(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode32flat.o $(OUT)version.o -o $(OUT)code32flat.o
 	$(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode16.o $(OUT)romlayout.o -o $(OUT)code16.o
@@ -225,7 +223,7 @@ $(OUT)vgaccode16.raw.s: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ;
 $(OUT)vgaccode16.o: $(OUT)vgaccode16.raw.s scripts/vgafixup.py
 	@echo "  Fixup VGA rom assembler"
 	$(Q)$(PYTHON) ./scripts/vgafixup.py $< $(OUT)vgaccode16.s
-	$(Q)$(AS) --32 src/code16gcc.s $(OUT)vgaccode16.s -o $@
+	$(Q)$(CC) -c $(CFLAGS16) $(OUT)vgaccode16.s -o $@
 else
 $(OUT)vgaccode16.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ; $(call whole-compile, $(CFLAGS16) -Isrc, $(SRCVGA),$@)
 endif

-- 
2.43.0

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH v2 3/9] Makefile: Invlode preprocessor and assembler with CC
Posted by Michael Tokarev 2 weeks, 4 days ago
On 03.09.2025 09:51, Jiaxun Yang wrote:
> Our build system was using host CPP preprocessor which is
> not gaurenteed to have necessaey target macros set, convert
> to use target CC to invole preprocessor.

The subject line: "Inlode" => "Invoke".

/mjt
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH v2 3/9] Makefile: Invlode preprocessor and assembler with CC
Posted by Paul Menzel 2 weeks, 4 days ago
Dear Jiaxun,


Thank you for your patch. I noticed a few typos. In the summary: Invlode 
→ Invoke.

Am 03.09.25 um 08:51 schrieb Jiaxun Yang:
> Our build system was using host CPP preprocessor which is
> not gaurenteed to have necessaey target macros set, convert

gaurenteed → guaranteed

> to use target CC to invole preprocessor.

invo*k*e

> The same change is applied to assembler as well for simplicity.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>   Makefile | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 1e03a0e5af9a974b0c8c0c8c95269b7635737315..f2f4ebc5b69be1d4b9ecfc99b63f09ecaecd9474 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -16,13 +16,11 @@ export LC_ALL             := C
>   
>   CROSS_PREFIX              :=
>   CC=$(CROSS_PREFIX)gcc
> -AS=$(CROSS_PREFIX)as
>   LD=$(CROSS_PREFIX)ld
>   OBJCOPY=$(CROSS_PREFIX)objcopy
>   OBJDUMP=$(CROSS_PREFIX)objdump
>   STRIP=$(CROSS_PREFIX)strip
>   PYTHON=python
> -CPP=cpp
>   LD32BIT_FLAG:=-melf_i386
>   
>   # Source files
> @@ -141,7 +139,7 @@ $(OUT)%.o: %.c $(OUT)autoconf.h
>   
>   $(OUT)%.lds: %.lds.S
>   	@echo "  Precompiling $@"
> -	$(Q)$(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $@
> +	$(Q)$(CC) -E $(COMMONCFLAGS) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $@
>   
>   
>   ################ Main BIOS build rules
> @@ -164,7 +162,7 @@ $(OUT)romlayout.o: src/romlayout.S $(OUT)autoconf.h $(OUT)asm-offsets.h
>   
>   $(OUT)romlayout16.lds: $(OUT)ccode32flat.o $(OUT)code32seg.o $(OUT)ccode16.o $(OUT)romlayout.o src/version.c scripts/layoutrom.py scripts/buildversion.py
>   	@echo "  Building ld scripts"
> -	$(Q)$(PYTHON) ./scripts/buildversion.py -e "$(EXTRAVERSION)" -t "$(CC);$(AS);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)autoversion.h
> +	$(Q)$(PYTHON) ./scripts/buildversion.py -e "$(EXTRAVERSION)" -t "$(CC);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)autoversion.h
>   	$(Q)$(CC) $(CFLAGS32FLAT) -c src/version.c -o $(OUT)version.o
>   	$(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode32flat.o $(OUT)version.o -o $(OUT)code32flat.o
>   	$(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode16.o $(OUT)romlayout.o -o $(OUT)code16.o
> @@ -225,7 +223,7 @@ $(OUT)vgaccode16.raw.s: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ;
>   $(OUT)vgaccode16.o: $(OUT)vgaccode16.raw.s scripts/vgafixup.py
>   	@echo "  Fixup VGA rom assembler"
>   	$(Q)$(PYTHON) ./scripts/vgafixup.py $< $(OUT)vgaccode16.s
> -	$(Q)$(AS) --32 src/code16gcc.s $(OUT)vgaccode16.s -o $@
> +	$(Q)$(CC) -c $(CFLAGS16) $(OUT)vgaccode16.s -o $@
>   else
>   $(OUT)vgaccode16.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ; $(call whole-compile, $(CFLAGS16) -Isrc, $(SRCVGA),$@)
>   endif
> 

The diff looks good:

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org