From e7a912420c7648ea9bd693c380c24c991ec30ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20Duch=C3=AAne?= Date: Thu, 7 May 2020 15:16:30 +0200 Subject: [PATCH] Update makefile Removed `DESTDIR` which did not appear to be defined, moved` ldoc.lua` to the `ldoc` directory to avoid encumbering the share directory, added proper retrieval of Lua version to get proper `LUA_SHAREDIR` directory. Additionally, the file should be renamed as `Makefile`. My apologies if I just missed something and this change proposal is irrelevant. --- makefile | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/makefile b/makefile index 7e797cb..8d46c40 100644 --- a/makefile +++ b/makefile @@ -1,27 +1,26 @@ -LUA= $(shell echo `which lua`) -LUA_BINDIR= $(shell echo `dirname $(LUA)`) -LUA_PREFIX= $(shell echo `dirname $(LUA_BINDIR)`) -LUA_SHAREDIR=$(LUA_PREFIX)/share/lua/5.1 +LUA := $(shell echo `which lua`) +LUA_BINDIR := $(shell echo `dirname $(LUA)`) +LUA_PREFIX := $(shell echo `dirname $(LUA_BINDIR)`) +LUA_VER := $(shell lua -v | sed 's/Lua \([0-9]\{1,\}\.[0-9]\{1,\}\)\..*/\1/') +LUA_SHAREDIR := $(LUA_PREFIX)/share/lua/$(LUA_VER) 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/ldoc.lua \$$*" > $(LUA_BINDIR)/ldoc + chmod +x $(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/ldoc.lua \$$*" > $(LUA_BINDIR)/ldoc + chmod +x $(LUA_BINDIR)/ldoc install_parts: - mkdir -p $(DESTDIR)$(LUA_SHAREDIR) - cp ldoc.lua $(DESTDIR)$(LUA_SHAREDIR) - cp -r ldoc $(DESTDIR)$(LUA_SHAREDIR) + cp -r ldoc $(LUA_SHAREDIR) + cp ldoc.lua $(LUA_SHAREDIR)/ldoc uninstall: - -rm $(DESTDIR)$(LUA_SHAREDIR)/ldoc.lua - -rm -r $(DESTDIR)$(LUA_SHAREDIR)/ldoc - -rm $(DESTDIR)$(LUA_BINDIR)/ldoc + -rm -r $(LUA_SHAREDIR)/ldoc + -rm $(LUA_BINDIR)/ldoc test: test-basic test-example test-md test-tables