1 # $OpenLDAP$ 2 # Copyright 2009 Jonathan Clarke <jonathan (at] phillipoux.net>. 3 # All rights reserved. 4 # 5 # Redistribution and use in source and binary forms, with or without 6 # modification, are permitted only as authorized by the OpenLDAP 7 # Public License. 8 # 9 # A copy of this license is available in the file LICENSE in the 10 # top-level directory of the distribution or, alternatively, at 11 # <http://www.OpenLDAP.org/license.html>. 12 13 LDAP_SRC = ../../.. 14 LDAP_BUILD = $(LDAP_SRC) 15 LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd 16 LDAP_LIB = $(LDAP_BUILD)/libraries/libldap_r/libldap_r.la \ 17 $(LDAP_BUILD)/libraries/liblber/liblber.la 18 19 LIBTOOL = $(LDAP_BUILD)/libtool 20 CC = gcc 21 OPT = -g -O2 -Wall 22 DEFS = -DSLAPD_OVER_LASTBIND=SLAPD_MOD_DYNAMIC 23 INCS = $(LDAP_INC) 24 LIBS = $(LDAP_LIB) 25 26 PROGRAMS = lastbind.la 27 LTVER = 0:0:0 28 29 prefix=/usr/local 30 exec_prefix=$(prefix) 31 ldap_subdir=/openldap 32 33 libdir=$(exec_prefix)/lib 34 libexecdir=$(exec_prefix)/libexec 35 moduledir = $(libexecdir)$(ldap_subdir) 36 37 .SUFFIXES: .c .o .lo 38 39 .c.lo: 40 $(LIBTOOL) --mode=compile $(CC) $(OPT) $(DEFS) $(INCS) -c $< 41 42 all: $(PROGRAMS) 43 44 lastbind.la: lastbind.lo 45 $(LIBTOOL) --mode=link $(CC) $(OPT) -version-info $(LTVER) \ 46 -rpath $(moduledir) -module -o $@ $? $(LIBS) 47 48 clean: 49 rm -rf *.o *.lo *.la .libs 50 51 install: $(PROGRAMS) 52 mkdir -p $(DESTDIR)$(moduledir) 53 for p in $(PROGRAMS) ; do \ 54 $(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \ 55 done 56 57