1#
2# Copyright (C) 2000-2020 Kern Sibbald
3# License: BSD 2-Clause; see file LICENSE-FOSS
4#
5#  Find files library Makefile
6#
7@MCOMMON@
8
9srcdir =	.
10VPATH = 	.
11.PATH:		.
12
13# one up
14basedir = ..
15# top dir
16topdir = ../..
17# this dir relative to top dir
18thisdir = src/findlib
19
20DEBUG=@DEBUG@
21EXTRA_SRCS=@EXTRA_FINDLIB_SRCS@
22
23first_rule: all
24dummy:
25
26#
27# include files installed when using libtool
28#
29INCLUDE_FILES = bfile.h find.h protos.h win32filter.h
30
31#
32LIBBACFIND_SRCS = find.c match.c find_one.c attribs.c create_file.c \
33		  bfile.c drivetype.c enable_priv.c fstype.c mkpath.c \
34		  savecwd.c namedpipe.c win32filter.c $(EXTRA_SRCS)
35LIBBACFIND_OBJS = $(LIBBACFIND_SRCS:.c=.o)
36LIBBACFIND_LOBJS = $(LIBBACFIND_SRCS:.c=.lo)
37
38LIBBACFIND_LT_RELEASE = @LIBBACFIND_LT_RELEASE@
39
40.SUFFIXES:	.c .o .lo
41.PHONY:
42.DONTCARE:
43
44# inference rules
45.c.o:
46	@echo "Compiling $<"
47	$(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
48
49.c.lo:
50	@echo "Compiling $<"
51	$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
52#-------------------------------------------------------------------------
53all: Makefile libbacfind$(DEFAULT_ARCHIVE_TYPE) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE)
54	@echo "==== Make of findlib is good ===="
55	@echo " "
56
57libbacfind.a: $(LIBBACFIND_OBJS)
58	@echo "Making $@ ..."
59	$(AR) rc  $@ $(LIBBACFIND_OBJS)
60	$(RANLIB) $@
61
62libbacfind.la: Makefile $(LIBBACFIND_LOBJS)
63	@echo "Making $@ ..."
64	$(LIBTOOL_LINK) $(CXX) $(DEFS) $(DEBUG) $(LDFLAGS) -o $@ $(LIBBACFIND_LOBJS) -export-dynamic -rpath $(libdir) -release $(LIBBACFIND_LT_RELEASE)
65
66Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
67	cd $(topdir) \
68	  && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
69
70install-includes:
71	$(MKDIR) $(DESTDIR)/$(includedir)/bacula/findlib
72	for I in $(INCLUDE_FILES); do \
73	   $(INSTALL_DATA) $$I $(DESTDIR)$(includedir)/bacula/findlib/`basename $$I`; \
74	done
75
76uninstall-includes:
77	for I in $(INCLUDE_FILES); do \
78	   $(RMF) $(DESTDIR)$(includedir)/bacula/findlib/`basename $$I`; \
79	done
80
81libtool-install: all
82	$(MKDIR) $(DESTDIR)$(libdir)
83	$(RMF) $(DESTDIR)$(libdir)/libbacfind-*.so $(DESTDIR)$(libdir)/libbacfind.la
84	$(LIBTOOL_INSTALL_FINISH) $(INSTALL_LIB) libbacfind$(DEFAULT_ARCHIVE_TYPE) $(DESTDIR)$(libdir)
85
86libtool-uninstall:
87	$(LIBTOOL_UNINSTALL) $(RMF) $(DESTDIR)$(libdir)/libbacfind.la
88
89install: @LIBTOOL_INSTALL_TARGET@ @INCLUDE_INSTALL_TARGET@
90
91uninstall: @LIBTOOL_UNINSTALL_TARGET@ @INCLUDE_UNINSTALL_TARGET@
92
93libtool-clean:
94	@find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF)
95	@$(RMF) *.la
96	@$(RMF) -r .libs _libs
97
98clean:	libtool-clean
99	@$(RMF) find core a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
100
101realclean: clean
102	@$(RMF) tags
103
104distclean: realclean
105	if test $(srcdir) = .; then $(MAKE) realclean; fi
106	(cd $(srcdir); $(RMF) Makefile)
107
108devclean: realclean
109	if test $(srcdir) = .; then $(MAKE) realclean; fi
110	(cd $(srcdir); $(RMF) Makefile)
111
112# Semi-automatic generation of dependencies:
113# Use gcc -M  because X11 `makedepend' doesn't work on all systems
114# and it also includes system headers.
115# `semi'-automatic since dependencies are generated at distribution time.
116
117depend:
118	@$(MV) Makefile Makefile.bak
119	@$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
120	@$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile
121	@for src in $(LIBBACFIND_SRCS); do \
122	    $(CXX) -S -M -MT `basename $$src .c`$(DEFAULT_OBJECT_TYPE) $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $$src >> Makefile; \
123	done
124	@if test -f Makefile ; then \
125	    $(RMF) Makefile.bak; \
126	else \
127	   $(MV) Makefile.bak Makefile; \
128	   echo " ===== Something went wrong in make depend ====="; \
129	fi
130
131# -----------------------------------------------------------------------
132# DO NOT DELETE: nice dependency list follows
133