~technomancy/shevek

ref: 06b9a6b499b3b876937ead8e58028ed925a60611 shevek/makefile -rw-r--r-- 1.2 KiB
06b9a6b4Phil Hagelberg Add makefile which supports compiling to binary. 1 year, 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
LUA ?= 5.3

STATIC_LUA_LIB ?= /usr/lib/x86_64-linux-gnu/liblua$(LUA).a
LUA_INCLUDE_DIR ?= /usr/include/lua$(LUA)

LUA_PATH="?.lua;usr/local/share/lua/$(LUA)/?.lua"
LUA_CPATH="usr/local/lib/lua/$(LUA)/?.so"

shevek: shevek.fnl socket.a mime.a
	LUA_PATH=$(LUA_PATH) ./fennel --correlate --compile-binary $< $@ \
		$(STATIC_LUA_LIB) $(LUA_INCLUDE_DIR) \
		--native-module socket.a --native-module mime.a
	chmod 755 $@

luasocket: ; git clone https://github.com/diegonehab/luasocket

luasocket/src/luasocket.o: luasocket
	make -C luasocket/src linux install MYCFLAGS=-static \
		LUAV=$(LUA) DESTDIR=$(PWD) LUAINC_linux=$(LUA_INCLUDE_DIR)

SOCKET_OBJS= \
	luasocket/src/luasocket.o \
	luasocket/src/timeout.o \
	luasocket/src/buffer.o \
	luasocket/src/io.o \
	luasocket/src/auxiliar.o \
	luasocket/src/compat.o \
	luasocket/src/options.o \
	luasocket/src/inet.o \
	luasocket/src/except.o \
	luasocket/src/select.o \
	luasocket/src/tcp.o \
	luasocket/src/udp.o \
	luasocket/src/usocket.o # <- this one should be wsocket.o for Windows

socket.a: $(SOCKET_OBJS)
	ar rcs $@ $^

mime.a: luasocket/src/mime.o luasocket/src/compat.o
	ar rcs $@ $^

clean: ; rm -rf usr socket.a mime.a shevek

.PHONY: clean