[SeaBIOS] [PATCH] seabios: remove iasl output file when error.

Isaku Yamahata yamahata at valinux.co.jp
Mon Jun 7 10:28:54 CEST 2010


On Sun, Jun 06, 2010 at 05:12:27PM -0400, Kevin O'Connor wrote:
> On Fri, May 28, 2010 at 07:01:35PM +0900, Isaku Yamahata wrote:
> > Surprisingly iasl creates output file even when compilation error.
> > So typing make after an error will succeed.
> > This patch prevents it by removing the output file when error.
> > And adds related dependencies to compile when .hex is missing.
> [...]
> >  ####### dsdt build rules
> > -src/acpi-dsdt.hex: src/acpi-dsdt.dsl
> > +$(OUT)%.dsl.i: src/%.dsl
> > +	$(Q)cpp -P $< > $@
> > +
> > +src/%.hex: $(OUT)%.dsl.i
> >  	@echo "Compiling DSDT"
> > -	$(Q)cpp -P $< > $(OUT)acpi-dsdt.dsl.i
> > -	$(Q)iasl -tc -p $@ $(OUT)acpi-dsdt.dsl.i
> > -	$(Q)rm $(OUT)acpi-dsdt.dsl.i
> > +	$(Q)iasl -tc -p $@ $< || (e=$$?; rm $@; exit $$e)
> > +
> > +src/acpi.c: src/acpi-dsdt.hex
> > +$(OUT)ccode32flat.o: src/acpi.c
> > +$(OUT)../src/acpi-dsdt.hex: src/acpi-dsdt.hex
> 
> This doesn't look right - gcc should be emitting file dependencies on
> its own.  How about:

Works for me. Thank you.
I generalized it a bit so that the rule can be applied to other dsl.
I'm working on qemu q35 chipset which requires its own dsdt other
than the existing one.

> 
> --- a/Makefile
> +++ b/Makefile
> @@ -187,8 +187,10 @@ $(OUT)vgabios.bin: $(OUT)vgabios.bin.raw tools/buildrom.py
>  src/acpi-dsdt.hex: src/acpi-dsdt.dsl
>         @echo "Compiling DSDT"
>         $(Q)cpp -P $< > $(OUT)acpi-dsdt.dsl.i
> -       $(Q)iasl -tc -p $@ $(OUT)acpi-dsdt.dsl.i
> -       $(Q)rm $(OUT)acpi-dsdt.dsl.i
> +       $(Q)iasl -tc -p $(OUT)acpi-dsdt $(OUT)acpi-dsdt.dsl.i
> +       $(Q)cp $(OUT)acpi-dsdt.hex $@
> +
> +$(OUT)ccode32flat.o: src/acpi-dsdt.hex
>  
>  ####### Generic rules
>  clean:
> 
> -Kevin
> 

>From 9c95b8e2c5379b5f4f06e7eb13d490418480a1ae Mon Sep 17 00:00:00 2001
Message-Id: <9c95b8e2c5379b5f4f06e7eb13d490418480a1ae.1275898861.git.yamahata at valinux.co.jp>
In-Reply-To: <cover.1275898861.git.yamahata at valinux.co.jp>
References: <cover.1275898861.git.yamahata at valinux.co.jp>
From: Isaku Yamahata <yamahata at valinux.co.jp>
Date: Mon, 7 Jun 2010 17:19:27 +0900
Subject: [PATCH] seabios: remove iasl output file when error.

Surprisingly iasl creates output file even when compilation error.
So typing make after an error will succeed.
This patch prevents it by removing the output file when error.
And adds related dependencies to compile when .hex is missing.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>

---
Changes v1 -> v2
- followed suggestion by Kevin.
---
 Makefile |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 72d711d..927999c 100644
--- a/Makefile
+++ b/Makefile
@@ -184,11 +184,13 @@ $(OUT)vgabios.bin: $(OUT)vgabios.bin.raw tools/buildrom.py
 	$(Q)./tools/buildrom.py $< $@
 
 ####### dsdt build rules
-src/acpi-dsdt.hex: src/acpi-dsdt.dsl
+src/%.hex: src/%.dsl
 	@echo "Compiling DSDT"
-	$(Q)cpp -P $< > $(OUT)acpi-dsdt.dsl.i
-	$(Q)iasl -tc -p $@ $(OUT)acpi-dsdt.dsl.i
-	$(Q)rm $(OUT)acpi-dsdt.dsl.i
+	$(Q)cpp -P $< > $(OUT)$*.dsl.i
+	$(Q)iasl -tc -p $(OUT)$* $(OUT)$*.dsl.i
+	$(Q)cp $(OUT)$*.hex $@
+
+$(OUT)ccode32flat.o: src/acpi-dsdt.hex
 
 ####### Generic rules
 clean:
-- 
1.6.6.1



More information about the SeaBIOS mailing list