# $OpenLDAP$
-CPPFLAGS+=-I../../../include -I../../../servers/slapd
-all: kerberos.la netscape.la radius.la apr1.la
+LDAP_SRC = ../../..
+LDAP_BUILD = ../../..
+LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd
+LDAP_LIB = $(LDAP_BUILD)/libraries/libldap_r/libldap_r.la \
+ $(LDAP_BUILD)/libraries/liblber/liblber.la
-kerberos.lo: kerberos.c
- $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) -DHAVE_KRB5 -Wall -c $?
+LIBTOOL = $(LDAP_BUILD)/libtool
+CC = gcc
+OPT = -g -O2 -Wall
+DEFS =
+INCS = $(LDAP_INC)
+LIBS = $(LDAP_LIB)
-kerberos.la: kerberos.lo
- $(LIBTOOL) --mode=link $(CC) -version-info 0:0:0 \
- -rpath $(PREFIX)/lib -module -o $@ $? -lkrb5
+PROGRAMS = pw-kerberos.la pw-netscape.la pw-radius.la pw-apr1.la
+LTVER = 0:0:0
-netscape.lo: netscape.c
- $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) -Wall -c $?
+prefix=/usr/local
+exec_prefix=$(prefix)
+ldap_subdir=/openldap
-netscape.la: netscape.lo
- $(LIBTOOL) --mode=link $(CC) -version-info 0:0:0 \
- -rpath $(PREFIX)/lib -module -o $@ $?
+libdir=$(exec_prefix)/lib
+libexecdir=$(exec_prefix)/libexec
+moduledir = $(libexecdir)$(ldap_subdir)
-radius.lo: radius.c
- $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) -Wall -c $?
+.SUFFIXES: .c .o .lo
-radius.la: radius.lo
- $(LIBTOOL) --mode=link $(CC) -version-info 0:0:0 \
- -rpath $(PREFIX)/lib -module -o $@ $? -lradius
+.c.lo:
+ $(LIBTOOL) --mode=compile $(CC) $(OPT) $(DEFS) $(INCS) -c $<
-apr1.lo: apr1.c
- $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) -Wall -c $?
+all: $(PROGRAMS)
+
+pw-kerberos.la: kerberos.lo
+ $(LIBTOOL) --mode=link $(CC) $(OPT) -version-info $(LTVER) \
+ -rpath $(PREFIX)/lib -module -o $@ $? -lkrb5
-apr1.la: apr1.lo
- $(LIBTOOL) --mode=link $(CC) -version-info 0:0:0 \
+pw-netscape.la: netscape.lo
+ $(LIBTOOL) --mode=link $(CC) $(OPT) -version-info $(LTVER) \
-rpath $(PREFIX)/lib -module -o $@ $?
+pw-radius.la: radius.lo
+ $(LIBTOOL) --mode=link $(CC) $(OPT) -version-info $(LTVER) \
+ -rpath $(PREFIX)/lib -module -o $@ $? -lradius
+
+pw-apr1.la: apr1.lo
+ $(LIBTOOL) --mode=link $(CC) $(OPT) -version-info $(LTVER) \
+ -rpath $(PREFIX)/lib -module -o $@ $?
+
clean:
- rm -f kerberos.lo kerberos.la
- rm -f netscape.lo netscape.la
- rm -f radius.lo radius.la
- rm -f apr1.lo apr1.la
-
-install: kerberos.la netscape.la radius.la apr1.la
- mkdir -p $(PREFIX)/lib/openldap
- $(LIBTOOL) --mode=install cp kerberos.la $(PREFIX)/lib/openldap
- $(LIBTOOL) --mode=install cp netscape.la $(PREFIX)/lib/openldap
- $(LIBTOOL) --mode=install cp radius.la $(PREFIX)/lib/openldap
- $(LIBTOOL) --mode=install cp apr1.la $(PREFIX)/lib/openldap
- $(LIBTOOL) --finish $(PREFIX)/lib
+ rm -rf *.o *.lo *.la .libs
+
+install: $(PROGRAMS)
+ mkdir -p $(DESTDIR)$(moduledir)
+ for p in $(PROGRAMS) ; do \
+ $(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \
+ done
+