aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-08-05 13:22:18 +1000
committerHisham Muhammad <hisham@gobolinux.org>2018-08-10 16:52:18 -0300
commitcc0e4e457675d355c86dae06778e1fdc8edaf8f1 (patch)
tree975f81b37a0233750571e0d5845bd5cdb9ad6edf
parent449297aa6502e7e8f1f871cc95704dc417a6ed79 (diff)
downloadluarocks-cc0e4e457675d355c86dae06778e1fdc8edaf8f1.tar.gz
luarocks-cc0e4e457675d355c86dae06778e1fdc8edaf8f1.tar.bz2
luarocks-cc0e4e457675d355c86dae06778e1fdc8edaf8f1.zip
Makefile: Use some makefile conventions for directory variables
-rw-r--r--Makefile35
1 files changed, 21 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 5b8f6377..47a3281d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,13 @@
1 1
2-include config.unix 2-include config.unix
3 3
4# See https://www.gnu.org/software/make/manual/html_node/Makefile-Conventions.html
5datarootdir ?= $(prefix)/share
6bindir ?= $(prefix)/bin
7
8luadir ?= $(datarootdir)/lua/$(LUA_VERSION)
9
10
4INSTALL ?= install 11INSTALL ?= install
5INSTALL_DATA ?= $(INSTALL) -m 644 12INSTALL_DATA ?= $(INSTALL) -m 644
6 13
@@ -41,7 +48,7 @@ luarocks-admin: config.unix
41 mkdir -p "$(@D)" 48 mkdir -p "$(@D)"
42 (printf '#!$(LUA_BINDIR)/$(LUA_INTERPRETER)\n'\ 49 (printf '#!$(LUA_BINDIR)/$(LUA_INTERPRETER)\n'\
43 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ 50 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\
44 'package.path=[[$(prefix)/share/lua/$(LUA_VERSION)/?.lua;]] .. package.path\n'; \ 51 'package.path=[[$(luadir)/?.lua;]] .. package.path\n'; \
45 tail -n +2 src/bin/luarocks \ 52 tail -n +2 src/bin/luarocks \
46 )> "$@" 53 )> "$@"
47 54
@@ -49,7 +56,7 @@ luarocks-admin: config.unix
49 mkdir -p "$(@D)" 56 mkdir -p "$(@D)"
50 (printf '#!$(LUA_BINDIR)/$(LUA_INTERPRETER)\n'\ 57 (printf '#!$(LUA_BINDIR)/$(LUA_INTERPRETER)\n'\
51 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ 58 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\
52 'package.path=[[$(prefix)/share/lua/$(LUA_VERSION)/?.lua;]] .. package.path\n'; \ 59 'package.path=[[$(luadir)/?.lua;]] .. package.path\n'; \
53 tail -n +2 src/bin/luarocks-admin \ 60 tail -n +2 src/bin/luarocks-admin \
54 )> "$@" 61 )> "$@"
55 62
@@ -57,15 +64,15 @@ luarocks-admin: config.unix
57# Regular install 64# Regular install
58# ---------------------------------------- 65# ----------------------------------------
59 66
60install: $(DESTDIR)$(prefix)/bin/luarocks $(DESTDIR)$(prefix)/bin/luarocks-admin $(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua $(patsubst src/%, $(DESTDIR)$(prefix)/share/lua/$(LUA_VERSION)/%, $(LUAROCKS_FILES)) 67install: $(DESTDIR)$(bindir)/luarocks $(DESTDIR)$(bindir)/luarocks-admin $(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua $(patsubst src/%, $(DESTDIR)$(luadir)/%, $(LUAROCKS_FILES))
61 68
62$(DESTDIR)$(prefix)/bin/luarocks: ./build/luarocks 69$(DESTDIR)$(bindir)/luarocks: ./build/luarocks
63 $(INSTALL) -D "$<" "$@" 70 $(INSTALL) -D "$<" "$@"
64 71
65$(DESTDIR)$(prefix)/bin/luarocks-admin: ./build/luarocks-admin 72$(DESTDIR)$(bindir)/luarocks-admin: ./build/luarocks-admin
66 $(INSTALL) -D "$<" "$@" 73 $(INSTALL) -D "$<" "$@"
67 74
68$(DESTDIR)$(prefix)/share/lua/$(LUA_VERSION)/luarocks/%.lua: src/luarocks/%.lua 75$(DESTDIR)$(luadir)/luarocks/%.lua: src/luarocks/%.lua
69 $(INSTALL_DATA) -D "$<" "$@" 76 $(INSTALL_DATA) -D "$<" "$@"
70 77
71$(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua: config-$(LUA_VERSION).lua.in 78$(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua: config-$(LUA_VERSION).lua.in
@@ -90,14 +97,14 @@ $(BINARY_TARGET)/luarocks-admin.exe: luarocks
90# ---------------------------------------- 97# ----------------------------------------
91 98
92install-binary: build-binary/luarocks.exe build-binary/luarocks-admin.exe 99install-binary: build-binary/luarocks.exe build-binary/luarocks-admin.exe
93 mkdir -p "$(DESTDIR)$(prefix)/bin" 100 mkdir -p "$(DESTDIR)$(bindir)"
94 cp build-binary/luarocks.exe "$(DESTDIR)$(prefix)/bin/luarocks" 101 cp build-binary/luarocks.exe "$(DESTDIR)$(bindir)/luarocks"
95 chmod +rx "$(DESTDIR)$(prefix)/bin/luarocks" 102 chmod +rx "$(DESTDIR)$(bindir)/luarocks"
96 cp build-binary/luarocks-admin.exe "$(DESTDIR)$(prefix)/bin/luarocks-admin" 103 cp build-binary/luarocks-admin.exe "$(DESTDIR)$(bindir)/luarocks-admin"
97 chmod +rx "$(DESTDIR)$(prefix)/bin/luarocks-admin" 104 chmod +rx "$(DESTDIR)$(bindir)/luarocks-admin"
98 mkdir -p "$(DESTDIR)$(prefix)/share/lua/$(LUA_VERSION)/luarocks/core" 105 mkdir -p "$(DESTDIR)$(luadir)/luarocks/core"
99 cp -a src/luarocks/core/* "$(DESTDIR)$(prefix)/share/lua/$(LUA_VERSION)/luarocks/core" 106 cp -a src/luarocks/core/* "$(DESTDIR)$(luadir)/luarocks/core"
100 cp -a src/luarocks/loader.lua "$(DESTDIR)$(prefix)/share/lua/$(LUA_VERSION)/luarocks/" 107 cp -a src/luarocks/loader.lua "$(DESTDIR)$(luadir)/luarocks/"
101 108
102# ---------------------------------------- 109# ----------------------------------------
103# Bootstrap install 110# Bootstrap install