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

[Xen-devel] [PATCH v4 15/21] 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>
---
Changes in v4:
* Instead of storing those intermediate files in /tmp keep then locally
  by adding TMP_SUFFIX to target.

 tools/libacpi/Makefile | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index 83d6a8f..68351c7 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -15,7 +15,8 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
-# Used as a workaround for a bug in some older iasl versions where
+# Suffix for temporary files.
+# Also used as a workaround for a bug in some older iasl versions where
 # the tool will ignore everything after last '.' in the path ('-p' argument)
 TMP_SUFFIX     = tmp__
 
@@ -38,26 +39,30 @@ $(MK_DSDT): mk_dsdt.c
 
 ifeq ($(GPL),y)
 $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: gpl/dsdt.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}' $< > $@.$(TMP_SUFFIX)
+       cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
+       $(MK_DSDT) --debug=$(debug) --dm-version qemu-xen >> $@.$(TMP_SUFFIX)
+       mv -f $@.$(TMP_SUFFIX) $@
 
 # NB. awk invocation is a portable alternative to 'head -n -1'
 $(ACPI_BUILD_DIR)/dsdt_%cpu.asl: gpl/dsdt.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}' $< > $@.$(TMP_SUFFIX)
+       cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
+       $(MK_DSDT) --debug=$(debug) --maxcpu $*  >> $@.$(TMP_SUFFIX)
+       mv -f $@.$(TMP_SUFFIX) $@
 endif
 
 $(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{" > $@.$(TMP_SUFFIX)
+       cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
+       $(MK_DSDT) --debug=$(debug) --maxcpu any --dm-version none >> 
$@.$(TMP_SUFFIX)
+       mv -f $@.$(TMP_SUFFIX) $@
 
 $(C_SRC): $(ACPI_BUILD_DIR)/%.c: iasl $(ACPI_BUILD_DIR)/%.asl
        iasl -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc 
$(ACPI_BUILD_DIR)/$*.asl
-       sed -e 's/AmlCode/$*/g' $(ACPI_BUILD_DIR)/$*.hex >$@
-       echo "int $*_len=sizeof($*);" >>$@
+       sed -e 's/AmlCode/$*/g' $(ACPI_BUILD_DIR)/$*.hex >$@.$(TMP_SUFFIX)
+       echo "int $*_len=sizeof($*);" >>$@.$(TMP_SUFFIX)
+       mv -f $@.$(TMP_SUFFIX) $@
        rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
 
 iasl:
@@ -70,6 +75,7 @@ iasl:
 
 clean:
        rm -fr $(C_SRC) $(H_SRC) $(MK_DSDT) $(patsubst %.c,%.asl,$(C_SRC))
+       rm -f $(C_SRC:=.$(TMP_SUFFIX)) $(patsubst %.c,%.hex,$(C_SRC)) 
$(patsubst %.c,%.aml,$(C_SRC))
 
 distclean: clean
 
-- 
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®.