# Source files. mod_auth_mellon.c must be the first file.
SRC=mod_auth_mellon.c \
	auth_mellon_cache.c \
	auth_mellon_config.c \
	auth_mellon_cookie.c \
	auth_mellon_diagnostics.c \
	auth_mellon_handler.c \
	auth_mellon_util.c \
	auth_mellon_session.c \
	auth_mellon_httpclient.c

# Documentation files
USER_GUIDE_FILES=\
	doc/user_guide/mellon_user_guide.adoc \
	doc/user_guide/Guardfile \
	doc/user_guide/README \
	doc/user_guide/images/chrome_SAML_Chrome_Panel.png \
	doc/user_guide/images/chrome_SAML_Chrome_Panel.svg \
	doc/user_guide/images/saml-tracer.png \
	doc/user_guide/images/saml-tracer.svg \
	doc/user_guide/images/saml-web-sso.svg


# Files to include when making a .tar.gz-file for distribution
DISTFILES=$(SRC) \
	auth_mellon.h \
	auth_mellon_compat.h \
	lasso_compat.h \
	config.h.in \
	configure \
	configure.ac \
	Makefile.in \
	autogen.sh \
	README.md \
	ECP.rst \
	COPYING \
	NEWS \
	mellon_create_metadata.sh \
	doc/mellon_create_metadata.8 \
	$(USER_GUIDE_FILES)

all:	mod_auth_mellon.la

mod_auth_mellon.la: $(SRC) auth_mellon.h auth_mellon_compat.h
	/usr/bin/apxs2 -Wc,"-std=c99   -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_CRYPTO_OPENSSL=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DHAVE_LASSO_UTILS_H -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2" -Wl,"-lssl -lcrypto -llasso -lcurl -lglib-2.0" -Wc,-Wall -Wc,-g -c $(SRC)


# Building configure (for distribution)
configure:	configure.ac
	./autogen.sh

mod_auth_mellon-0.17.0.tar.gz:	 $(DISTFILES)
	tar -c --transform="s#^#mod_auth_mellon-0.17.0/#" -vzf $@ $(DISTFILES)


.PHONY:	install
install: mod_auth_mellon.la
	/usr/bin/apxs2 -i -n auth_mellon mod_auth_mellon.la

.PHONY: distfile
distfile:	mod_auth_mellon-0.17.0.tar.gz

.PHONY:	clean
clean:
	rm -f mod_auth_mellon.la
	rm -f $(SRC:%.c=%.o)
	rm -f $(SRC:%.c=%.lo)
	rm -f $(SRC:%.c=%.slo)
	rm -rf .libs/

.PHONY:	distclean
distclean:	clean
	rm -f Makefile config.log config.status mod_auth_mellon-0.17.0.tar.gz *~ \
	build-stamp config.guess config.sub
	rm -rf debian/mod-auth-mellon
	rm -f debian/files

.PHONY: fullclean
fullclean:	distclean
	rm -f configure aclocal.m4
