leave user backup in groups disk and tape on purge in case sys admin has
[debian/amanda] / server-src / Makefile.am
index 84c9b06c3a77d4fe50c8a2bb21e1294eded8b5cd..57363aefea9b2917d0e62e69a83e830730ff7490 100644 (file)
@@ -1,35 +1,71 @@
 # Makefile for Amanda server programs.
 
-###
-# Yes, I really mean ../common-src.  The genversion.h file ends up getting
-# built there rather than into the source tree.
-###
+include $(top_srcdir)/config/automake/vars.am
+include $(top_srcdir)/config/automake/scripts.am
+include $(top_srcdir)/config/automake/installperms.am
+include $(top_srcdir)/config/automake/precompile.am
 
-INCLUDES =             -I$(top_srcdir)/common-src \
-                       -I../common-src \
-                       -I$(top_srcdir)/tape-src
+INCLUDES =     -I$(top_builddir)/common-src \
+               -I$(top_srcdir)/common-src   \
+               -I$(top_srcdir)/restore-src  \
+               -I$(top_srcdir)/amandad-src  \
+               -I$(top_srcdir)/device-src   \
+               -I$(top_srcdir)/gnulib
 
-lib_LTLIBRARIES =      libamserver.la
-LIB_EXTENSION = la
+AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
+AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
 
-sbin_PROGRAMS =                amadmin         amcheck         amflush         \
-                       amgetconf       amlabel         amtape          \
-                       amreport
+LINT=$(AMLINT)
+LINTFLAGS=$(AMLINTFLAGS)
 
-libexec_PROGRAMS =     amindexd        amlogroll       amtrmidx        \
-                       amtrmlog        driver          dumper          \
-                       planner         taper           amcleanupdisk
+amlib_LTLIBRARIES =    libamserver.la
 
-sbin_SCRIPTS =         amcheckdb       amcleanup       amdump          \
-                       amoverview      amrmtape        amtoc           \
-                       amverify        amverifyrun     amstatus
+sbin_PROGRAMS =                amadmin         amcheck         \
+                       amflush         amlabel         \
+                       amservice       amtape          \
+                       amreport
 
-libamserver_la_SOURCES=        amindex.c       changer.c                       \
-                       conffile.c      diskfile.c      driverio.c      \
-                       holding.c       infofile.c      logfile.c       \
-                       tapefile.c      find.c          server_util.c
+noinst_PROGRAMS = taper_source_test
 
-libamserver_la_LDFLAGS= -release $(VERSION)
+amlibexec_PROGRAMS =   amindexd        amlogroll       amtrmidx        \
+                       amtrmlog        driver          dumper          \
+                       planner         taper           amcleanupdisk   \
+                       chunker
+
+# Exclude scripts which depend on perl extension modules from the syntax checks
+CHECK_PERL = \
+           amaddclient \
+           amoverview \
+           amserverconfig \
+           amtoc \
+           amdevcheck \
+           amcheckdump \
+           amcleanup \
+           amvault \
+           amstatus
+SCRIPTS_PERL = $(CHECK_PERL)
+SCRIPTS_SHELL = \
+           amcheckdb \
+           amdump \
+           amrmtape
+
+sbin_SCRIPTS = $(SCRIPTS_PERL) $(SCRIPTS_SHELL)
+
+INSTALLPERMS_exec = \
+       dest=$(sbindir) chown=amanda chmod= \
+               $(sbin_PROGRAMS) \
+       chown=root chmod=04750 \
+               amcheck amservice \
+       dest=$(amlibexecdir) chown=amanda chmod= \
+               $(amlibexec_PROGRAMS) \
+       chown=root chmod=04750 \
+               dumper planner
+
+INSTALLPERMS_data = \
+       dest=$(sbindir) chown=amanda chmod= \
+               $(sbin_SCRIPTS) \
+       dest=$(amlibexecdir) chown=amanda chmod= \
+               $(amlibexec_SCRIPTS)
 
 ###
 # Because libamanda includes routines (e.g. regex) provided by some system
@@ -38,86 +74,95 @@ libamserver_la_LDFLAGS= -release $(VERSION)
 # routines, and second to pick up any references in the other libraries.
 ###
 
-LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
-       libamserver.$(LIB_EXTENSION) \
-       ../tape-src/libamtape.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION)
+LDADD = ../common-src/libamanda.la   \
+       libamserver.la               \
+       ../device-src/libamdevice.la     \
+       ../common-src/libamanda.la   \
+        $(READLINE_LIBS)
 
-SUFFIXES =             .sh .pl
+libamserver_la_SOURCES=        amindex.c       changer.c                       \
+                       diskfile.c      driverio.c      cmdline.c  \
+                       holding.c       infofile.c      logfile.c       \
+                       tapefile.c      find.c          server_util.c   \
+                        taperscan.c
 
-.pl:
-                       cat $< > $@
-                       chmod a+x $@
-                       -test -z "$(PERL)" || $(PERL) -c $@
+libamserver_la_LDFLAGS= -release $(VERSION)
+libamserver_la_LIBADD= ../device-src/libamdevice.la \
+                      ../common-src/libamanda.la
 
