summaryrefslogtreecommitdiffhomepage
path: root/libs/nixio/Makefile
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-04-21 16:26:45 +0000
committerSteven Barth <steven@midlink.org>2009-04-21 16:26:45 +0000
commita2b916ab736802050b19562b7c163e3f3bb1566f (patch)
treed35b68f7bcac43f66f4cdb915ef327b76856594b /libs/nixio/Makefile
parent085a0a9ec040fc3ea5ee537d2cee724aa775747b (diff)
Merge nixio 0.2
Diffstat (limited to 'libs/nixio/Makefile')
-rw-r--r--libs/nixio/Makefile49
1 files changed, 38 insertions, 11 deletions
diff --git a/libs/nixio/Makefile b/libs/nixio/Makefile
index ca22328ae..8e87eaa10 100644
--- a/libs/nixio/Makefile
+++ b/libs/nixio/Makefile
@@ -1,21 +1,27 @@
+ifneq (,$(wildcard ../../build/config.mk))
include ../../build/config.mk
include ../../build/module.mk
include ../../build/gccconfig.mk
+else
+include standalone.mk
+endif
AXTLS_VERSION = 1.2.1
AXTLS_DIR = axTLS
AXTLS_FILE = $(AXTLS_DIR)-$(AXTLS_VERSION).tar.gz
NIXIO_TLS ?= openssl
-NIXIO_LDFLAGS =
+NIXIO_LDFLAGS = -lcrypt
+NIXIO_SO = nixio.so
NIXIO_OBJ = src/nixio.o src/socket.o src/sockopt.o src/bind.o src/address.o \
src/poll.o src/io.o src/file.o src/splice.o src/process.o src/syslog.o \
- src/tls-context.o src/tls-socket.o
+ src/bit.o src/binary.o src/fs.o src/user.o \
+ src/tls-crypto.o src/tls-context.o src/tls-socket.o
ifeq ($(NIXIO_TLS),axtls)
- TLS_CFLAGS = -IaxTLS/ssl -IaxTLS/crypto -IaxTLS/config -include src/openssl-compat.h
- TLS_DEPENDS = src/openssl-compat.o
- NIXIO_OBJ += src/openssl-compat.o src/libaxtls.a
+ TLS_CFLAGS = -IaxTLS/ssl -IaxTLS/crypto -IaxTLS/config -include src/axtls-compat.h
+ TLS_DEPENDS = src/axtls-compat.o
+ NIXIO_OBJ += src/axtls-compat.o src/libaxtls.a
endif
ifeq ($(NIXIO_TLS),openssl)
@@ -27,26 +33,43 @@ ifeq ($(OS),SunOS)
NIXIO_LDFLAGS += -lsocket -lnsl -lsendfile
endif
+ifneq (,$(findstring MINGW,$(OS))$(findstring mingw,$(OS))$(findstring Windows,$(OS)))
+ NIXIO_CROSS_CC:=$(shell which i586-mingw32msvc-cc)
+ifneq (,$(NIXIO_CROSS_CC))
+ CC:=$(NIXIO_CROSS_CC)
+endif
+ NIXIO_OBJ += src/mingw-compat.o
+ NIXIO_LDFLAGS_POST:=-llua -lssl -lcrypto -lws2_32 -lgdi32
+ FPIC:=
+ EXTRA_CFLAGS += -D_WIN32_WINNT=0x0501
+ LUA_CFLAGS:=
+ NIXIO_SO:=nixio.dll
+ NIXIO_LDFLAGS:=
+endif
+
%.o: %.c
$(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) -c -o $@ $<
+src/tls-crypto.o: $(TLS_DEPENDS) src/tls-crypto.c
+ $(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) $(TLS_CFLAGS) -c -o $@ src/tls-crypto.c
+
src/tls-context.o: $(TLS_DEPENDS) src/tls-context.c
$(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) $(TLS_CFLAGS) -c -o $@ src/tls-context.c
src/tls-socket.o: $(TLS_DEPENDS) src/tls-socket.c
$(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) $(TLS_CFLAGS) -c -o $@ src/tls-socket.c
-src/openssl-compat.o: src/libaxtls.a src/openssl-compat.c
- $(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) $(TLS_CFLAGS) -c -o $@ src/openssl-compat.c
+src/axtls-compat.o: src/libaxtls.a src/axtls-compat.c
+ $(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) $(TLS_CFLAGS) -c -o $@ src/axtls-compat.c
mkdir -p dist
cp -pR axtls-root/* dist/
compile: $(NIXIO_OBJ)
- $(LINK) $(SHLIB_FLAGS) $(NIXIO_LDFLAGS) -o src/nixio.so $(NIXIO_OBJ)
+ $(LINK) $(SHLIB_FLAGS) $(NIXIO_LDFLAGS) -o src/$(NIXIO_SO) $(NIXIO_OBJ) $(NIXIO_LDFLAGS_POST)
mkdir -p dist$(LUA_LIBRARYDIR)
- cp src/nixio.so dist$(LUA_LIBRARYDIR)/nixio.so
+ cp src/$(NIXIO_SO) dist$(LUA_LIBRARYDIR)/$(NIXIO_SO)
$(AXTLS_DIR)/.prepared:
#rm -rf $(AXTLS_DIR)
@@ -55,9 +78,13 @@ $(AXTLS_DIR)/.prepared:
touch $@
src/libaxtls.a: $(AXTLS_DIR)/.prepared
- $(MAKE) -C $(AXTLS_DIR) CC=$(CC) CFLAGS="$(CFLAGS) $(EXTRA_CFLAGS) $(FPIC) '-Dalloca(size)=__builtin_alloca(size)' -Wall -pedantic -I../config -I../ssl -I../crypto" LDFLAGS="$(LDFLAGS)" OS="$(OS)" clean all
+ $(MAKE) -C $(AXTLS_DIR) CC=$(CC) CFLAGS="$(CFLAGS) $(EXTRA_CFLAGS) $(FPIC) -Wall -pedantic -I../config -I../ssl -I../crypto" LDFLAGS="$(LDFLAGS)" OS="$(OS)" clean all
cp -p $(AXTLS_DIR)/_stage/libaxtls.a src
clean: luaclean
- rm -f src/*.o src/*.so src/*.a
+ rm -f src/*.o src/*.so src/*.a src/*.dll
rm -f $(AXTLS_DIR)/.prepared
+
+install: build
+ cp -pR dist$(LUA_MODULEDIR)/* $(LUA_MODULEDIR)
+ cp -pR dist$(LUA_LIBRARYDIR)/* $(LUA_LIBRARYDIR)