From eca25952adbb332c4da0a97930d2c4226e44d5d5 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Wed, 4 Sep 2019 14:22:49 -0700 Subject: [PATCH] make: use $(RM) for removing files This is one of the built-in variables for Make and can increase portability on different operating systems (eg, on Windows, the built-in $(RM) may be defined as "del" instead of "rm -f"). --- Makefile | 34 +++++++++++++++++----------------- bootstrap/Makefile | 2 +- graphics/text/Makefile | 7 ++++--- lumps/colormap/Makefile | 2 +- lumps/dmxgus/Makefile | 5 +++-- lumps/genmidi/Makefile | 5 +++-- lumps/playpal/Makefile | 2 +- lumps/textures/Makefile | 4 ++-- 8 files changed, 32 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 697d4370..c063363e 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ wadinfo_freedm.txt : buildcfg.txt subdirs lumps/freedoom.lmp lumps/freedm.lmp $(FREEDM): wadinfo_freedm.txt subdirs @mkdir -p $(WADS) - rm -f $@ + $(RM) $@ $(DEUTEX) $(DEUTEX_ARGS) -iwad -build wadinfo_freedm.txt $@ #--------------------------------------------------------- @@ -56,7 +56,7 @@ wadinfo_phase1.txt: buildcfg.txt subdirs lumps/freedoom.lmp $(FREEDOOM1): wadinfo_phase1.txt subdirs @mkdir -p $(WADS) - rm -f $@ + $(RM) $@ $(DEUTEX) $(DEUTEX_ARGS) -iwad -build wadinfo_phase1.txt $@ #--------------------------------------------------------- @@ -67,7 +67,7 @@ wadinfo_phase2.txt: buildcfg.txt subdirs lumps/freedoom.lmp $(FREEDOOM2): wadinfo_phase2.txt subdirs @mkdir -p $(WADS) - rm -f $@ + $(RM) $@ $(DEUTEX) $(DEUTEX_ARGS) -iwad -build wadinfo_phase2.txt $@ %.html: %.adoc @@ -99,13 +99,13 @@ else endif clean: wad-image-clean - rm -f *.html deutex.log $(OBJS) \ - ./COPYING.txt ./CREDITS.txt \ - ./wadinfo_phase1.txt \ - ./wadinfo_phase2.txt \ - ./wadinfo_freedm.txt \ - ./lumps/freedoom.lmp \ - ./lumps/freedm.lmp + $(RM) *.html deutex.log $(OBJS) \ + ./COPYING.txt ./CREDITS.txt \ + ./wadinfo_phase1.txt \ + ./wadinfo_phase2.txt \ + ./wadinfo_freedm.txt \ + ./lumps/freedoom.lmp \ + ./lumps/freedm.lmp -rmdir $(WADS) $(MAKE) -C dist clean @@ -153,7 +153,7 @@ wad-image: wad-image-common # Cleanup generated images. Structured this way for safety. wad-image-clean: wad-image-common - rm -f $(WI_IMAGES)/*.* + $(RM) $(WI_IMAGES)/* -rmdir $(WI_IMAGES) # Diffing WADs in "levels" using git and show the diff." @@ -286,12 +286,12 @@ install-%: $(WADS)/%.wad %.6 %.png install -Dm 644 dist/$*.png -t "$(target)/share/icons" uninstall-%: - rm "$(target)$(bindir)/$*" - rm "$(target)$(mandir)/man6/$*.6" - rm "$(target)$(waddir)/$*.wad" - rm "$(target)/share/applications/$*.desktop" - rm "$(target)/share/appdata/$*.appdata.xml" - rm "$(target)/share/icons/$*.png" + $(RM) "$(target)$(bindir)/$*" + $(RM) "$(target)$(mandir)/man6/$*.6" + $(RM) "$(target)$(waddir)/$*.wad" + $(RM) "$(target)/share/applications/$*.desktop" + $(RM) "$(target)/share/appdata/$*.appdata.xml" + $(RM) "$(target)/share/icons/$*.png" -rmdir -p "$(target)$(bindir)" -rmdir -p "$(target)$(mandir)/man6" -rmdir -p "$(target)$(waddir)" diff --git a/bootstrap/Makefile b/bootstrap/Makefile index 776056ac..31d927cf 100644 --- a/bootstrap/Makefile +++ b/bootstrap/Makefile @@ -6,6 +6,6 @@ $(IWAD): ../lumps/playpal/playpal-base.lmp ./bootstrap.py < $< > $@ clean: - rm -f $(IWAD) + $(RM) $(IWAD) .PHONY: clean diff --git a/graphics/text/Makefile b/graphics/text/Makefile index 5f3edafc..79dc7fb3 100644 --- a/graphics/text/Makefile +++ b/graphics/text/Makefile @@ -157,12 +157,13 @@ fdmtitle.png: ../titlepic/freedm_titlepic.png cp $@ ../ clean: - rm -f $(TEXTGEN_GRAPHICS) helpbg.png help.png \ + $(RM) $(TEXTGEN_GRAPHICS) helpbg.png help.png \ graphics.stamp *.pyc credtext.png \ credtext.png credit.png dmwilv*.png wikilrs.png \ wivctms.png wikilrs_horiz.png ../credit.png ../help.png \ ../wikilrs.png ../wivctms.png \ fd1title.png fd2title.png fdmtitle.png \ ../fd1title.png ../fd2title.png ../fdmtitle.png - for graphic in $(TEXTGEN_GRAPHICS); do rm -f ../$$graphic; done - rm -fr __pycache__ + for graphic in $(TEXTGEN_GRAPHICS); do $(RM) ../$$graphic; done + $(RM) __pycache__/* + -rmdir __pycache__ diff --git a/lumps/colormap/Makefile b/lumps/colormap/Makefile index e2a98be8..c80bfbf5 100644 --- a/lumps/colormap/Makefile +++ b/lumps/colormap/Makefile @@ -9,6 +9,6 @@ colormap.lmp: $(PLAYPAL) colormap.py ./colormap.py $(PLAYPAL) > colormap.lmp clean: - rm -f $(COLORMAPS) ../$(COLORMAPS) + $(RM) $(COLORMAPS) ../$(COLORMAPS) .PHONY: clean diff --git a/lumps/dmxgus/Makefile b/lumps/dmxgus/Makefile index 69807499..0f596194 100644 --- a/lumps/dmxgus/Makefile +++ b/lumps/dmxgus/Makefile @@ -3,5 +3,6 @@ ultramid.ini : gen-ultramid config.py stats.py cp $@ ../dmxgus.lmp clean: - rm -f ultramid.ini ../dmxgus.lmp *.pyc - rm -fr __pycache__ + $(RM) ultramid.ini ../dmxgus.lmp *.pyc + $(RM) __pycache__/* + -rmdir __pycache__ diff --git a/lumps/genmidi/Makefile b/lumps/genmidi/Makefile index 0954f1aa..5c0fbb9e 100644 --- a/lumps/genmidi/Makefile +++ b/lumps/genmidi/Makefile @@ -3,5 +3,6 @@ genmidi.lmp: config.py instruments/* cp $@ ../ clean: - rm -f genmidi.lmp ../genmidi.lmp *.pyc - rm -fr __pycache__ + $(RM) genmidi.lmp ../genmidi.lmp *.pyc + $(RM) __pycache__/* + -rmdir __pycache__ diff --git a/lumps/playpal/Makefile b/lumps/playpal/Makefile index 999f057a..70cf3d79 100644 --- a/lumps/playpal/Makefile +++ b/lumps/playpal/Makefile @@ -3,6 +3,6 @@ playpal.lmp: playpal-base.lmp playpal.py cp playpal.lmp ../ clean: - rm -f playpal.lmp ../playpal.lmp + $(RM) playpal.lmp ../playpal.lmp .PHONY: clean diff --git a/lumps/textures/Makefile b/lumps/textures/Makefile index 160623c6..f98772e8 100644 --- a/lumps/textures/Makefile +++ b/lumps/textures/Makefile @@ -40,11 +40,11 @@ freedm/texture1.lmp: textures.cfg cp freedm/pnames.lmp ../fdmpname.lmp clean: - rm -f phase1/texture1.lmp phase2/texture1.lmp freedm/texture1.lmp \ + $(RM) phase1/texture1.lmp phase2/texture1.lmp freedm/texture1.lmp \ phase1/texture2.lmp \ phase1/pnames.lmp phase2/pnames.lmp freedm/pnames.lmp \ phase1/pnames.txt phase2/pnames.txt freedm/pnames.txt - rm -f ../fd1txtr1.lmp ../fd1txtr2.lmp ../fd1pname.lmp \ + $(RM) ../fd1txtr1.lmp ../fd1txtr2.lmp ../fd1pname.lmp \ ../fd2txtr1.lmp ../fd2pname.lmp \ ../fdmtxtr1.lmp ../fdmpname.lmp