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
21SSL_INC =
22SSL_LIB = -lcrypto
23
24HEIMDAL_INC = -I/usr/include
25HEIMDAL_LIB = -L/usr/lib -lkrb5 -lkadm5srv
26
27LIBTOOL = $(LDAP_BUILD)/libtool
28INSTALL = /usr/bin/install
29CC = cc
30OPT = -pipe -O2 -isystem /usr/local/include -fno-strict-aliasing
31# Omit DO_KRB5, DO_SAMBA or DO_SHADOW if you don't want to support it.
32DEFS = -DDO_KRB5 -DDO_SAMBA -DDO_SHADOW
33INCS = $(LDAP_INC) $(HEIMDAL_INC) $(SSL_INC)
34LIBS = $(LDAP_LIB) $(HEIMDAL_LIB) $(SSL_LIB)
35
36PROGRAMS = smbk5pwd.la
37MANPAGES = slapo-smbk5pwd.5
38LTVER = 0:0:0
39
40prefix=/usr/local
41exec_prefix=$(prefix)
42ldap_subdir=/openldap
43
44libdir=$(exec_prefix)/lib
45libexecdir=$(exec_prefix)/libexec
46moduledir = $(libexecdir)$(ldap_subdir)
47mandir = $(exec_prefix)/man
48man5dir = $(mandir)/man5
49
50.SUFFIXES: .c .o .lo
51
52.c.lo:
53	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(OPT) $(CPPFLAGS) $(DEFS) $(INCS) -c $<
54
55all: $(PROGRAMS)
56
57smbk5pwd.la:	smbk5pwd.lo
58	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -version-info $(LTVER) \
59	-rpath $(moduledir) -module -o $@ $? $(LIBS)
60
61clean:
62	rm -rf *.o *.lo *.la .libs
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