1# $OpenLDAP$
2# This work is part of OpenLDAP Software <http://www.openldap.org/>.
3#
4# Copyright 2008-2021 The OpenLDAP Foundation.
5# Portions Copyright 2008 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
15# Path to the OpenLDAP source tree
16LDAP_SRC=../../..
17
18# Path to the OpenLDAP object tree - same as above unless
19# you're doing out-of-tree builds.
20LDAP_BUILD=$(LDAP_SRC)
21
22LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd
23LDAP_LIB = $(LDAP_BUILD)/libraries/libldap/libldap.la \
24	$(LDAP_BUILD)/libraries/liblber/liblber.la
25
26NLDAPD_INC=-Inss-pam-ldapd
27
28LIBTOOL = $(LDAP_BUILD)/libtool
29INSTALL = /usr/bin/install
30OPT = -g -O2
31CC = gcc
32DEFS =
33INCS = $(LDAP_INC) $(NLDAPD_INC)
34LIBS = $(LDAP_LIB)
35
36prefix=/usr/local
37exec_prefix=$(prefix)
38ldap_subdir=/openldap
39
40libdir=$(exec_prefix)/lib
41libexecdir=$(exec_prefix)/libexec
42moduledir = $(libexecdir)$(ldap_subdir)
43sysconfdir = $(prefix)/etc$(ldap_subdir)
44schemadir = $(sysconfdir)/schema
45mandir = $(exec_prefix)/share/man
46man5dir = $(mandir)/man5
47
48all:	nssov.la
49
50XOBJS = tio.lo
51
52OBJS = alias.lo ether.lo group.lo host.lo netgroup.lo network.lo \
53	nssov.lo passwd.lo protocol.lo rpc.lo service.lo shadow.lo pam.lo
54
55MANPAGES = slapo-nssov.5
56
57.SUFFIXES: .c .o .lo
58
59.c.lo:
60	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(OPT) $(CPPFLAGS) $(DEFS) $(INCS) -c $<
61
62tio.lo:	nss-pam-ldapd/tio.c
63	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(OPT) $(CPPFLAGS) $(DEFS) $(INCS) -c $?
64
65$(OBJS):	nssov.h
66
67nssov.la:	$(OBJS) $(XOBJS)
68	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -version-info 0:0:0 \
69	-rpath $(moduledir) -module -o $@ $(OBJS) $(XOBJS) $(LIBS)
70
71install: install-lib install-man FORCE
72
73install-lib: nssov.la
74	mkdir -p $(DESTDIR)$(moduledir)
75	$(LIBTOOL) --mode=install cp nssov.la $(DESTDIR)$(moduledir)
76	cp ldapns.schema $(DESTDIR)$(schemadir)
77
78install-man: $(MANPAGES)
79	mkdir -p  $(DESTDIR)$(man5dir)
80	$(INSTALL) -m 644 $(MANPAGES) $(DESTDIR)$(man5dir)
81
82FORCE:
83
84clean:
85	rm -f *.*o *.la .libs/*
86	rm -rf .libs
87