mod_c2s: Remove use of util.async
[prosody.git] / util-src / Makefile
index 28dc88fa4c5e859bd69e1096d06e2f16230c8644..9c6c377c14a56fd4816729ebf4f45b77a9e5e17f 100644 (file)
@@ -1,24 +1,34 @@
 
-LUA_INCLUDE=/usr/include/lua5.1
-LUA_LIB=lua5.1
+include ../config.unix
 
-IDN_LIB=idn
-OPENSSL_LIB=ssl
+CFLAGS+=-ggdb -Wall -pedantic -I$(LUA_INCDIR)
 
+INSTALL_DATA=install -m644
+TARGET?=../util/
 
-all: encodings.so hashes.so
+ALL=encodings.so hashes.so net.so pposix.so signal.so table.so ringbuffer.so
 
-install: encodings.so hashes.so
-       strip *.so
-       cp *.so ../util/
-       
+ifdef RANDOM
+ALL+=crand.so
+endif
+
+.PHONY: all install clean
+.SUFFIXES: .c .o .so
+
+all: $(ALL)
+
+install: $(ALL)
+       $(INSTALL_DATA) $^ $(TARGET)
 
 clean:
-       rm *.so
+       rm -f $(ALL) $(patsubst %.so,%.o,$(ALL))
+
+encodings.so: LDLIBS+=$(IDNA_LIBS)
+
+hashes.so: LDLIBS+=$(OPENSSL_LIBS)
 
-encodings.so: encodings.c
-       gcc -shared encodings.c -I$(LUA_INCLUDE) -l$(LUA_LIB) -l$(IDN_LIB) -o encodings.so
+crand.o: CFLAGS+=-DWITH_$(RANDOM)
+crand.so: LDLIBS+=$(RANDOM_LIBS)
 
-hashes.so: hashes.c
-       gcc -shared hashes.c -I$(LUA_INCLUDE) -l$(LUA_LIB) -l$(OPENSSL_LIB) -o hashes.so
-       
+%.so: %.o
+       $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)