1 # $OpenLDAP$ 2 # Copyright 2015 Howard Chu <hyc (at] symas.com> 3 # All rights reserved. 4 # 5 # Redistribution and use in source and binary forms, with or without 6 # modification, are permitted only as authorized by the OpenLDAP 7 # Public License. 8 # 9 # A copy of this license is available in the file LICENSE in the 10 # top-level directory of the distribution or, alternatively, at 11 # <http://www.OpenLDAP.org/license.html>. 12 13 LDAP_SRC = ../../.. 14 LDAP_BUILD = $(LDAP_SRC) 15 LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd 16 LDAP_LIB = $(LDAP_BUILD)/libraries/libldap/libldap.la \ 17 $(LDAP_BUILD)/libraries/liblber/liblber.la 18 19 LIBTOOL = $(LDAP_BUILD)/libtool 20 INSTALL = /usr/bin/install 21 CC = gcc 22 OPT = -g -O2 23 DEFS = -DSLAPD_OVER_ADREMAP=SLAPD_MOD_DYNAMIC 24 INCS = $(LDAP_INC) 25 LIBS = $(LDAP_LIB) 26 27 PROGRAMS = adremap.la 28 MANPAGES = slapo-adremap.5 29 LTVER = 0:0:0 30 31 prefix=/usr/local 32 exec_prefix=$(prefix) 33 ldap_subdir=/openldap 34 35 libdir=$(exec_prefix)/lib 36 libexecdir=$(exec_prefix)/libexec 37 moduledir = $(libexecdir)$(ldap_subdir) 38 mandir = $(exec_prefix)/share/man 39 man5dir = $(mandir)/man5 40 41 .SUFFIXES: .c .o .lo 42 43 .c.lo: 44 $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(OPT) $(CPPFLAGS) $(DEFS) $(INCS) -c $< 45 46 all: $(PROGRAMS) 47 48 adremap.la: adremap.lo 49 $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -version-info $(LTVER) \ 50 -rpath $(moduledir) -module -o $@ $? $(LIBS) 51 52 clean: 53 rm -rf *.o *.lo *.la .libs 54 55 install: install-lib install-man FORCE 56 57 install-lib: $(PROGRAMS) 58 mkdir -p $(DESTDIR)$(moduledir) 59 for p in $(PROGRAMS) ; do \ 60 $(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \ 61 done 62 63 install-man: $(MANPAGES) 64 mkdir -p $(DESTDIR)$(man5dir) 65 $(INSTALL) -m 644 $(MANPAGES) $(DESTDIR)$(man5dir) 66 67 FORCE: 68 69