1 # $OpenLDAP$ 2 # Copyright 2007 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 PLAT = UNIX 20 NT_LIB = -L$(LDAP_BUILD)/servers/slapd -lslapd 21 NT_LDFLAGS = -no-undefined -avoid-version 22 UNIX_LDFLAGS = -version-info $(LTVER) 23 24 LIBTOOL = $(LDAP_BUILD)/libtool 25 INSTALL = /usr/bin/install 26 CC = gcc 27 OPT = -g -O2 28 DEFS = 29 INCS = $(LDAP_INC) 30 LIBS = $($(PLAT)_LIB) $(LDAP_LIB) 31 LD_FLAGS = $(LDFLAGS) $($(PLAT)_LDFLAGS) -rpath $(moduledir) -module 32 33 PROGRAMS = autogroup.la 34 MANPAGES = slapo-autogroup.5 35 LTVER = 0:0:0 36 37 prefix=/usr/local 38 exec_prefix=$(prefix) 39 ldap_subdir=/openldap 40 41 libdir=$(exec_prefix)/lib 42 libexecdir=$(exec_prefix)/libexec 43 moduledir = $(libexecdir)$(ldap_subdir) 44 mandir = $(exec_prefix)/share/man 45 man5dir = $(mandir)/man5 46 47 .SUFFIXES: .c .o .lo 48 49 .c.lo: 50 $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(OPT) $(CPPFLAGS) $(DEFS) $(INCS) -c $< 51 52 all: $(PROGRAMS) 53 54 autogroup.la: autogroup.lo 55 $(LIBTOOL) --mode=link $(CC) $(LD_FLAGS) -o $@ $? $(LIBS) 56 57 clean: 58 rm -rf *.o *.lo *.la .libs 59 60 install: install-lib install-man FORCE 61 62 install-lib: $(PROGRAMS) 63 mkdir -p $(DESTDIR)$(moduledir) 64 for p in $(PROGRAMS) ; do \ 65 $(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \ 66 done 67 68 install-man: 69 mkdir -p $(DESTDIR)$(man5dir) 70 $(INSTALL) -m 644 $(MANPAGES) $(DESTDIR)$(man5dir) 71 72 FORCE: 73 74