From a585beb87e31db5efa7b86941fd7da3da560ac31 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Tue, 21 Jun 2011 08:59:44 +0000
Subject: [PATCH] - Introduced windows DLL build and SYS_LDFLAGS
---
library/Makefile | 13 ++++++++++---
programs/Makefile | 2 +-
tests/Makefile | 2 +-
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/library/Makefile b/library/Makefile
index b1b8e2db0..042c12c34 100644
--- a/library/Makefile
+++ b/library/Makefile
@@ -17,6 +17,9 @@ DLEXT=so
# OSX shared library extension:
# DLEXT=dylib
+# Windows shared library extension:
+# DLEXT=dll
+
OBJS= aes.o arc4.o base64.o \
bignum.o camellia.o certs.o \
cipher.o cipher_wrap.o debug.o \
@@ -33,7 +36,7 @@ OBJS= aes.o arc4.o base64.o \
.SILENT:
-all: static
+all: static shared
static: libpolarssl.a
@@ -41,9 +44,9 @@ shared: libpolarssl.$(DLEXT)
libpolarssl.a: $(OBJS)
echo " AR $@"
- ar r $@ $(OBJS)
+ $(AR) r $@ $(OBJS)
echo " RL $@"
- ranlib $@
+ $(AR) s $@
libpolarssl.so: libpolarssl.a
echo " LD $@"
@@ -53,6 +56,10 @@ libpolarssl.dylib: libpolarssl.a
echo " LD $@"
$(CC) ${LDFLAGS} -dynamiclib -o $@ $(OBJS)
+libpolarssl.dll: libpolarssl.a
+ echo " LD $@"
+ $(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS) -lws2_32 -lwinmm -lgdi32
+
.c.o:
echo " CC $<"
$(CC) $(CFLAGS) $(OFLAGS) -c $<
diff --git a/programs/Makefile b/programs/Makefile
index 6f94c883d..6462653ac 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -5,7 +5,7 @@
CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-statement
OFLAGS = -O
-LDFLAGS += -L../library -lpolarssl
+LDFLAGS += -L../library -lpolarssl $(SYS_LDFLAGS)
APPS = aes/aescrypt2 aes/crypt_and_hash \
hash/hello hash/generic_sum \
diff --git a/tests/Makefile b/tests/Makefile
index 84b961e10..8d5b76743 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -7,7 +7,7 @@ CFLAGS += -I../include -D_FILE_OFFSET_BITS=64 -Wall -W -Wdeclaration-after-state
-Wno-unused-function -Wno-unused-value
OFLAGS = -O
-LDFLAGS += -L../library -lpolarssl
+LDFLAGS += -L../library -lpolarssl $(SYS_LDFLAGS)
APPS = test_suite_aes test_suite_arc4 \
test_suite_base64 test_suite_camellia \