1# $OpenLDAP$
2# This work is part of OpenLDAP Software <http://www.openldap.org/>.
3#
4# Copyright 1998-2021 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 = ../../..
16LDAP_BUILD = $(LDAP_SRC)
17LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd
18LDAP_LIB = $(LDAP_BUILD)/libraries/libldap/libldap.la \
19	$(LDAP_BUILD)/libraries/liblber/liblber.la
20
21LIBTOOL = $(LDAP_BUILD)/libtool
22CC = cc
23OPT = -pipe -O2 -isystem /usr/local/include -fno-strict-aliasing
24DEFS = -DSLAPD_OVER_RDNVAL=SLAPD_MOD_DYNAMIC \
25	-DSLAPD_OVER_PGUID=SLAPD_MOD_DYNAMIC \
26	-DSLAPD_OVER_VERNUM=SLAPD_MOD_DYNAMIC
27INCS = $(LDAP_INC)
28LIBS = $(LDAP_LIB)
29
30PROGRAMS = pguid.la rdnval.la vernum.la
31LTVER = 0:0:0
32
33prefix=/usr/local
34exec_prefix=$(prefix)
35ldap_subdir=/openldap
36
37libdir=$(exec_prefix)/lib
38libexecdir=$(exec_prefix)/libexec
39moduledir = $(libexecdir)$(ldap_subdir)
40
41.SUFFIXES: .c .o .lo
42
43.c.lo:
44	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(OPT) $(CPPFLAGS) $(DEFS) $(INCS) -c $<
45
46all: $(PROGRAMS)
47
48pguid.la: pguid.lo
49	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -version-info $(LTVER) \
50	-rpath $(moduledir) -module -o $@ $? $(LIBS)
51
52rdnval.la: rdnval.lo
53	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -version-info $(LTVER) \
54	-rpath $(moduledir) -module -o $@ $? $(LIBS)
55
56vernum.la: vernum.lo
57	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -version-info $(LTVER) \
58	-rpath $(moduledir) -module -o $@ $? $(LIBS)
59
60clean:
61	rm -rf *.o *.lo *.la .libs
62
63install: $(PROGRAMS)
64	mkdir -p $(DESTDIR)$(moduledir)
65	for p in $(PROGRAMS) ; do \
66		$(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \
67	done
68
69