2009-05-27 11:31:38 +02:00
|
|
|
PLAT = none
|
|
|
|
INSTALL_DATA=cp
|
|
|
|
INSTALL_EXEC=cp
|
|
|
|
INSTALL_TOP= /opt/local
|
|
|
|
LUAINC= $(LUAINC_$(PLAT))
|
|
|
|
|
2005-08-12 07:56:32 +02:00
|
|
|
#------
|
2009-05-27 11:31:38 +02:00
|
|
|
# Install directories
|
2005-08-12 07:56:32 +02:00
|
|
|
#
|
2009-05-27 11:31:38 +02:00
|
|
|
INSTALL_TOP_SHARE=$(INSTALL_TOP)/share/lua/5.1
|
|
|
|
INSTALL_TOP_LIB=$(INSTALL_TOP)/lib/lua/5.1
|
|
|
|
INSTALL_SOCKET_SHARE=$(INSTALL_TOP_SHARE)/socket
|
|
|
|
INSTALL_SOCKET_LIB=$(INSTALL_TOP_LIB)/socket
|
|
|
|
INSTALL_MIME_SHARE=$(INSTALL_TOP_SHARE)/mime
|
|
|
|
INSTALL_MIME_LIB=$(INSTALL_TOP_LIB)/mime
|
2005-08-12 07:56:32 +02:00
|
|
|
|
|
|
|
#------
|
2009-05-27 11:31:38 +02:00
|
|
|
# Output file names
|
2005-08-12 07:56:32 +02:00
|
|
|
#
|
2009-05-27 11:31:38 +02:00
|
|
|
EXT=so
|
|
|
|
SOCKET_V=2.0.3
|
|
|
|
MIME_V=1.0.3
|
|
|
|
SOCKET_SO=socket.$(EXT).$(SOCKET_V)
|
|
|
|
MIME_SO=mime.$(EXT).$(MIME_V)
|
|
|
|
UNIX_SO=unix.$(EXT)
|
2005-08-12 07:56:32 +02:00
|
|
|
|
|
|
|
#------
|
2009-05-27 11:31:38 +02:00
|
|
|
# Compiler and linker settings
|
|
|
|
# for Mac OS X
|
|
|
|
LUAINC_macosx= -I/opt/local/include
|
|
|
|
CC_macosx=gcc
|
|
|
|
DEF_macosx= -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN \
|
|
|
|
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
|
|
|
-DMIME_API='__attribute__((visibility("default")))'
|
|
|
|
CFLAGS_macosx= $(LUAINC) $(COMPAT) $(DEF) -pedantic -Wall -O2 -fno-common \
|
|
|
|
-fvisibility=hidden
|
|
|
|
LDFLAGS_macosx= -bundle -undefined dynamic_lookup
|
|
|
|
LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc
|
2006-04-20 06:16:23 +02:00
|
|
|
|
2009-05-27 11:31:38 +02:00
|
|
|
#------
|
|
|
|
# Compiler and linker settings
|
|
|
|
# for Linux
|
|
|
|
LUAINC_linux= -I/usr/local/include/lua5.1
|
|
|
|
CC_linux=gcc
|
|
|
|
DEF_linux=-DLUASOCKET_DEBUG \
|
|
|
|
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
|
|
|
-DMIME_API='__attribute__((visibility("default")))'
|
|
|
|
CFLAGS_linux= $(LUAINC) $(DEF) -pedantic -Wall -O2 -fpic \
|
|
|
|
-fvisibility=hidden
|
|
|
|
LDFLAGS_linux=-O -shared -fpic
|
|
|
|
LD_linux= gcc
|
2007-03-12 05:08:40 +01:00
|
|
|
|
2009-05-27 11:31:38 +02:00
|
|
|
#------
|
|
|
|
# Settings selected for platform
|
|
|
|
#
|
|
|
|
CC=$(CC_$(PLAT))
|
|
|
|
DEF=$(DEF_$(PLAT))
|
|
|
|
CFLAGS=$(CFLAGS_$(PLAT))
|
|
|
|
LDFLAGS=$(LDFLAGS_$(PLAT))
|
|
|
|
LD=$(LD_$(PLAT))
|
|
|
|
|
|
|
|
#------
|
|
|
|
# Modules belonging to socket-core
|
|
|
|
#
|
|
|
|
SOCKET_OBJS= \
|
2005-08-12 07:56:32 +02:00
|
|
|
luasocket.o \
|
|
|
|
timeout.o \
|
|
|
|
buffer.o \
|
|
|
|
io.o \
|
2009-05-27 11:31:38 +02:00
|
|
|
auxiliar.o \
|
2005-08-12 07:56:32 +02:00
|
|
|
options.o \
|
|
|
|
inet.o \
|
2009-05-27 11:31:38 +02:00
|
|
|
usocket.o \
|
2005-08-12 07:56:32 +02:00
|
|
|
except.o \
|
|
|
|
select.o \
|
2009-05-27 11:31:38 +02:00
|
|
|
tcp.o \
|
|
|
|
udp.o
|
2005-08-12 07:56:32 +02:00
|
|
|
|
|
|
|
#------
|
|
|
|
# Modules belonging mime-core
|
|
|
|
#
|
2009-05-27 11:31:38 +02:00
|
|
|
MIME_OBJS= \
|
|
|
|
mime.o
|
2005-09-29 08:11:42 +02:00
|
|
|
|
2005-08-12 07:56:32 +02:00
|
|
|
#------
|
|
|
|
# Modules belonging unix (local domain sockets)
|
|
|
|
#
|
|
|
|
UNIX_OBJS:=\
|
|
|
|
buffer.o \
|
|
|
|
auxiliar.o \
|
|
|
|
options.o \
|
|
|
|
timeout.o \
|
|
|
|
io.o \
|
|
|
|
usocket.o \
|
|
|
|
unix.o
|
|
|
|
|
2009-05-27 11:31:38 +02:00
|
|
|
#------
|
|
|
|
# Files to install
|
|
|
|
#
|
|
|
|
TO_SOCKET_SHARE:= \
|
|
|
|
http.lua \
|
|
|
|
url.lua \
|
|
|
|
tp.lua \
|
|
|
|
ftp.lua \
|
|
|
|
headers.lua \
|
|
|
|
smtp.lua
|
|
|
|
|
|
|
|
TO_TOP_SHARE:= \
|
|
|
|
ltn12.lua \
|
|
|
|
socket.lua \
|
|
|
|
mime.lua
|
|
|
|
|
|
|
|
default: $(PLAT)
|
|
|
|
|
|
|
|
macosx:
|
|
|
|
$(MAKE) all PLAT=macosx
|
|
|
|
|
|
|
|
linux:
|
|
|
|
$(MAKE) all PLAT=linux
|
|
|
|
|
|
|
|
none:
|
|
|
|
@echo "Please choose a platform:"
|
|
|
|
@echo " $(PLATS)"
|
|
|
|
|
|
|
|
all: $(SOCKET_SO) $(MIME_SO)
|
2005-08-12 07:56:32 +02:00
|
|
|
|
|
|
|
$(SOCKET_SO): $(SOCKET_OBJS)
|
2006-04-20 06:16:23 +02:00
|
|
|
$(LD) $(LDFLAGS) -o $@ $(SOCKET_OBJS)
|
2005-08-12 07:56:32 +02:00
|
|
|
|
|
|
|
$(MIME_SO): $(MIME_OBJS)
|
2006-04-20 06:16:23 +02:00
|
|
|
$(LD) $(LDFLAGS) -o $@ $(MIME_OBJS)
|
2005-08-12 07:56:32 +02:00
|
|
|
|
|
|
|
$(UNIX_SO): $(UNIX_OBJS)
|
2006-04-20 06:16:23 +02:00
|
|
|
$(LD) $(LDFLAGS) -o $@ $(UNIX_OBJS)
|
2005-08-12 07:56:32 +02:00
|
|
|
|
2009-05-27 11:31:38 +02:00
|
|
|
install:
|
|
|
|
mkdir -p $(INSTALL_TOP_SHARE)
|
|
|
|
$(INSTALL_DATA) $(TO_TOP_SHARE) $(INSTALL_TOP_SHARE)
|
|
|
|
mkdir -p $(INSTALL_SOCKET_SHARE)
|
|
|
|
$(INSTALL_DATA) $(TO_SOCKET_SHARE) $(INSTALL_SOCKET_SHARE)
|
|
|
|
mkdir -p $(INSTALL_SOCKET_LIB)
|
|
|
|
$(INSTALL_EXEC) $(SOCKET_SO) $(INSTALL_SOCKET_LIB)/core.$(EXT)
|
|
|
|
mkdir -p $(INSTALL_MIME_LIB)
|
|
|
|
$(INSTALL_EXEC) $(MIME_SO) $(INSTALL_MIME_LIB)/core.$(EXT)
|
|
|
|
|
|
|
|
local:
|
|
|
|
$(MAKE) install INSTALL_TOP_LIB=.. INSTALL_TOP_SHARE=..
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(SOCKET_SO) $(SOCKET_OBJS)
|
|
|
|
rm -f $(MIME_SO) $(UNIX_SO) $(MIME_OBJS) $(UNIX_OBJS)
|
|
|
|
|
|
|
|
.PHONY: all $(PLATS) default clean echo none
|
|
|
|
|
2005-08-12 07:56:32 +02:00
|
|
|
#------
|
|
|
|
# List of dependencies
|
|
|
|
#
|
|
|
|
auxiliar.o: auxiliar.c auxiliar.h
|
|
|
|
buffer.o: buffer.c buffer.h io.h timeout.h
|
|
|
|
except.o: except.c except.h
|
|
|
|
inet.o: inet.c inet.h socket.h io.h timeout.h usocket.h
|
|
|
|
io.o: io.c io.h timeout.h
|
2009-05-27 11:31:38 +02:00
|
|
|
luasocket.o: luasocket.c luasocket.h auxiliar.h except.h \
|
|
|
|
timeout.h buffer.h io.h inet.h socket.h usocket.h tcp.h \
|
|
|
|
udp.h select.h
|
2005-08-12 07:56:32 +02:00
|
|
|
mime.o: mime.c mime.h
|
2009-05-27 11:31:38 +02:00
|
|
|
options.o: options.c auxiliar.h options.h socket.h io.h \
|
|
|
|
timeout.h usocket.h inet.h
|
2005-08-12 07:56:32 +02:00
|
|
|
select.o: select.c socket.h io.h timeout.h usocket.h select.h
|
2009-05-27 11:31:38 +02:00
|
|
|
tcp.o: tcp.c auxiliar.h socket.h io.h timeout.h usocket.h \
|
|
|
|
inet.h options.h tcp.h buffer.h
|
2005-08-12 07:56:32 +02:00
|
|
|
timeout.o: timeout.c auxiliar.h timeout.h
|
2009-05-27 11:31:38 +02:00
|
|
|
udp.o: udp.c auxiliar.h socket.h io.h timeout.h usocket.h \
|
|
|
|
inet.h options.h udp.h
|
|
|
|
unix.o: unix.c auxiliar.h socket.h io.h timeout.h usocket.h \
|
|
|
|
options.h unix.h buffer.h
|
2005-08-12 07:56:32 +02:00
|
|
|
usocket.o: usocket.c socket.h io.h timeout.h usocket.h
|
2009-05-27 11:31:38 +02:00
|
|
|
wsocket.o: wsocket.c socket.h io.h timeout.h usocket.h
|