-.sh:
-                       cat $< > $@
-                       chmod a+x $@
+taper_source_test_SOURCES = taper-source-test.c \
+                       taper-source.c \
+                       taper-file-source.c \
+                       taper-port-source.c \
+                       taper-disk-port-source.c \
+                       taper-mem-port-source.c
 
-# there are used for testing only:
-TEST_PROGS = diskfile conffile infofile
+taper_SOURCES =        taper.c \
+                       taper-source.c \
+                       taper-file-source.c \
+                       taper-port-source.c \
+                       taper-disk-port-source.c \
+                       taper-mem-port-source.c
 
-EXTRA_PROGRAMS = $(TEST_PROGS)
+taper_LDADD = $(LDADD) \
+       ../amandad-src/libamandad.la
 
-EXTRA_DIST = dumper-krb4.c
+taper_source_test_LDADD = $(LDADD) \
+       ../amandad-src/libamandad.la
 
-CLEANFILES = *.test.c
+amindexd_LDADD = $(LDADD) \
+       ../amandad-src/libamandad.la
 
-amindexd_SOURCES =     amindexd.c                                      \
-                       disk_history.c                  disk_history.h  \
-                       list_dir.c                      list_dir.h
+# there are used for testing only:
+TEST_PROGS = diskfile infofile
 
-amreport_SOURCES =     reporter.c
+EXTRA_PROGRAMS =       $(TEST_PROGS)
 
-amgetconf_SOURCES =    getconf.c
+CLEANFILES += *.test.c
 
-noinst_HEADERS =       amindex.h       changer.h                       \
-                       conffile.h      diskfile.h      driverio.h      \
+amindexd_CSRC =                amindexd.c      disk_history.c  list_dir.c
+amindexd_SOURCES =     disk_history.h  list_dir.h      $(amindexd_CSRC)
+
+amreport_SOURCES =     reporter.c
+
+noinst_HEADERS =       amindex.h       changer.h       cmdline.h       \
+                       diskfile.h      driverio.h      \
                        holding.h       infofile.h      logfile.h       \
-                       tapefile.h      find.h          server_util.h
-
-install-exec-hook:
-       @list="$(sbin_PROGRAMS) $(sbin_SCRIPTS)"; \
-       for p in $$list; do \
-               pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
-               echo chown $(BINARY_OWNER) $$pa; \
-               chown $(BINARY_OWNER) $$pa; \
-               echo chgrp $(SETUID_GROUP) $$pa; \
-               chgrp $(SETUID_GROUP) $$pa; \
-       done
-       @list="$(libexec_PROGRAMS) $(libexec_SCRIPTS)"; \
-       for p in $$list; do \
-               pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
-               echo chown $(BINARY_OWNER) $$pa; \
-               chown $(BINARY_OWNER) $$pa; \
-               echo chgrp $(SETUID_GROUP) $$pa; \
-               chgrp $(SETUID_GROUP) $$pa; \
-       done
-       @list="amcheck"; \
-       for p in $$list; do \
-               if echo "$(sbin_PROGRAMS)" | grep $$p >/dev/null 2>&1; then \
-                       pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
-                       echo chown root $$pa; \
-                       chown root $$pa; \
-                       echo chmod u+s,o-rwx $$pa; \
-                       chmod u+s,o-rwx $$pa; \
-               else true; \
-               fi; \
-       done
-       @list="dumper planner"; \
-       for p in $$list; do \
-               if echo "$(libexec_PROGRAMS)" | grep $$p >/dev/null 2>&1; then \
-                       pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
-                       echo chown root $$pa; \
-                       chown root $$pa; \
-                       echo chmod u+s,o-rwx $$pa; \
-                       chmod u+s,o-rwx $$pa; \
-               else true; \
-               fi; \
-       done
+                       tapefile.h      find.h          server_util.h   \
+                       taperscan.h taper-disk-port-source.h \
+                       taper-mem-port-source.h  taper-file-source.h \
+                       taper-port-source.h taper-source.h
+
+lint:
+       @ for p in $(amlibexec_PROGRAMS) $(sbin_PROGRAMS); do                   \
+               p=`basename $$p $(EXEEXT)`;                                     \
+               if [ $$p = "amindexd" ]; then                                   \
+                       s="$(amindexd_CSRC)";                                   \
+               elif [ $$p = "amreport" ]; then                                 \
+                       s="$(amreport_SOURCES)";                                \
+               else                                                            \
+                       s=$$p.c;                                                \
+               fi;                                                             \
+               f="$$s $(libamserver_la_SOURCES)";                              \
+               (cd ../common-src; make listlibsrc);                            \
+               f="$$f "`cat ../common-src/listlibsrc.output`;                  \
+               echo $(LINT) $$f;                                               \
+               $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config   \
+                   $(INCLUDES) $$f;                                            \
+               if [ $$? -ne 0 ]; then                                          \
+                   exit 1;                                                     \
+               fi;                                                             \
+       done;                                                                   \
+        exit 0
+
+listlibsrc:
+       @ for p in $(libamserver_la_SOURCES); do                \
+               listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
+       done;                                                   \
+       echo $$listlibsrcs >listlibsrc.output
+
 
 diskfile_SOURCES = diskfile.test.c
-conffile_SOURCES = conffile.test.c
 infofile_SOURCES = infofile.test.c
 
 %.test.c: $(srcdir)/%.c