aboutsummaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-08-10 17:34:31 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-08-10 22:49:47 -0300
commitb5926be6dd3438c7f98afe7c9ffb28f52fb6a573 (patch)
tree5bdd3f1ab0832f01eb303f52d73fea5eb2053a52 /GNUmakefile
parentc49e581f8df1d40acb759e54fd8fcfb52570be95 (diff)
downloadluarocks-b5926be6dd3438c7f98afe7c9ffb28f52fb6a573.tar.gz
luarocks-b5926be6dd3438c7f98afe7c9ffb28f52fb6a573.tar.bz2
luarocks-b5926be6dd3438c7f98afe7c9ffb28f52fb6a573.zip
Build Windows binaries as .exe in a separate directory
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile56
1 files changed, 30 insertions, 26 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 45eb38b1..a8e2a01e 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -8,6 +8,7 @@ bindir ?= $(prefix)/bin
8sysconfdir ?= $(prefix)/etc 8sysconfdir ?= $(prefix)/etc
9INSTALL ?= install 9INSTALL ?= install
10INSTALL_DATA ?= $(INSTALL) -m 644 10INSTALL_DATA ?= $(INSTALL) -m 644
11BINARY_PLATFORM ?= unix
11 12
12LUA_INTERPRETER ?= lua 13LUA_INTERPRETER ?= lua
13ifdef LUA_BINDIR 14ifdef LUA_BINDIR
@@ -21,6 +22,8 @@ LUA_VERSION ?= $(shell $(LUA) -e 'print(_VERSION:match(" (5%.[1234])$$"))')
21rocks_tree ?= $(prefix) 22rocks_tree ?= $(prefix)
22luarocksconfdir ?= $(sysconfdir)/luarocks 23luarocksconfdir ?= $(sysconfdir)/luarocks
23luadir ?= $(datarootdir)/lua/$(LUA_VERSION) 24luadir ?= $(datarootdir)/lua/$(LUA_VERSION)
25builddir ?= ./build
26buildbinarydir ?= ./build-binary
24 27
25 28
26LUAROCKS_FILES = $(shell find src/luarocks/ -type f -name '*.lua') 29LUAROCKS_FILES = $(shell find src/luarocks/ -type f -name '*.lua')
@@ -31,7 +34,7 @@ all: build
31# Base build 34# Base build
32# ---------------------------------------- 35# ----------------------------------------
33 36
34build: luarocks luarocks-admin ./build/luarocks ./build/luarocks-admin 37build: luarocks luarocks-admin $(builddir)/luarocks $(builddir)/luarocks-admin
35 38
36config.unix: 39config.unix:
37 @echo Please run the "./configure" script before building. 40 @echo Please run the "./configure" script before building.
@@ -70,7 +73,7 @@ luarocks-admin: config.unix
70 echo 'LUAROCKS_SYSCONFDIR="$(luarocksconfdir)" LUA_PATH="$(CURDIR)/src/?.lua;;" exec "$(LUA)" "$(CURDIR)/src/bin/luarocks-admin" --project-tree="$(CURDIR)/lua_modules" "$$@"' >> luarocks-admin 73 echo 'LUAROCKS_SYSCONFDIR="$(luarocksconfdir)" LUA_PATH="$(CURDIR)/src/?.lua;;" exec "$(LUA)" "$(CURDIR)/src/bin/luarocks-admin" --project-tree="$(CURDIR)/lua_modules" "$$@"' >> luarocks-admin
71 chmod +rx ./luarocks-admin 74 chmod +rx ./luarocks-admin
72 75
73./build/luarocks: src/bin/luarocks config.unix 76$(builddir)/luarocks: src/bin/luarocks config.unix
74 mkdir -p "$(@D)" 77 mkdir -p "$(@D)"
75 (printf '$(SHEBANG)\n'\ 78 (printf '$(SHEBANG)\n'\
76 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ 79 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\
@@ -78,7 +81,7 @@ luarocks-admin: config.unix
78 tail -n +2 src/bin/luarocks \ 81 tail -n +2 src/bin/luarocks \
79 )> "$@" 82 )> "$@"
80 83
81./build/luarocks-admin: src/bin/luarocks-admin config.unix 84$(builddir)/luarocks-admin: src/bin/luarocks-admin config.unix
82 mkdir -p "$(@D)" 85 mkdir -p "$(@D)"
83 (printf '$(SHEBANG)\n'\ 86 (printf '$(SHEBANG)\n'\
84 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ 87 'package.loaded["luarocks.core.hardcoded"] = { SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\
@@ -87,6 +90,20 @@ luarocks-admin: config.unix
87 )> "$@" 90 )> "$@"
88 91
89# ---------------------------------------- 92# ----------------------------------------
93# Base build
94# ----------------------------------------
95
96binary: luarocks $(buildbinarydir)/luarocks.exe $(buildbinarydir)/luarocks-admin.exe
97
98$(buildbinarydir)/luarocks.exe: src/bin/luarocks $(LUAROCKS_FILES)
99 (unset $(LUA_ENV_VARS); \
100 "$(LUA)" binary/all_in_one "$<" "$(LUA_DIR)" "^src/luarocks/admin/" "$(luarocksconfdir)" "$(@D)" $(BINARY_PLATFORM) $(CC) $(NM) $(SYSROOT))
101
102$(buildbinarydir)/luarocks-admin.exe: src/bin/luarocks-admin $(LUAROCKS_FILES)
103 (unset $(LUA_ENV_VARS); \
104 "$(LUA)" binary/all_in_one "$<" "$(LUA_DIR)" "^src/luarocks/cmd/" "$(luarocksconfdir)" "$(@D)" $(BINARY_PLATFORM) $(CC) $(NM) $(SYSROOT))
105
106# ----------------------------------------
90# Regular install 107# Regular install
91# ---------------------------------------- 108# ----------------------------------------
92 109
@@ -97,45 +114,32 @@ INSTALL_FILES = $(DESTDIR)$(bindir)/luarocks \
97 114
98install: $(INSTALL_FILES) 115install: $(INSTALL_FILES)
99 116
100$(DESTDIR)$(bindir)/luarocks: ./build/luarocks 117$(DESTDIR)$(bindir)/luarocks: $(builddir)/luarocks
101 $(INSTALL) -D "$<" "$@" 118 $(INSTALL) -D "$<" "$@"
102 119
103$(DESTDIR)$(bindir)/luarocks-admin: ./build/luarocks-admin 120$(DESTDIR)$(bindir)/luarocks-admin: $(builddir)/luarocks-admin
104 $(INSTALL) -D "$<" "$@" 121 $(INSTALL) -D "$<" "$@"
105 122
106$(DESTDIR)$(luadir)/luarocks/%.lua: src/luarocks/%.lua 123$(DESTDIR)$(luadir)/luarocks/%.lua: src/luarocks/%.lua
107 $(INSTALL_DATA) -D "$<" "$@" 124 $(INSTALL_DATA) -D "$<" "$@"
108 125
109$(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua: ./build/config-$(LUA_VERSION).lua 126$(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua: $(builddir)/config-$(LUA_VERSION).lua
110 $(INSTALL_DATA) -D "$<" "$@" 127 $(INSTALL_DATA) -D "$<" "$@"
111 128
112uninstall: 129uninstall:
113 rm -rf $(INSTALL_FILES) 130 rm -rf $(INSTALL_FILES)
114 131
115# ---------------------------------------- 132# ----------------------------------------
116# Binary build
117# ----------------------------------------
118
119binary: build-binary/luarocks.exe build-binary/luarocks-admin.exe
120
121build-binary/luarocks.exe: src/bin/luarocks $(LUAROCKS_FILES)
122 (unset $(LUA_ENV_VARS); \
123 "$(LUA)" binary/all_in_one "$<" "$(LUA_DIR)" "^src/luarocks/admin/" "$(luarocksconfdir)" "$(@D)" $(BINARY_PLATFORM) $(CC) $(NM) $(SYSROOT))
124
125build-binary/luarocks-admin.exe: src/bin/luarocks-admin $(LUAROCKS_FILES)
126 (unset $(LUA_ENV_VARS); \
127 "$(LUA)" binary/all_in_one "$<" "$(LUA_DIR)" "^src/luarocks/cmd/" "$(luarocksconfdir)" "$(@D)" $(BINARY_PLATFORM) $(CC) $(NM) $(SYSROOT))
128
129# ----------------------------------------
130# Binary install 133# Binary install
131# ---------------------------------------- 134# ----------------------------------------
132 135
133LUAROCKS_CORE_FILES = $(wildcard src/luarocks/core/* src/luarocks/loader.lua) 136LUAROCKS_CORE_FILES = $(wildcard src/luarocks/core/* src/luarocks/loader.lua)
134INSTALL_BINARY_FILES = $(patsubst src/%, $(DESTDIR)$(luadir)/%, $(LUAROCKS_CORE_FILES)) 137INSTALL_BINARY_FILES = $(patsubst src/%, $(DESTDIR)$(luadir)/%, $(LUAROCKS_CORE_FILES)) \
138 $(DESTDIR)$(luarocksconfdir)/config-$(LUA_VERSION).lua
135 139
136install-binary: $(INSTALL_BINARY_FILES) build-binary/luarocks.exe build-binary/luarocks-admin.exe 140install-binary: $(INSTALL_BINARY_FILES)
137 $(INSTALL) -D build-binary/luarocks.exe "$(DESTDIR)$(bindir)/luarocks" 141 $(INSTALL) -D "$(buildbinarydir)/luarocks.exe" "$(DESTDIR)$(bindir)/luarocks"
138 $(INSTALL) -D build-binary/luarocks-admin.exe "$(DESTDIR)$(bindir)/luarocks-admin" 142 $(INSTALL) -D "$(buildbinarydir)/luarocks-admin.exe" "$(DESTDIR)$(bindir)/luarocks-admin"
139 143
140# ---------------------------------------- 144# ----------------------------------------
141# Bootstrap install 145# Bootstrap install
@@ -162,8 +166,8 @@ clean: windows-clean
162 rm -rf ./config.unix \ 166 rm -rf ./config.unix \
163 ./luarocks \ 167 ./luarocks \
164 ./luarocks-admin \ 168 ./luarocks-admin \
165 ./build/ \ 169 $(builddir)/ \
166 build-binary \ 170 $(buildbinarydir)/ \
167 ./.luarocks \ 171 ./.luarocks \
168 ./lua_modules 172 ./lua_modules
169 173