1#
2# Copyright (C) 2000-2020 Kern Sibbald
3# License: BSD 2-Clause; see file LICENSE-FOSS
4#
5@MCOMMON@
6
7# Define library versions
8LIBBAC_LT_RELEASE = @LIBBAC_LT_RELEASE@
9LIBBACCFG_LT_RELEASE = @LIBBACCFG_LT_RELEASE@
10
11ZLIBS = @ZLIBS@
12DEBUG = @DEBUG@
13CAP_LIBS = @CAP_LIBS@
14
15#
16srcdir =	.
17VPATH = 	.
18.PATH:		.
19
20# one up
21basedir = ..
22# top dir
23topdir = ../..
24# this dir relative to top dir
25thisdir = src/lib
26
27first_rule: all
28dummy:
29
30#
31# include files installed when using libtool
32#
33INCLUDE_FILES = ../baconfig.h ../bacula.h ../bc_types.h \
34      ../config.h ../jcr.h ../version.h \
35      address_conf.h alist.h attr.h base64.h bsockcore.h \
36      berrno.h bits.h bjson.h bpipe.h breg.h bregex.h \
37      bsock.h bstat.h btime.h btimers.h crypto.h dlist.h \
38      flist.h fnmatch.h guid_to_name.h htable.h lex.h \
39      lib.h lz4.h md5.h mem_pool.h message.h \
40      openssl.h parse_conf.h plugins.h protos.h queue.h rblist.h \
41      runscript.h rwlock.h serial.h sellist.h sha1.h sha2.h \
42      smartall.h status.h tls.h tree.h var.h \
43      watchdog.h workq.h ini.h collect.h \
44      lockmgr.h devlock.h output.h bwlimit.h
45
46#
47# libbac
48#
49LIBBAC_SRCS = attr.c base64.c berrno.c bsys.c binflate.c bget_msg.c \
50      bnet.c bnet_server.c bsock.c bpipe.c bsnprintf.c bstat.c btime.c \
51      cram-md5.c crc32.c crypto.c daemon.c edit.c fnmatch.c \
52      guid_to_name.c hmac.c jcr.c lex.c lz4.c alist.c dlist.c \
53      md5.c message.c mem_pool.c openssl.c \
54      plugins.c priv.c queue.c bregex.c bsockcore.c \
55      runscript.c rwlock.c scan.c sellist.c serial.c sha1.c sha2.c \
56      signal.c smartall.c rblist.c tls.c tree.c \
57      util.c var.c watchdog.c workq.c btimers.c \
58      worker.c flist.c bcollector.c collect.c \
59      address_conf.c breg.c htable.c lockmgr.c devlock.c output.c bwlimit.c
60
61LIBBAC_OBJS = $(LIBBAC_SRCS:.c=.o)
62LIBBAC_LOBJS = $(LIBBAC_SRCS:.c=.lo)
63
64#
65# libbaccfg (config functions)
66#
67LIBBACCFG_SRCS = ini.c parse_conf.c res.c bjson.c
68LIBBACCFG_OBJS = $(LIBBACCFG_SRCS:.c=.o)
69LIBBACCFG_LOBJS = $(LIBBACCFG_SRCS:.c=.lo)
70
71.SUFFIXES:	.c .cc .o .lo .ch .dvi .pdf .tex .view .w .1
72.PHONY:
73.DONTCARE:
74
75# inference rules
76.c.o:
77	@echo "Compiling $<"
78	$(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
79
80.c.lo:
81	@echo "Compiling $<"
82	$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
83
84.cc.o:
85	@echo "Compiling $<"
86	$(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
87
88.cc.lo:
89	@echo "Compiling $<"
90	$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
91
92# specific build rules
93
94#-------------------------------------------------------------------------
95all: Makefile libbac$(DEFAULT_ARCHIVE_TYPE) libbaccfg$(DEFAULT_ARCHIVE_TYPE)
96	@echo "==== Make of lib is good ===="
97	@echo " "
98
99libbac.a: $(LIBBAC_OBJS)
100	@echo "Making $@ ..."
101	$(AR) rc  $@ $(LIBBAC_OBJS)
102	$(RANLIB) $@
103
104libbac.la: Makefile $(LIBBAC_LOBJS)
105	@echo "Making $@ ..."
106	$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(LIBBAC_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBAC_LT_RELEASE) $(WRAPLIBS) $(CAP_LIBS) $(ZLIBS) $(OPENSSL_LIBS) $(LIBS) $(DLLIBS)
107
108libbaccfg.a: $(LIBBACCFG_OBJS)
109	@echo "Making $@ ..."
110	$(AR) rc  $@ $(LIBBACCFG_OBJS)
111	$(RANLIB) $@
112
113libbaccfg.la: Makefile $(LIBBACCFG_LOBJS)
114	@echo "Making $@ ..."
115	$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(LIBBACCFG_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACCFG_LT_RELEASE) $(OPENSSL_LIBS) $(LIBS)
116
117Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
118	cd $(topdir) \
119	  && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
120
121wait_test: Makefile bsys.c
122	$(RMF) bsys.o
123	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) bsys.c
124	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -L../findlib -o $@ bsys.o $(DLIB) -lbac -lbacfind -lm $(LIBS) $(OPENSSL_LIBS)
125	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
126	$(RMF) bsys.o
127	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) bsys.c
128
129output_test: Makefile output.c unittests.o
130	$(RMF) output.o
131	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) output.c
132	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ output.o unittests.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
133	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
134	$(RMF) output.o
135	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) output.c
136
137lockmgr_test: Makefile libbac.la lockmgr.c unittests.o
138	$(RMF) lockmgr.o
139	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) lockmgr.c
140	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ lockmgr.o unittests.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
141	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
142	$(RMF) lockmgr.o
143	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) lockmgr.c
144
145base64_test: Makefile base64.c unittests.o
146	$(RMF) base64.o
147	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) base64.c
148	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ base64.o unittests.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
149	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
150	$(RMF) base64.o
151	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) base64.c
152
153flist_test: Makefile flist.c unittests.o
154	$(RMF) flist.o
155	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) flist.c
156	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ flist.o unittests.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
157	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
158	$(RMF) flist.o
159	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) flist.c
160
161fnmatch_test: Makefile fnmatch.c unittests.o
162	$(RMF) fnmatch.o
163	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) fnmatch.c
164	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ fnmatch.o unittests.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
165	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
166	$(RMF) fnmatch.o
167	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) fnmatch.c
168
169worker_test: Makefile worker.c
170	$(RMF) worker.o
171	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) worker.c
172	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ worker.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
173	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
174	$(RMF) worker.o
175	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) worker.c
176
177workq_test: Makefile workq.c
178	$(RMF) workq.o
179	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) workq.c
180	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ workq.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
181	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
182	$(RMF) workq.o
183	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) workq.c
184
185rwlock_test: Makefile rwlock.c
186	$(RMF) rwlock.o
187	$(CXX) -DTEST_RWLOCK $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) rwlock.c
188	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ rwlock.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
189	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
190	$(RMF) rwlock.o
191	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) rwlock.c
192
193devlock_test: Makefile
194	$(RMF) devlock.o
195	$(CXX) -DTEST_devlock $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) devlock.c
196	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ devlock.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
197	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
198	$(RMF) devlock.o
199	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) devlock.c
200
201htable_test: Makefile libbac.la htable.c unittests.o
202	$(RMF) htable.o
203	$(CXX) -DTEST_SMALL_HTABLE -DTEST_NON_CHAR -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)	$(CFLAGS) htable.c
204	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ htable.o unittests.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
205	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
206	$(RMF) htable.o
207	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) htable.c
208
209alist_test: Makefile alist.c unittests.o
210	$(RMF) alist.o
211	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) alist.c
212	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ alist.o unittests.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
213	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
214	$(RMF) alist.o
215	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) alist.c
216
217crc32_test: Makefile crc32.c unittests.o
218	$(RMF) crc32.o
219	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) crc32.c
220	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ crc32.o unittests.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
221	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
222	$(RMF) crc32.o
223	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) crc32.c
224
225sellist_test: Makefile libbac.la sellist.c unittests.o
226	$(RMF) sellist.o
227	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) sellist.c
228	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ sellist.o unittests.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
229	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
230	$(RMF) sellist.o
231	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) sellist.c
232
233xml_test: Makefile libbac.la xml.c
234	$(RMF) xml.o
235	$(CXX) -DTEST_PROG $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) xml.c
236	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ xml.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
237	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
238	$(RMF) xml.o
239	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) xml.c
240
241md5sum: Makefile libbac.la md5.c
242	$(RMF) md5.o
243	$(CXX) -DMD5_SUM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) md5.c
244	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ md5.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
245	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
246	$(RMF) md5.o
247	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) md5.c
248
249sha1sum: Makefile libbac.la sha1.c
250	$(RMF) sha1.o
251	$(CXX) -DSHA1_SUM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)	$(CFLAGS) sha1.c
252	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ sha1.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
253	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
254	$(RMF) sha1.o
255	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) sha1.c
256
257sha1_test: Makefile libbac.la sha1.c unittests.o
258	$(RMF) sha1.o
259	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) sha1.c
260	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ sha1.o unittests.o $(DLIB) -lbac -lm $(LIBS)
261	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
262	$(RMF) sha1.o
263	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) sha1.c
264
265bsnprintf_test: Makefile libbac.la bsnprintf.c unittests.o
266	$(RMF) bsnprintf.o
267	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) bsnprintf.c
268	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ bsnprintf.o unittests.o $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
269	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
270	$(RMF) bsnprintf.o
271	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) bsnprintf.c
272
273ini_test: Makefile libbac.la ini.c unittests.o
274	$(RMF) ini.o
275	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) ini.c
276	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ ini.o unittests.o -lbaccfg -lbac $(DLIB) -lm $(LIBS) $(OPENSSL_LIBS)
277	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
278	$(RMF) ini.o
279	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) ini.c
280
281bstat_test: Makefile libbac.la bstat.c unittests.o
282	$(RMF) bstat.o
283	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) bstat.c
284	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ bstat.o unittests.o $(DLIB) -lbac -lm $(LIBS)
285	$(RMF) bstat.o
286	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) bstat.c
287
288bsockcore_test: Makefile libbac.la bsockcore.c unittests.o
289	$(RMF) bsockcore.o
290	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) bsockcore.c
291	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ bsockcore.o unittests.o $(DLIB) -lbac -lm $(LIBS)
292	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
293	$(RMF) bsockcore.o
294	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) bsockcore.c
295
296bsock_test: Makefile libbac.la bsock.c unittests.o
297	$(RMF) bsock.o
298	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) bsock.c
299	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ bsock.o unittests.o $(DLIB) -lbac -lm $(LIBS)
300	$(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) $@ $(DESTDIR)$(sbindir)/
301	$(RMF) bsock.o
302	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) bsock.c
303
304collect_test: Makefile libbac.la collect.c unittests.o
305	$(RMF) collect.o
306	$(CXX) -DTEST_PROGRAM $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) collect.c
307	$(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -L. -o $@ collect.o unittests.o $(DLIB) -lbac -lm $(LIBS)
308	$(RMF) collect.o
309	$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) collect.c
310
311install-includes:
312	$(MKDIR) $(DESTDIR)/$(includedir)/bacula
313	for I in $(INCLUDE_FILES); do \
314	   $(INSTALL_DATA) $$I $(DESTDIR)$(includedir)/bacula/`basename $$I`; \
315	done
316
317uninstall-includes:
318	for I in $(INCLUDE_FILES); do \
319	   $(RMF) $(DESTDIR)$(includedir)/bacula/`basename $$I`; \
320	done
321
322libtool-install: all
323	$(MKDIR) $(DESTDIR)$(libdir)
324	$(RMF) $(DESTDIR)$(libdir)/libbac-*.so $(DESTDIR)$(libdir)/libbac.la
325	$(RMF) $(DESTDIR)$(libdir)/libbaccfg-*.so $(DESTDIR)$(libdir)/libbaccfg.la
326	$(RMF) $(DESTDIR)$(libdir)/libbacpy-*.so $(DESTDIR)$(libdir)/libbacpy.la
327	$(LIBTOOL_INSTALL_FINISH) $(INSTALL_LIB) libbac.la $(DESTDIR)$(libdir)
328	$(LIBTOOL_INSTALL_FINISH) $(INSTALL_LIB) libbaccfg.la $(DESTDIR)$(libdir)
329
330libtool-uninstall:
331	$(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(libdir)/libbac.la
332	$(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(libdir)/libbaccfg.la
333	$(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(libdir)/libbacpy.la
334
335install: @LIBTOOL_INSTALL_TARGET@ @INCLUDE_INSTALL_TARGET@
336
337uninstall: @LIBTOOL_UNINSTALL_TARGET@ @INCLUDE_UNINSTALL_TARGET@
338
339libtool-clean:
340	@find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF)
341	@$(RMF) *.la
342	@$(RMF) -r .libs _libs
343
344clean:	libtool-clean
345	@$(RMF) core a.out *.o *.bak *.tex *.pdf *~ *.intpro *.extpro 1 2 3
346	@$(RMF) rwlock_test md5sum sha1sum
347
348realclean: clean
349	@$(RMF) tags
350
351distclean: realclean
352	if test $(srcdir) = .; then $(MAKE) realclean; fi
353	(cd $(srcdir); $(RMF) Makefile)
354
355# Semi-automatic generation of dependencies:
356# Use gcc -M because X11 `makedepend' doesn't work on all systems
357# and it also includes system headers.
358# `semi'-automatic since dependencies are generated at distribution time.
359
360depend:
361	@$(MV) Makefile Makefile.bak
362	@$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
363	@$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile
364	@for src in $(LIBBAC_SRCS) $(LIBBACCFG_SRCS); do \
365	    $(CXX) -S -M -MT `basename $$src .c`$(DEFAULT_OBJECT_TYPE) $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $$src >> Makefile; \
366	done
367	@if test -f Makefile ; then \
368	    $(RMF) Makefile.bak; \
369	else \
370	   $(MV) Makefile.bak Makefile; \
371	   echo " ===== Something went wrong in make depend ====="; \
372	fi
373
374# -----------------------------------------------------------------------
375# DO NOT DELETE: nice dependency list follows
376