# include Makefile.in for OpenLDAP
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2007 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.

all-local: ldap_config.h FORCE

install-local: FORCE
	-$(MKDIR) $(DESTDIR)$(includedir)
	for header in $(srcdir)/lber.h lber_types.h \
		$(srcdir)/ldap.h $(srcdir)/ldap_cdefs.h \
		$(srcdir)/ldap_schema.h $(srcdir)/ldap_utf8.h \
		$(srcdir)/slapi-plugin.h ldap_features.h; \
	do \
		$(INSTALL) $(INSTALLFLAGS) -m 644 $$header $(DESTDIR)$(includedir); \
	done

clean-local: FORCE 
	$(RM) ldap_config.h

veryclean-local: clean-local FORCE
	$(RM) portable.h lber_types.h ldap_features.h

depend-local: ldap_config.h FORCE

LDAP_CONFIG=$(srcdir)/ldap_config.hin

ldap_config.h: $(LDAP_CONFIG) Makefile
	@$(RM) $@
	@echo "Making $@"
	@echo "/* Generated from $(LDAP_CONFIG) on `date` */" > $@;  \
	if test $(PLAT) = NT; then \
	    sysconfdir=`cygpath -w $(sysconfdir) | \
		$(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
	    datadir=`cygpath -w $(datadir) | \
		$(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
	    bindir=`cygpath -w $(bindir) | \
		$(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
	    sbindir=`cygpath -w $(sbindir) | \
		$(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
	    libexecdir=`cygpath -w $(libexecdir) | \
		$(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
	    moduledir=`cygpath -w $(moduledir) | \
		$(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
	    localstatedir=`cygpath -w $(localstatedir) | \
		$(SED) -e 's/\\\\/\\\\\\\\\\\\\\\\/g'`; \
	else \
	    sysconfdir=$(sysconfdir); \
	    datadir=$(datadir); \
	    bindir=$(bindir); \
	    sbindir=$(sbindir); \
	    libexecdir=$(libexecdir); \
	    moduledir=$(moduledir); \
	    localstatedir=$(localstatedir); \
	    localedir=$(localedir); \
	fi; \
	$(SED) \
			-e "s;%SYSCONFDIR%;$$sysconfdir;" \
			-e "s;%DATADIR%;$$datadir;" \
			-e "s;%BINDIR%;$$bindir;" \
			-e "s;%SBINDIR%;$$sbindir;" \
			-e "s;%LIBEXECDIR%;$$libexecdir;" \
			-e "s;%MODULEDIR%;$$moduledir;" \
			-e "s;%RUNDIR%;$$localstatedir;" \
			-e "s;%LOCALEDIR%;$$localedir;" \
			 $(LDAP_CONFIG) >> $@; \
	$(CHMOD) 444 $@

all-common:			all-local
install-common:		all-common install-local
clean-common:		clean-local
veryclean-common:	veryclean-local
depend-common:		depend-local

