From a6bd98c3fb50c8a975abda35f3d4939fab117bd0 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Thu, 10 Aug 2017 12:23:41 -0700 Subject: [PATCH 1/3] Enclose makefile paths in quotes for safety --- makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/makefile b/makefile index 7e797cb..4d2fc0a 100644 --- a/makefile +++ b/makefile @@ -6,22 +6,22 @@ LUA_SHAREDIR=$(LUA_PREFIX)/share/lua/5.1 ldoc: install: install_parts - echo "lua $(LUA_SHAREDIR)/ldoc.lua \$$*" > $(DESTDIR)$(LUA_BINDIR)/ldoc - chmod +x $(DESTDIR)$(LUA_BINDIR)/ldoc + echo "lua $(LUA_SHAREDIR)/ldoc.lua \$$*" > "$(DESTDIR)$(LUA_BINDIR)/ldoc" + chmod +x "$(DESTDIR)$(LUA_BINDIR)/ldoc" install_luajit: install_parts - echo "luajit $(LUA_SHAREDIR)/ldoc.lua \$$*" > $(DESTDIR)$(LUA_BINDIR)/ldoc - chmod +x $(DESTDIR)$(LUA_BINDIR)/ldoc + echo "luajit $(LUA_SHAREDIR)/ldoc.lua \$$*" > "$(DESTDIR)$(LUA_BINDIR)/ldoc" + chmod +x "$(DESTDIR)$(LUA_BINDIR)/ldoc" install_parts: - mkdir -p $(DESTDIR)$(LUA_SHAREDIR) - cp ldoc.lua $(DESTDIR)$(LUA_SHAREDIR) - cp -r ldoc $(DESTDIR)$(LUA_SHAREDIR) + mkdir -p "$(DESTDIR)$(LUA_SHAREDIR)" + cp ldoc.lua "$(DESTDIR)$(LUA_SHAREDIR)" + cp -r ldoc "$(DESTDIR)$(LUA_SHAREDIR)" uninstall: - -rm $(DESTDIR)$(LUA_SHAREDIR)/ldoc.lua - -rm -r $(DESTDIR)$(LUA_SHAREDIR)/ldoc - -rm $(DESTDIR)$(LUA_BINDIR)/ldoc + -rm "$(DESTDIR)$(LUA_SHAREDIR)/ldoc.lua" + -rm -r "$(DESTDIR)$(LUA_SHAREDIR)/ldoc" + -rm "$(DESTDIR)$(LUA_BINDIR)/ldoc" test: test-basic test-example test-md test-tables From 03fcec035fa844c67f867bace52bb37a9412e1e6 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Thu, 10 Aug 2017 12:36:00 -0700 Subject: [PATCH 2/3] makefile: Suppress automatic echoing & use verbosity in commands --- makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/makefile b/makefile index 4d2fc0a..8bc1793 100644 --- a/makefile +++ b/makefile @@ -6,22 +6,22 @@ LUA_SHAREDIR=$(LUA_PREFIX)/share/lua/5.1 ldoc: install: install_parts - echo "lua $(LUA_SHAREDIR)/ldoc.lua \$$*" > "$(DESTDIR)$(LUA_BINDIR)/ldoc" - chmod +x "$(DESTDIR)$(LUA_BINDIR)/ldoc" + @echo "lua $(LUA_SHAREDIR)/ldoc.lua \$$*" > "$(DESTDIR)$(LUA_BINDIR)/ldoc" + @chmod -v +x "$(DESTDIR)$(LUA_BINDIR)/ldoc" install_luajit: install_parts - echo "luajit $(LUA_SHAREDIR)/ldoc.lua \$$*" > "$(DESTDIR)$(LUA_BINDIR)/ldoc" - chmod +x "$(DESTDIR)$(LUA_BINDIR)/ldoc" + @echo "luajit $(LUA_SHAREDIR)/ldoc.lua \$$*" > "$(DESTDIR)$(LUA_BINDIR)/ldoc" + @chmod -v +x "$(DESTDIR)$(LUA_BINDIR)/ldoc" install_parts: - mkdir -p "$(DESTDIR)$(LUA_SHAREDIR)" - cp ldoc.lua "$(DESTDIR)$(LUA_SHAREDIR)" - cp -r ldoc "$(DESTDIR)$(LUA_SHAREDIR)" + @mkdir -vp "$(DESTDIR)$(LUA_SHAREDIR)" + @cp -v ldoc.lua "$(DESTDIR)$(LUA_SHAREDIR)" + @cp -vr ldoc "$(DESTDIR)$(LUA_SHAREDIR)" uninstall: - -rm "$(DESTDIR)$(LUA_SHAREDIR)/ldoc.lua" - -rm -r "$(DESTDIR)$(LUA_SHAREDIR)/ldoc" - -rm "$(DESTDIR)$(LUA_BINDIR)/ldoc" + @-rm -v "$(DESTDIR)$(LUA_SHAREDIR)/ldoc.lua" + @-rm -vr "$(DESTDIR)$(LUA_SHAREDIR)/ldoc" + @-rm -v "$(DESTDIR)$(LUA_BINDIR)/ldoc" test: test-basic test-example test-md test-tables From 0019beaa41c93531c8d72703769084140d0a71ba Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Thu, 10 Aug 2017 12:36:41 -0700 Subject: [PATCH 3/3] makefile: Ensure that 'LUA_BINDIR' exists before installation --- makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makefile b/makefile index 8bc1793..4fe351e 100644 --- a/makefile +++ b/makefile @@ -14,6 +14,9 @@ install_luajit: install_parts @chmod -v +x "$(DESTDIR)$(LUA_BINDIR)/ldoc" install_parts: + @if [ ! -d "$(DESTDIR)$(LUA_BINDIR)" ]; then \ + mkdir -vp "$(DESTDIR)$(LUA_BINDIR)"; \ + fi @mkdir -vp "$(DESTDIR)$(LUA_SHAREDIR)" @cp -v ldoc.lua "$(DESTDIR)$(LUA_SHAREDIR)" @cp -vr ldoc "$(DESTDIR)$(LUA_SHAREDIR)"