Add posix support library, and adjust makefiles for it
[prosody.git] / util-src / Makefile
index 205e51d210cd024e46ba66bef493b5002c0cdee3..18e1e78d34b8200df499d4607c69972e53c78bd5 100644 (file)
@@ -1,29 +1,37 @@
 
-!IFDEF WINDIR
-!INCLUDE Makefile.win
-!ELSE
+include ../config.unix
 
-LUA_INCLUDE=/usr/include/lua5.1
-LUA_LIB=lua5.1
+LUA_SUFFIX?=5.1
+LUA_INCDIR?=/usr/include/lua$(LUA_SUFFIX)
+LUA_LIB?=lua$(LUA_SUFFIX)
+IDN_LIB?=idn
+OPENSSL_LIB?=crypto
 
-IDN_LIB=idn
-OPENSSL_LIB=ssl
 
 
-all: encodings.so hashes.so
+all: encodings.so hashes.so pposix.so
 
-install: encodings.so hashes.so
-       strip *.so
-       cp *.so ../util/
+install: encodings.so hashes.so pposix.so
+       install *.so ../util/
        
 
 clean:
-       rm *.so
+       rm -f *.so
+       rm -f ../util/*.so
 
-encodings.so: encodings.c
-       gcc -shared encodings.c -I$(LUA_INCLUDE) -l$(LUA_LIB) -l$(IDN_LIB) -o encodings.so
+encodings.o: encodings.c
+       gcc $(CFLAGS) -I$(LUA_INCDIR) -c -o encodings.o encodings.c
+encodings.so: encodings.o
+       export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc $(LFLAGS) -o encodings.so encodings.o -L/usr/local/lib -llua$(LUA_SUFFIX) -lcrypto -lidn
+       
+
+hashes.o: hashes.c
+       gcc $(CFLAGS) -I$(LUA_INCDIR) -c -o hashes.o hashes.c
+hashes.so: hashes.o
+       export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc $(LFLAGS) -o hashes.so hashes.o -L/usr/local/lib -llua$(LUA_SUFFIX) -lcrypto -lssl
 
-hashes.so: hashes.c
-       gcc -shared hashes.c -I$(LUA_INCLUDE) -l$(LUA_LIB) -l$(OPENSSL_LIB) -o hashes.so
+pposix.o: pposix.c
+       gcc $(CFLAGS) -I$(LUA_INCDIR) -c -o pposix.o pposix.c
+pposix.so: pposix.o
+       export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc $(LFLAGS) -o pposix.so pposix.o -L/usr/local/lib -llua$(LUA_SUFFIX)
        
-!ENDIF