1# $OpenLDAP$
2# This work is part of OpenLDAP Software <http://www.openldap.org/>.
3#
4# Copyright 2003-2021 The OpenLDAP Foundation.
5# Portions Copyright 2004 by IBM Corporation.
6# All rights reserved.
7
8# Copyright 2004 Sang Seok Lim, IBM Corp. All Rights Reserved.
9#
10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted only as authorized by the OpenLDAP
12# Public License.
13#
14# A copy of this license is available in the file LICENSE in the
15# top-level directory of the distribution or, alternatively, at
16# <http://www.OpenLDAP.org/license.html>.
17
18LDAP_SRC = ../../..
19LDAP_BUILD = $(LDAP_SRC)
20LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd
21LDAP_LIB = $(LDAP_BUILD)/libraries/libldap/libldap.la \
22	$(LDAP_BUILD)/libraries/liblber/liblber.la
23
24SNACC_DIR = ../$(LDAP_SRC)/snacc
25SNACC_INC = -I$(SNACC_DIR) -I$(SNACC_DIR)/c-lib/inc
26SNACC_LIB = $(SNACC_DIR)/c-lib/libcasn1.a
27
28SSL_DIR = /usr/local
29SSL_INC = -I$(SSL_DIR)/include/openssl
30SSL_LIB = -lcrypto -L$(SSL_DIR)/lib
31
32LIBTOOL = $(LDAP_BUILD)/libtool
33CC = cc
34OPT = -pipe -O2 -isystem /usr/local/include -fno-strict-aliasing
35DEFS = -DLDAP_COMPONENT
36INCS = $(LDAP_INC) $(SNACC_INC) $(SSL_INC)
37LIBS = $(LDAP_LIB) $(SNACC_LIB) $(SSL_LIB)
38
39PROGRAMS = compmatch.la
40LTVER = 0:0:0
41
42prefix=/usr/local
43exec_prefix=$(prefix)
44ldap_subdir=/openldap
45
46libdir=$(exec_prefix)/lib
47libexecdir=$(exec_prefix)/libexec
48moduledir = $(libexecdir)$(ldap_subdir)
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
57compmatch.la: componentlib.lo init.lo certificate.lo asn_to_syn_mr.lo authorityKeyIdentifier.lo crl.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: $(PROGRAMS)
65	mkdir -p $(DESTDIR)$(moduledir)
66	for p in $(PROGRAMS) ; do \
67		$(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \
68	done
69
70