# Makefile for xmlrpc

# CONFIGURE: If you are using a SystemV-based operating system, such as
# Solaris, you will need to uncomment this definition.
#SYSV_LIBS =	-lnsl -lsocket

# CONFIGURE: If you want to compile in support for https, uncomment these
# definitions.  You will need to have already built OpenSSL, available at
# http://www.openssl.org/  Make sure the SSL_TREE definition points to the
# tree with your OpenSSL installation - depending on how you installed it,
# it may be in /usr/local instead of /usr/local/ssl.
#SSL_TREE =     /usr/local/ssl
SSL_TREE =     /usr/local
SSL_DEFS =	-DUSE_SSL
SSL_INC =	-I$(SSL_TREE)/include
SSL_LIBS =	-L$(SSL_TREE)/lib -lssl -lcrypto

STATIC_LIBS=

ifneq ($(XYSSL),)
# XYSSL support
XYSSL_TREE?=	/usr/ports/security/xyssl/work/xyssl-0.9
SSL_DEFS +=	-DUSE_XYSSL
SSL_INC +=	-I$(XYSSL_TREE)/include
SSL_LIBS =	#-L$(XYSSL_TREE)/library -lxyssl
STATIC_LIBS +=	$(XYSSL_TREE)/library/libxyssl.a
endif

CFLAGS =	-Wall -Werror -O $(SSL_DEFS) $(SSL_INC)
LDFLAGS =	-s $(SSL_LIBS) $(SYSV_LIBS)
#LDFLAGS =	-g $(SSL_LIBS) $(SYSV_LIBS)

all:	xmlrpc

SRCS= xmlrpc.c sslsock.c dynstring.c minixml.c
SRCS+= myhdr.h minixml.h dynstring.h
SRCS+= Makefile xmlrpc.1 README
OBJS= xmlrpc.o sslsock.o dynstring.o minixml.o

xmlrpc:	$(OBJS)
	$(CC)  $(LDFLAGS) -o xmlrpc $(OBJS) $(STATIC_LIBS)

$(OBJS): myhdr.h dynstring.h minixml.h

clean:
	rm -f xmlrpc *.o core core.* *.core *.tgz minixmlrpc

tgz: $(SRCS) clean
	- rm minixmlrpc
	ln -s . minixmlrpc
	tar cHvzf xmlrpc.tgz --exclude .svn --exclude test\* --exclude \*.tgz minixmlrpc
