1# $OpenLDAP$ 2 3LDAP_SRC = ../../.. 4LDAP_BUILD = $(LDAP_SRC) 5LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd 6LDAP_LIB = $(LDAP_BUILD)/libraries/libldap/libldap.la \ 7 $(LDAP_BUILD)/libraries/liblber/liblber.la 8 9LIBTOOL = $(LDAP_BUILD)/libtool 10INSTALL = /usr/bin/install 11CC = gcc 12OPT = -g -O2 13DEFS = -DSLAPD_OVER_RBAC=SLAPD_MOD_DYNAMIC 14INCS = $(LDAP_INC) 15LIBS = $(LDAP_LIB) 16 17PROGRAMS = rbac.la 18MANPAGES = slapo-rbac.5 19 20LTVER = 0:0:0 21 22prefix=/usr/local 23exec_prefix=$(prefix) 24ldap_subdir=/openldap 25 26libdir=$(exec_prefix)/lib 27libexecdir=$(exec_prefix)/libexec 28moduledir = $(libexecdir)$(ldap_subdir) 29mandir = $(exec_prefix)/share/man 30man5dir = $(mandir)/man5 31 32SRCS = rbac.c rbacperm.c rbacsess.c rbacuser.c rbacreq.c rbacaudit.c init.c rbacacl.c util.c jts.c 33OBJS = $(patsubst %.c,%.o,$(SRCS)) 34LOBJS = $(patsubst %.c,%.lo,$(SRCS)) 35 36.SUFFIXES: .c .lo 37 38%.lo: %.c rbac.h 39 $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(OPT) $(CPPFLAGS) $(DEFS) $(INCS) -c $< 40 41all: $(PROGRAMS) 42 43rbac.la: $(LOBJS) 44 $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -version-info $(LTVER) \ 45 -rpath $(moduledir) -module -o $@ $^ $(LIBS) 46 47clean: 48 rm -rf *.o *.lo *.la .libs 49 50install: install-lib install-man FORCE 51 52install-lib: $(PROGRAMS) 53 mkdir -p $(DESTDIR)$(moduledir) 54 for p in $(PROGRAMS) ; do \ 55 $(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \ 56 done 57 58install-man: $(MANPAGES) 59 mkdir -p $(DESTDIR)$(man5dir) 60 $(INSTALL) -m 644 $(MANPAGES) $(DESTDIR)$(man5dir) 61 62FORCE: 63 64