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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
all: bin2c dynamic static
LUAC=luac
BIN2C=./bin2c
OBJS= \
luasocket.o \
timeout.o \
buffer.o \
io.o \
auxiliar.o \
select.o \
inet.o \
tcp.o \
udp.o \
usocket.o
LUAS= \
select.lua \
auxiliar.lua \
concat.lua \
code.lua \
url.lua \
http.lua \
smtp.lua \
ftp.lua
LCHS= $(addsuffix .lch, $(basename $(LUAS)))
LCS= $(addsuffix .lc, $(basename $(LUAS)))
.PRECIOUS: $(LCHS) $(LCS)
CFLAGS=-O2 -Wall -DLUASOCKET_COMPILED -DLUASOCKET_DEBUG -I/usr/include/lua50
SOBJS=$(patsubst %.o,%.os,$(OBJS))
dynamic: $(SOBJS)
gcc -o luasocket.so -shared -Wl,-soname,libluasocket.so.2.0 \
$(SOBJS) -llua50
static: $(OBJS)
rm -f luasocket.a
ar cr luasocket.a $(OBJS)
ranlib luasocket.a
%.os: %.c
gcc $(CPPFLAGS) $(CFLAGS) -fPIC -DPIC -o $@ -c $<
# dependencies
auxiliar.o auxiliar.os: auxiliar.c auxiliar.h
buffer.o buffer.os: buffer.c auxiliar.h buffer.h io.h timeout.h
inet.o inet.os: inet.c luasocket.h inet.h socket.h usocket.h
io.o io.os: io.c io.h
luasocket.o luasocket.os: luasocket.c luasocket.h timeout.h buffer.h \
io.h socket.h \
usocket.h inet.h tcp.h udp.h
usocket.o usocket.os: usocket.c socket.h usocket.h
tcp.o tcp.os: tcp.c luasocket.h auxiliar.h inet.h socket.h usocket.h \
tcp.h buffer.h io.h timeout.h
timeout.o timeout.os: timeout.c luasocket.h auxiliar.h timeout.h
udp.o udp.os: udp.c luasocket.h auxiliar.h inet.h socket.h usocket.h \
udp.h timeout.h
luasocket.o luasocket.os: $(LCHS)
select.o select.os: $(LCHS)
%.lc: %.lua
$(LUAC) -o $@ $<
%.lch: %.lc
$(BIN2C) $< > $@
clean:
rm -f $(OBJS) $(SOBJS) $(LCHS) $(LCS) luasocket.a luasocket.so bin2c
|