2 # Bacula Director Makefile
4 # Copyright (C) 2000-2015 Kern Sibbald
5 # License: BSD 2-Clause; see file LICENSE-FOSS
16 basedir = @BUILD_DIR@/src
19 # this dir relative to top dir
24 GETTEXT_LIBS = @LIBINTL@
32 SVRSRCS = dird.c admin.c authenticate.c \
33 autoprune.c backup.c bsr.c \
34 catreq.c dir_plugins.c dird_conf.c expand.c \
35 fd_cmds.c getmsg.c inc_conf.c job.c \
36 jobq.c mac.c mac_sql.c \
37 mountreq.c msgchan.c next_vol.c newvol.c \
38 recycle.c restore.c run_conf.c \
40 ua_acl.c ua_cmds.c ua_dotcmds.c \
42 ua_input.c ua_label.c ua_output.c ua_prune.c \
43 ua_purge.c ua_restore.c ua_run.c \
44 ua_select.c ua_server.c snapshot.c \
45 ua_status.c ua_tree.c ua_update.c vbackup.c verify.c
46 SVROBJS = $(SVRSRCS:.c=.o)
48 # these are the objects that are changed by the .configure process
58 $(NO_ECHO)$(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
59 #-------------------------------------------------------------------------
60 all: Makefile bacula-dir @STATIC_DIR@
61 @echo "==== Make of dird is good ===="
64 bacula-dir: Makefile $(SVROBJS) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) \
65 ../cats/libbacsql$(DEFAULT_ARCHIVE_TYPE) \
66 ../cats/libbaccats$(DEFAULT_ARCHIVE_TYPE) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE)
67 @echo "Linking $@ ..."
68 $(LIBTOOL_LINK) $(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -L../cats -L../findlib -o $@ $(SVROBJS) \
69 -lbacfind -lbacsql -lbaccats -lbaccfg -lbac -lm $(DLIB) $(DB_LIBS) $(LIBS) \
70 $(WRAPLIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) $(CAP_LIBS)
72 static-bacula-dir: Makefile $(SVROBJS) ../lib/libbac$(DEFAULT_ARCHIVE_TYPE) ../lib/libbaccfg$(DEFAULT_ARCHIVE_TYPE) \
73 ../cats/libbacsql$(DEFAULT_ARCHIVE_TYPE) \
74 ../cats/libbaccats$(DEFAULT_ARCHIVE_TYPE) ../findlib/libbacfind$(DEFAULT_ARCHIVE_TYPE)
75 $(LIBTOOL_LINK) $(CXX) $(WLDFLAGS) $(LDFLAGS) -static -L../lib -L../cats -L../findlib -o $@ $(SVROBJS) \
76 -lbacfind -lbacsql -lbaccats -lbaccfg -lbac -lm $(DLIB) $(DB_LIBS) $(LIBS) \
77 $(WRAPLIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS) $(CAP_LIBS)
80 Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
82 && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
85 @$(RMF) -r .libs _libs
88 @$(RMF) dird bacula-dir core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
89 @$(RMF) static-bacula-dir
92 @$(RMF) tags bacula-dir.conf
95 if test $(srcdir) = .; then $(MAKE) realclean; fi
96 (cd $(srcdir); $(RMF) Makefile)
99 if test $(srcdir) = .; then $(MAKE) realclean; fi
100 (cd $(srcdir); $(RMF) Makefile)
103 $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) bacula-dir $(DESTDIR)$(sbindir)/bacula-dir
104 @srcconf=bacula-dir.conf; \
105 if test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \
106 destconf=$$srcconf.new; \
107 echo " ==> Found existing $$srcconf, installing new conf file as $$destconf"; \
109 destconf=$$srcconf; \
111 echo "${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf"; \
112 ${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf
113 @if test "x${dir_group}" != "x"; then \
114 chgrp -f ${dir_group} ${DESTDIR}${sysconfdir}/$$destconf ; \
116 @if test -f ${DESTDIR}${scriptdir}/query.sql; then \
117 echo " ==> Saving existing query.sql to query.sql.old"; \
118 $(MV) -f ${DESTDIR}${scriptdir}/query.sql ${DESTDIR}${scriptdir}/query.sql.old; \
120 ${INSTALL_DATA} query.sql ${DESTDIR}${scriptdir}/query.sql
121 @if test -f static-bacula-dir; then \
122 $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) static-bacula-dir $(DESTDIR)$(sbindir)/static-bacula-dir; \
127 (cd $(DESTDIR)$(sysconfdir); $(RMF) bacula-dir.conf bacula-dir.conf.new)
128 (cd $(DESTDIR)$(scriptdir); $(RMF) query.sql)
132 # Semi-automatic generation of dependencies:
133 # Use gcc -MM because X11 `makedepend' doesn't work on all systems
134 # and it also includes system headers.
135 # `semi'-automatic since dependencies are generated at distribution time.
138 @$(MV) Makefile Makefile.bak
139 @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
140 @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile
141 @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) *.c >> Makefile
142 @if test -f Makefile ; then \
143 $(RMF) Makefile.bak; \
145 $(MV) Makefile.bak Makefile; \
146 echo " ===== Something went wrong in make depend ====="; \
149 # -----------------------------------------------------------------------
150 # DO NOT DELETE: nice dependency list follows