xref: /netbsd-src/external/bsd/openldap/dist/contrib/slapd-modules/lastbind/Makefile (revision 16dce51364ebe8aeafbae46bc5aa167b8115bc45)
1# $OpenLDAP$
2# Copyright 2009 Jonathan Clarke <jonathan@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
13LDAP_SRC = ../../..
14LDAP_BUILD = $(LDAP_SRC)
15LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd
16LDAP_LIB = $(LDAP_BUILD)/libraries/libldap_r/libldap_r.la \
17	$(LDAP_BUILD)/libraries/liblber/liblber.la
18
19LIBTOOL = $(LDAP_BUILD)/libtool
20CC = gcc
21OPT = -g -O2 -Wall
22DEFS = -DSLAPD_OVER_LASTBIND=SLAPD_MOD_DYNAMIC
23INCS = $(LDAP_INC)
24LIBS = $(LDAP_LIB)
25
26PROGRAMS = lastbind.la
27LTVER = 0:0:0
28
29prefix=/usr/local
30exec_prefix=$(prefix)
31ldap_subdir=/openldap
32
33libdir=$(exec_prefix)/lib
34libexecdir=$(exec_prefix)/libexec
35moduledir = $(libexecdir)$(ldap_subdir)
36
37.SUFFIXES: .c .o .lo
38
39.c.lo:
40	$(LIBTOOL) --mode=compile $(CC) $(OPT) $(DEFS) $(INCS) -c $<
41
42all: $(PROGRAMS)
43
44lastbind.la: lastbind.lo
45	$(LIBTOOL) --mode=link $(CC) $(OPT) -version-info $(LTVER) \
46	-rpath $(moduledir) -module -o $@ $? $(LIBS)
47
48clean:
49	rm -rf *.o *.lo *.la .libs
50
51install: $(PROGRAMS)
52	mkdir -p $(DESTDIR)$(moduledir)
53	for p in $(PROGRAMS) ; do \
54		$(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \
55	done
56
57