xref: /netbsd-src/external/bsd/openldap/dist/servers/lloadd/Makefile_server.in (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
1# Makefile.in for Load Balancer
2# $OpenLDAP$
3## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4##
5## Copyright 1998-2021 The OpenLDAP Foundation.
6## All rights reserved.
7##
8## Redistribution and use in source and binary forms, with or without
9## modification, are permitted only as authorized by the OpenLDAP
10## Public License.
11##
12## A copy of this license is available in the file LICENSE in the
13## top-level directory of the distribution or, alternatively, at
14## <http://www.OpenLDAP.org/license.html>.
15
16PROGRAMS = lloadd
17XPROGRAMS = slloadd
18
19XSRCS	= version.c
20
21NT_SRCS = ../slapd/nt_svc.c
22NT_OBJS = ../slapd/nt_svc.o ../../libraries/liblutil/slapdmsg.res
23
24SRCS	+= main.c value.c \
25		  ../slapd/ch_malloc.c ../slapd/proxyp.c ../slapd/sl_malloc.c ../slapd/user.c
26
27OBJS	= $(patsubst %.c,%.o,$(SRCS)) $(@PLAT@_OBJS)
28
29BUILD_OPT = "--enable-balancer"
30BUILD_SRV = @BUILD_BALANCER@
31
32all-local-srv: 	$(PROGRAMS) all-cffiles
33
34# $(LTHREAD_LIBS) must be last!
35XLIBS = $(LLOADD_L)
36XXLIBS = $(LLOADD_LIBS) $(SECURITY_LIBS) $(LUTIL_LIBS) $(SYSTEMD_LIBS)
37XXXLIBS = $(LTHREAD_LIBS)
38
39NT_DEPENDS = slapd.exp
40NT_OBJECTS = slapd.exp symdummy.o $(LLOADD_OBJS) version.o
41
42UNIX_DEPENDS = version.o $(LLOADD_L)
43UNIX_OBJECTS = $(OBJS) version.o
44
45LLOADD_DEPENDS = $(@PLAT@_DEPENDS)
46LLOADD_OBJECTS = $(@PLAT@_OBJECTS)
47
48
49lloadd:	$(LLOADD_DEPENDS) version.o
50	$(LTLINK) -o $@ $(OBJS) version.o $(LIBS)
51
52slloadd:	version.o
53	$(LTLINK) -static -o $@ $(OBJS) version.o $(LIBS)
54
55version.c: Makefile
56	@-$(RM) $@
57	$(MKVERSION) -s -n Versionstr lloadd > $@
58
59version.o: version.c $(OBJS) $(LLOADD_L)
60
61all-cffiles:
62	@if test -n "$(systemdsystemunitdir)"; then \
63		$(SED) -e "s;%LIBEXECDIR%;$(libexecdir);" \
64			$(srcdir)/lloadd.service > lloadd.service.tmp ; \
65	fi
66	touch all-cffiles
67
68clean-local-srv: FORCE
69	$(RM) *.tmp all-cffiles
70
71install-local-srv: install-lloadd install-conf
72
73install-lloadd: FORCE
74	-$(MKDIR) $(DESTDIR)$(libexecdir)
75	@-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-lloadd
76	@(								\
77	    for prg in $(PROGRAMS); do					\
78		$(LTINSTALL) $(INSTALLFLAGS) $(STRIP_OPTS) -m 755 $$prg$(EXEEXT)	\
79		    $(DESTDIR)$(libexecdir);				\
80	    done							\
81	)
82
83install-conf: FORCE
84	@-$(MKDIR) $(DESTDIR)$(sysconfdir)
85	if test -n "$(systemdsystemunitdir)" && test ! -f $(DESTDIR)$(systemdsystemunitdir)/lloadd.service; then \
86		$(MKDIR) $(DESTDIR)$(systemdsystemunitdir); \
87		echo "installing lloadd.service in $(systemdsystemunitdir)"; \
88		echo "$(INSTALL) $(INSTALLFLAGS) -m 644 lloadd.service.tmp $(DESTDIR)$(systemdsystemunitdir)/lloadd.service"; \
89		$(INSTALL) $(INSTALLFLAGS) -m 644 lloadd.service.tmp $(DESTDIR)$(systemdsystemunitdir)/lloadd.service; \
90	fi
91