diff options
| author | daurnimator <quae@daurnimator.com> | 2018-08-05 13:22:18 +1000 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-08-10 16:52:18 -0300 |
| commit | cc0e4e457675d355c86dae06778e1fdc8edaf8f1 (patch) | |
| tree | 975f81b37a0233750571e0d5845bd5cdb9ad6edf | |
| parent | 449297aa6502e7e8f1f871cc95704dc417a6ed79 (diff) | |
| download | luarocks-cc0e4e457675d355c86dae06778e1fdc8edaf8f1.tar.gz luarocks-cc0e4e457675d355c86dae06778e1fdc8edaf8f1.tar.bz2 luarocks-cc0e4e457675d355c86dae06778e1fdc8edaf8f1.zip | |
Makefile: Use some makefile conventions for directory variables
| -rw-r--r-- | Makefile | 35 |
1 files changed, 21 insertions, 14 deletions
| @@ -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 | ||
| 5 | datarootdir ?= $(prefix)/share | ||
| 6 | bindir ?= $(prefix)/bin | ||
| 7 | |||
| 8 | luadir ?= $(datarootdir)/lua/$(LUA_VERSION) | ||
| 9 | |||
| 10 | |||
| 4 | INSTALL ?= install | 11 | INSTALL ?= install |
| 5 | INSTALL_DATA ?= $(INSTALL) -m 644 | 12 | INSTALL_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 | ||
| 60 | install: $(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)) | 67 | install: $(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 | ||
| 92 | install-binary: build-binary/luarocks.exe build-binary/luarocks-admin.exe | 99 | install-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 |
