#--------------------------------------------------------------------------
# Distribution makefile
#--------------------------------------------------------------------------

DIST = luasocket-2.0-beta3

LUA = \
	ftp.lua \
	http.lua \
	ltn12.lua \
	mime.lua \
	smtp.lua \
	socket.lua \
	tp.lua \
	url.lua

TESTS = \
	testclnt.lua \
	testsrvr.lua \
	testsupport.lua

EXAMPLES = \
	check-memory.lua \
	b64.lua \
	cddb.lua \
	daytimeclnt.lua \
	echoclnt.lua \
	echosrvr.lua \
	eol.lua \
	listener.lua \
	qp.lua \
	lpr.lua \
	talker.lua \
	tinyirc.lua

ETC = \
	check-links.lua \
	dict.lua \
	get.lua \
	lua.lua \
	unix.c \
	unix.h \
	lp.lua \
	tftp.lua

CORE = \
	auxiliar.c \
	auxiliar.h \
	buffer.c \
	buffer.h \
	except.c \
	except.h \
	inet.c \
	inet.h \
	io.c \
	io.h \
	luasocket.c \
	luasocket.h \
	mime.c \
	mime.h \
	options.c \
	options.h \
	select.c \
	select.h \
	socket.h \
	tcp.c \
	tcp.h \
	timeout.c \
	timeout.h \
	udp.c \
	udp.h \
	usocket.c \
	usocket.h \
	wsocket.c \
	wsocket.h

MAKE = \
	makefile.Darwin \
	makefile.Linux \
	luasocket.sln \
	luasocket.vcproj \
	mime.vcproj

MANUAL = \
	manual/dns.html \
	manual/ftp.html \
	manual/home.html \
	manual/http.html \
	manual/introduction.html \
	manual/ltn12.html \
	manual/luasocket.png \
	manual/mime.html \
	manual/reference.css \
	manual/reference.html \
	manual/smtp.html \
	manual/socket.html \
	manual/tcp.html \
	manual/udp.html \
	manual/url.html

dist:
	mkdir -p $(DIST)/examples
	mkdir -p $(DIST)/tests
	mkdir -p $(DIST)/etc
	mkdir -p $(DIST)/lua
	mkdir -p $(DIST)/manual
	cp -vf TODO $(DIST)
	cp -vf $(CORE) $(DIST)
	cp -vf README $(DIST)
	cp -vf NEW $(DIST)
	cp -vf LICENSE $(DIST)
	cp -vf $(MAKE) $(DIST)
	cp -vf make.README $(DIST)/INSTALL
	cp -vf $(LUA) $(DIST)/lua
	cp -vf lua.README $(DIST)/lua/README
	cp -vf $(EXAMPLES) $(DIST)/examples
	cp -vf examples.README $(DIST)/examples/README
	cp -vf $(TESTS) $(DIST)/tests
	cp -vf tests.README $(DIST)/tests/README
	cp -vf $(ETC) $(DIST)/etc
	cp -vf etc.README $(DIST)/etc/README
	cp -vf $(MANUAL) $(DIST)/manual
	tar -zcvf $(DIST).tar.gz $(DIST)
	zip -r $(DIST).zip $(DIST)

clean:
	\rm -rf $(DIST) $(DIST).tar.gz $(DIST).zip