1 # $OpenLDAP$ 2 # This work is part of OpenLDAP Software <http://www.openldap.org/>. 3 # 4 # Copyright 1998-2024 The OpenLDAP Foundation. 5 # 6 # Redistribution and use in source and binary forms, with or without 7 # modification, are permitted only as authorized by the OpenLDAP 8 # Public License. 9 # 10 # A copy of this license is available in the file LICENSE in the 11 # top-level directory of the distribution or, alternatively, at 12 # <http://www.OpenLDAP.org/license.html>. 13 14 LDAP_SRC = ../../.. 15 LDAP_BUILD = $(LDAP_SRC) 16 SRCDIR = ./ 17 LDAP_INC = -I$(LDAP_BUILD)/include -I$(LDAP_SRC)/include -I$(LDAP_SRC)/servers/slapd 18 LDAP_LIB = $(LDAP_BUILD)/libraries/libldap/libldap.la \ 19 $(LDAP_BUILD)/libraries/liblber/liblber.la 20 21 PLAT = UNIX 22 NT_LIB = -L$(LDAP_BUILD)/servers/slapd -lslapd 23 NT_LDFLAGS = -no-undefined -avoid-version 24 UNIX_LDFLAGS = -version-info $(LTVER) 25 26 LIBTOOL = $(LDAP_BUILD)/libtool 27 INSTALL = /usr/bin/install 28 CC = gcc 29 OPT = -g -O2 30 DEFS = -DSLAPD_OVER_EDS=SLAPD_MOD_DYNAMIC 31 INCS = $(LDAP_INC) 32 LIBS = $($(PLAT)_LIB) $(LDAP_LIB) 33 LD_FLAGS = $(LDFLAGS) $($(PLAT)_LDFLAGS) -rpath $(moduledir) -module 34 35 PROGRAMS = emptyds.la 36 MANPAGES = slapo-emptyds.5 37 CLEAN = *.o *.lo *.la .libs 38 LTVER = 0:0:0 39 40 prefix=/usr/local 41 exec_prefix=$(prefix) 42 ldap_subdir=/openldap 43 44 libdir=$(exec_prefix)/lib 45 libexecdir=$(exec_prefix)/libexec 46 moduledir = $(libexecdir)$(ldap_subdir) 47 mandir = $(exec_prefix)/share/man 48 man5dir = $(mandir)/man5 49 50 all: $(PROGRAMS) 51 52 d := 53 sp := 54 dir := tests 55 include $(dir)/Rules.mk 56 57 .SUFFIXES: .c .o .lo 58 59 .c.lo: 60 $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(OPT) $(CPPFLAGS) $(DEFS) $(INCS) -c $< 61 62 all: $(PROGRAMS) 63 64 emptyds.la: emptyds.lo 65 $(LIBTOOL) --mode=link $(CC) $(LD_FLAGS) -o $@ $? $(LIBS) 66 67 clean: 68 rm -rf $(CLEAN) 69 70 install: install-lib install-man FORCE 71 72 install-lib: $(PROGRAMS) 73 mkdir -p $(DESTDIR)$(moduledir) 74 for p in $(PROGRAMS) ; do \ 75 $(LIBTOOL) --mode=install cp $$p $(DESTDIR)$(moduledir) ; \ 76 done 77 78 install-man: $(MANPAGES) 79 mkdir -p $(DESTDIR)$(man5dir) 80 $(INSTALL) -m 644 $(MANPAGES) $(DESTDIR)$(man5dir) 81 82 FORCE: 83 84