# $Id: Makefile,v 1.5 1999/08/27 05:11:40 dave Exp $

# Copyright (C), 1998, 1999 Enbridge Pipelines Inc.
# Copyright (C), 1999 Dave Carrigan

# Where to find the ldap include files
# INCLUDES=-I/usr/local/include

# How to link against the ldap libraries. 

# For Mozilla or OpenLDAP SDKs
# LIBS=-lldap -llber

# For the Netscape SDK with SSL support
# LIBS= -lldapssl30

# Uncomment this if you're using the OpenLDAP libraries
# OPENLDAP=-DWITH_OPENLDAP

# Uncomment this if you want to communicate with a secure directory
# server.  This requires the Netscape SDK.
# SSL=-DWITH_SSL

# Where to find apxs. Could be in the sbin or the bin directory
# APXS=/usr/local/apache/bin/apxs

# Set ACTIVATE to -a if you want `make install' to activate the
# module in httpd.conf.
# ACTIVATE=-a

# Uncomment this if you want to build with Frontpage support.
# FRONTPAGE=-DAUTH_LDAP_FRONTPAGE_HACK

# Add any extra flags you need to compile
# EXTRA_CFLAGS=

# You shouldn't need to change anything below here. If you do, report it
# as a bug.

OBJS=auth_ldap.o auth_ldap_config.o auth_ldap_cache.o

CC=`$(APXS) -q CC`
CFLAGS=`$(APXS) -q CFLAGS` -Wall $(FRONTPAGE) $(SSL) $(EXTRA_CFLAGS) $(OPENLDAP)
CFLAGS_SHLIB=`$(APXS) -q CFLAGS_SHLIB` 
INCLUDEDIR=`$(APXS) -q INCLUDEDIR`
LD_SHLIB=`$(APXS) -q LD_SHLIB`
LDFLAGS_SHLIB=`$(APXS) -q LDFLAGS_SHLIB`

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

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

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

clean:
	rm -f *.so *.o *~ core

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