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