# $Id: Makefile.in,v 1.9 2001/07/04 14:37:55 dave Exp $

# Copyright (C), 1999-2001 Dave Carrigan

LIBS=@LIBS@
CPPFLAGS=@CPPFLAGS@
OPENLDAP=@OPENLDAP@
SSL=@SSL@
SHARED_CACHE=@SHARED_CACHE@
APXS=@APXS@
ACTIVATE=@ACTIVATE@
FRONTPAGE=@FRONTPAGE@
AIX_EXP=@AIX_EXP@
AIX_LDFLAGS_SHLIB=@AIX_LDFLAGS_SHLIB@
MYCC=@MYCC@

all: auth_ldap.so

html: FAQ.html Changes.html auth_ldap.html

OBJS=auth_ldap.o auth_ldap_config.o auth_ldap_cache.o auth_ldap_cache_mgr.o

CFLAGS=`$(APXS) -q CFLAGS` $(FRONTPAGE) $(SSL) $(SHARED_CACHE) $(OPENLDAP)
CFLAGS_SHLIB=`$(APXS) -q CFLAGS_SHLIB` 
INCLUDEDIR=`$(APXS) -q INCLUDEDIR`
EXTRA_LDFLAGS=@LDFLAGS@
LD_SHLIB=`$(APXS) -q LD_SHLIB`
LDFLAGS_SHLIB=$(EXTRA_LDFLAGS) `$(APXS) -q LDFLAGS_SHLIB` $(AIX_LDFLAGS_SHLIB)

auth_ldap.so: $(OBJS) $(AIX_EXP)
	@echo $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(OBJS) $(LIBS)
	@$(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(OBJS) $(LIBS) 

%.o: %.c
	@echo $(MYCC) -c -o $@ $(CFLAGS) $(CFLAGS_SHLIB) -I$(INCLUDEDIR) $(CPPFLAGS) $<
	@$(MYCC) -c -o $@ $(CFLAGS) $(CFLAGS_SHLIB) -I$(INCLUDEDIR) $(CPPFLAGS) $<

dist: clean html
	dir=`pwd`; \
	dirname=`basename $$dir`; \
	tar=$$dirname.tar.gz; \
	echo $$dirname'/Makefile' > /tmp/excl.$$$$; \
	echo $$dirname'/config.*' >> /tmp/excl.$$$$; \
	echo $$dirname'/.cvsignore' >> /tmp/excl.$$$$; \
	echo $$dirname'/CVS' >> /tmp/excl.$$$$; \
	cd .. && tar cvzf $$tar $$dirname/ --exclude-from=/tmp/excl.$$$$; \
	rm -f /tmp/excl.$$$$

install: auth_ldap.so
	$(APXS) -i $(ACTIVATE) auth_ldap.so

clean:
	rm -f *.so *.o *~ core $(AIX_EXP) TAGS 

distclean: clean
	rm -f Makefile config.status config.cache config.log

$(AIX_EXP):
	@echo auth_ldap_module > $@

auth_ldap.o: auth_ldap.h auth_ldap_cache_mgr.h
auth_ldap_config.o: auth_ldap.h auth_ldap_cache_mgr.h
auth_ldap_cache.o: auth_ldap.h auth_ldap_cache_mgr.h
auth_ldap_cache_mgr.o: auth_ldap.h auth_ldap_cache_mgr.h

Makefile: Makefile.in
	sh config.status

html: FAQ.html auth_ldap.html Changes.html

FAQ.html: faq.xsl faq.xml
	xsltproc $^ > $@

auth_ldap.html: auth_ldap.xsl auth_ldap.xml
	xsltproc $^ > $@

Changes.html: Changes.xsl Changes.xml
	xsltproc $^ > $@
