about summary refs log tree commit diff stats
path: root/src/luasec/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/luasec/Makefile')
-rw-r--r--src/luasec/Makefile67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/luasec/Makefile b/src/luasec/Makefile
new file mode 100644
index 0000000..d1696d2
--- /dev/null
+++ b/src/luasec/Makefile
@@ -0,0 +1,67 @@
+CMOD=ssl.so
+LMOD=ssl.lua
+
+OBJS= \
+ options.o \
+ x509.o    \
+ context.o \
+ ssl.o     \
+ config.o  \
+ ec.o
+
+WARN=-Wall -pedantic
+
+BSD_CFLAGS=-O2 -fPIC $(WARN) $(INCDIR) $(DEFS)
+BSD_LDFLAGS=-O -fPIC -shared $(LIBDIR)
+
+LNX_CFLAGS=-O2 $(WARN) $(INCDIR) $(DEFS)
+LNX_LDFLAGS=-O
+
+MAC_ENV=env MACOSX_DEPLOYMENT_TARGET='$(MACVER)'
+MAC_CFLAGS=-O2 -fno-common $(WARN) $(INCDIR) $(DEFS)
+MAC_LDFLAGS=-bundle -undefined dynamic_lookup $(LIBDIR)
+
+INSTALL  = install
+CC      ?= cc
+CCLD      ?= $(MYENV) $(CC)
+CFLAGS  += $(MYCFLAGS)
+LDFLAGS += $(MYLDFLAGS)
+AR= ar rc
+RANLIB= ranlib
+
+.PHONY: all clean install none linux bsd macosx luasocket
+
+all: luasocket
+
+install: $(CMOD) $(LMOD)
+	$(INSTALL) -d $(DESTDIR)$(LUAPATH)/ssl $(DESTDIR)$(LUACPATH)
+	$(INSTALL) $(CMOD) $(DESTDIR)$(LUACPATH)
+	$(INSTALL) -m644 $(LMOD) $(DESTDIR)$(LUAPATH)
+	$(INSTALL) -m644 https.lua $(DESTDIR)$(LUAPATH)/ssl
+
+linux: $(OBJS)
+	$(AR) ssl.a $(OBJS)
+	$(RANLIB) ssl.a
+
+bsd:
+	@$(MAKE) $(CMOD) MYCFLAGS="$(BSD_CFLAGS)" MYLDFLAGS="$(BSD_LDFLAGS)" EXTRA="$(EXTRA)"
+
+macosx:
+	@$(MAKE) $(CMOD) MYCFLAGS="$(MAC_CFLAGS)" MYLDFLAGS="$(MAC_LDFLAGS)" MYENV="$(MAC_ENV)" EXTRA="$(EXTRA)"
+
+luasocket:
+	@cd luasocket && $(MAKE)
+
+$(CMOD): $(EXTRA) $(OBJS)
+	$(CCLD) $(LDFLAGS) -o $@ $(OBJS) luasocket/libluasocket.a -lssl -lcrypto
+
+clean:
+	cd luasocket && $(MAKE) clean
+	rm -f $(OBJS) $(CMOD)
+
+options.o: options.h options.c
+ec.o: ec.c ec.h
+x509.o: x509.c x509.h compat.h
+context.o: context.c context.h ec.h compat.h options.h
+ssl.o: ssl.c ssl.h context.h x509.h compat.h
+config.o: config.c ec.h options.h compat.h