When Inkscape is terminated by an error, it saves the SVG file
it was processing into an emergency-save SVG file.

In perfbook, this results in extra SVG files such as:

    - advsync/rt-regimes.svgi.2023_MM_DD_hh_mm_ss.0.svg
    - datastruct/hashzu-a.svgi.2023_MM_DD_hh_mm_ss.0.svg

Ignore those files in successive runs of make and remove them
in "make clean", "make cleanfigs", and "make cleanfigs-svg".

Update .gitignore as well.

Signed-off-by: Akira Yokosawa <[email protected]>
---
 .gitignore | 1 +
 Makefile   | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index fa20ccb5de94..ce93394f53b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@
 *.epsi
 *__.eps
 *.svgi
+*.svg*.svg
 *.fcv
 *.ltms
 *.pdfp
diff --git a/Makefile b/Makefile
index 18639b60cece..6e220c2db524 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,9 @@ FIGSOURCES := $(wildcard */*.fig) $(wildcard */*/*.fig)
 
 EPSSOURCES_FROM_FIG := $(FIGSOURCES:%.fig=%.eps)
 
-SVGSOURCES := $(wildcard */*.svg)
+SVGSOURCES_ALL := $(wildcard */*.svg)
+SVG_EMERGENCY := $(wildcard */*.svg*.svg)
+SVGSOURCES := $(filter-out $(SVG_EMERGENCY),$(SVGSOURCES_ALL))
 FAKE_EPS_FROM_SVG := $(SVGSOURCES:%.svg=%.eps)
 PDFTARGETS_OF_SVG := $(SVGSOURCES:%.svg=%.pdf)
 
@@ -603,7 +605,7 @@ clean:
        rm -f perfbook*.sil
        rm -f CodeSamples/snippets.d
        rm -f *.synctex*
-       @rm -f $(OBSOLETE_FILES) $(EPSSOURCES_TMP)
+       @rm -f $(OBSOLETE_FILES) $(EPSSOURCES_TMP) $(SVG_EMERGENCY)
 
 paper-clean:
        rm -f $(BASE_DEPENDS)
@@ -627,7 +629,7 @@ cleanfigs-eps:
        rm -f $(PDFTARGETS_OF_EPS)
 
 cleanfigs-svg:
-       rm -f $(PDFTARGETS_OF_SVG)
+       rm -f $(PDFTARGETS_OF_SVG) $(SVG_EMERGENCY)
 
 cleanfigs: cleanfigs-eps cleanfigs-svg
 
-- 
2.25.1


Reply via email to