[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 13/19] acpi: Makefile should better tolerate interrupts



Intermediate stages of building a target should be made with
temporary files that are copied to final target in the end.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
---
New in v3

 tools/libacpi/Makefile | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index 12b081e..2d8a954 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -21,38 +21,45 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
 C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, dsdt_anycpu.c dsdt_15cpu.c  
dsdt_anycpu_qemu_xen.c dsdt_pvh.c)
 H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h 
ssdt_tpm.h)
 
+ifeq ($(subst all,,$(MAKECMDGOALS)),)
+TDIR := $(shell mktemp -d --tmpdir=$(TMPDIR) tmp_XXXXXX)
+endif
+
 vpath iasl $(PATH)
 all: $(C_SRC) $(H_SRC)
+       rm -fr $(TDIR)
 
 $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
-       iasl -vs -p $(ACPI_BUILD_DIR)/$* -tc $<
-       sed -e 's/AmlCode/$*/g' $(ACPI_BUILD_DIR)/$*.hex >$@
-       rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
+       iasl -vs -p $(TDIR)/$* -tc $<
+       sed -e 's/AmlCode/$*/g' $(TDIR)/$*.hex > $@
 
 $(MK_DSDT): mk_dsdt.c
        $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
 
 $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl 
$(MK_DSDT)
-       awk 'NR > 1 {print s} {s=$$0}' $< > $@
-       cat dsdt_acpi_info.asl >> $@
-       $(MK_DSDT) --debug=$(debug) --dm-version qemu-xen >> $@
+       awk 'NR > 1 {print s} {s=$$0}' $< > $(TDIR)/$(@F)
+       cat dsdt_acpi_info.asl >> $(TDIR)/$(@F)
+       $(MK_DSDT) --debug=$(debug) --dm-version qemu-xen >> $(TDIR)/$(@F)
+       cp $(TDIR)/$(@F) $@
 
 # NB. awk invocation is a portable alternative to 'head -n -1'
 $(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT)
-       awk 'NR > 1 {print s} {s=$$0}' $< > $@
-       cat dsdt_acpi_info.asl >> $@
-       $(MK_DSDT) --debug=$(debug) --maxcpu $*  >> $@
+       awk 'NR > 1 {print s} {s=$$0}' $< > $(TDIR)/$(@F)
+       cat dsdt_acpi_info.asl >> $(TDIR)/$(@F)
+       $(MK_DSDT) --debug=$(debug) --maxcpu $*  >> $(TDIR)/$(@F)
+       cp $(TDIR)/$(@F) $@
 
 $(ACPI_BUILD_DIR)/dsdt_pvh.asl: dsdt_acpi_info.asl $(MK_DSDT)
-       printf "DefinitionBlock (\"DSDT.aml\", \"DSDT\", 5, \"Xen\", \"HVM\", 
0)\n{" > $@
-       cat dsdt_acpi_info.asl >> $@
-       $(MK_DSDT) --debug=$(debug) --maxcpu any --dm-version none >> $@
+       printf "DefinitionBlock (\"DSDT.aml\", \"DSDT\", 5, \"Xen\", \"HVM\", 
0)\n{" > $(TDIR)/$(@F)
+       cat dsdt_acpi_info.asl >> $(TDIR)/$(@F)
+       $(MK_DSDT) --debug=$(debug) --maxcpu any --dm-version none >> 
$(TDIR)/$(@F)
+       cp $(TDIR)/$(@F) $@
 
 $(C_SRC): $(ACPI_BUILD_DIR)/%.c: iasl $(ACPI_BUILD_DIR)/%.asl
-       iasl -vs -p $(ACPI_BUILD_DIR)/$* -tc $(ACPI_BUILD_DIR)/$*.asl
-       sed -e 's/AmlCode/$*/g' $(ACPI_BUILD_DIR)/$*.hex >$@
-       echo "int $*_len=sizeof($*);" >>$@
-       rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
+       iasl -vs -p $(TDIR)/$* -tc $(TDIR)/$*.asl
+       sed -e 's/AmlCode/$*/g' $(TDIR)/$*.hex > $(TDIR)/$(@F)
+       echo "int $*_len=sizeof($*);" >> $(TDIR)/$(@F)
+       cp $(TDIR)/$(@F) $@
 
 iasl:
        @echo
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.