1# $OpenLDAP$
2# This work is part of OpenLDAP Software <http://www.openldap.org/>.
3#
4# Copyright 1998-2011 The OpenLDAP Foundation.
5# Copyright 2004 Howard Chu, Symas Corp. All Rights Reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted only as authorized by the OpenLDAP
9# Public License.
10#
11# A copy of this license is available in the file LICENSE in the
12# top-level directory of the distribution or, alternatively, at
13# <http://www.OpenLDAP.org/license.html>.
14
15LDAP_SRC=../../..
16# craft according to your installation
17LDAP_BUILD=../../..
18
19LIBTOOL=$(LDAP_BUILD)/libtool
20OPT=-g -O2
21CC=gcc
22
23DEFS=-DSLAPD_OVER_RDNVAL=2 -DSLAPD_OVER_PGUID=2 -DSLAPD_OVER_VERNUM=2
24
25LDAP_INC=-I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd \
26	-I$(LDAP_BUILD)/include
27INCS=$(LDAP_INC)
28
29LDAP_LIB=-lldap_r -llber
30LIBS=$(LDAP_LIB)
31
32prefix=/usr/local
33exec_prefix=$(prefix)
34ldap_subdir=/openldap
35
36libdir=$(exec_prefix)/lib
37libexecdir=$(exec_prefix)/libexec
38moduledir = $(libexecdir)$(ldap_subdir)
39
40PROGRAMS = pguid.la rdnval.la vernum.la
41
42all:	$(PROGRAMS)
43
44pguid.lo:	pguid.c
45	$(LIBTOOL) --mode=compile $(CC) $(OPT) $(DEFS) $(INCS) -c $?
46
47pguid.la:	pguid.lo
48	$(LIBTOOL) --mode=link $(CC) $(OPT) -version-info 0:0:0 \
49	-rpath $(moduledir) -module -o $@ $? $(LIBS)
50
51rdnval.lo:	rdnval.c
52	$(LIBTOOL) --mode=compile $(CC) $(OPT) $(DEFS) $(INCS) -c $?
53
54rdnval.la:	rdnval.lo
55	$(LIBTOOL) --mode=link $(CC) $(OPT) -version-info 0:0:0 \
56	-rpath $(moduledir) -module -o $@ $? $(LIBS)
57
58vernum.lo:	vernum.c
59	$(LIBTOOL) --mode=compile $(CC) $(OPT) $(DEFS) $(INCS) -c $?
60
61vernum.la:	vernum.lo
62	$(LIBTOOL) --mode=link $(CC) $(OPT) -version-info 0:0:0 \
63	-rpath $(moduledir) -module -o $@ $? $(LIBS)
64
65clean:
66	rm -f \
67		pguid.o pguid.lo pguid.la \
68		rdnval.o rdnval.lo rdnval.la \
69		vernum.o vernum.lo vernum.la
70
71install: $(PROGRAMS)
72	mkdir -p $(DESTDIR)$(moduledir)
73	for p in $(PROGRAMS) ; do \
74		$(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \
75	done
76
77