1# $OpenLDAP$
2# This work is part of OpenLDAP Software <http://www.openldap.org/>.
3#
4# Copyright 1998-2021 The OpenLDAP Foundation.
5# Copyright 2017 Ondřej Kuzník, 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)
17SRCDIR = ./
18LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd
19LDAP_LIB = $(LDAP_BUILD)/libraries/libldap/libldap.la \
20	$(LDAP_BUILD)/libraries/liblber/liblber.la
21
22LIBTOOL = $(LDAP_BUILD)/libtool
23INSTALL = /usr/bin/install
24CC = cc
25OPT = -pipe -O2 -isystem /usr/local/include -fno-strict-aliasing
26DEFS = -DSLAPD_OVER_VARIANT=SLAPD_MOD_DYNAMIC
27INCS = $(LDAP_INC)
28LIBS = $(LDAP_LIB)
29
30PROGRAMS = variant.la
31MANPAGES = slapo-variant.5
32CLEAN = *.o *.lo *.la .libs
33LTVER = 0:0:0
34
35prefix=/usr/local
36exec_prefix=$(prefix)
37ldap_subdir=/openldap
38
39libdir=$(exec_prefix)/lib
40libexecdir=$(exec_prefix)/libexec
41moduledir = $(libexecdir)$(ldap_subdir)
42mandir = $(exec_prefix)/man
43man5dir = $(mandir)/man5
44
45all: $(PROGRAMS)
46
47d :=
48sp :=
49dir := tests
50include $(dir)/Rules.mk
51
52.SUFFIXES: .c .o .lo
53
54.c.lo:
55	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(OPT) $(CPPFLAGS) $(DEFS) $(INCS) -c $<
56
57variant.la: variant.lo
58	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -version-info $(LTVER) \
59		-rpath $(moduledir) -module -o $@ $? $(LIBS)
60
61clean:
62	rm -rf $(CLEAN)
63
64install: install-lib install-man FORCE
65
66install-lib: $(PROGRAMS)
67	mkdir -p $(DESTDIR)$(moduledir)
68	for p in $(PROGRAMS) ; do \
69		$(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \
70	done
71
72install-man: $(MANPAGES)
73	mkdir -p  $(DESTDIR)$(man5dir)
74	$(INSTALL) -m 644 $(MANPAGES) $(DESTDIR)$(man5dir)
75
76FORCE:
77
78