e3c46c4c21700c1e6450a1813c576721f40a9dfb
[debian/amanda] / server-src / Makefile.am
1 # Makefile for Amanda server programs.
2
3 INCLUDES =      -I$(top_builddir)/common-src \
4                 -I$(top_srcdir)/common-src   \
5                 -I$(top_srcdir)/restore-src  \
6                 -I$(top_srcdir)/tape-src
7
8 lib_LTLIBRARIES =       libamserver.la
9 LIB_EXTENSION = la
10
11 sbin_PROGRAMS =         amadmin         amcheck         amflush         \
12                         amgetconf       amlabel         amtape          \
13                         amreport
14
15 libexec_PROGRAMS =      amindexd        amlogroll       amtrmidx        \
16                         amtrmlog        driver          dumper          \
17                         planner         taper           amcleanupdisk   \
18                         chunker
19
20 sbin_SCRIPTS =          amcheckdb       amcleanup       amdump          \
21                         amoverview      amrmtape        amtoc           \
22                         amverify        amverifyrun     amstatus        \
23                         amcrypt         amaespipe
24
25 libamserver_la_SOURCES= amindex.c       changer.c                       \
26                         conffile.c      diskfile.c      driverio.c      \
27                         holding.c       infofile.c      logfile.c       \
28                         tapefile.c      find.c          server_util.c   \
29                         taperscan.c
30
31 libamserver_la_LDFLAGS= -release $(VERSION)
32
33 ###
34 # Because libamanda includes routines (e.g. regex) provided by some system
35 # libraries, and because of the way libtool sets up the command line, we
36 # need to list libamanda twice here, first to override the system library
37 # routines, and second to pick up any references in the other libraries.
38 ###
39
40 LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
41         libamserver.$(LIB_EXTENSION) \
42         ../tape-src/libamtape.$(LIB_EXTENSION) \
43         ../common-src/libamanda.$(LIB_EXTENSION) \
44         ../tape-src/libamtape.$(LIB_EXTENSION) \
45         ../common-src/libamanda.$(LIB_EXTENSION)
46
47 SUFFIXES =              .sh .pl
48
49 .pl:
50                         cat $< > $@
51                         chmod a+x $@
52                         -test -z "$(PERL)" || $(PERL) -c $@
53
54 .sh:
55                         cat $< > $@
56                         chmod a+x $@
57
58 # there are used for testing only:
59 TEST_PROGS = diskfile conffile infofile
60
61 EXTRA_PROGRAMS =        $(TEST_PROGS)
62
63 CLEANFILES = *.test.c $(sbin_SCRIPTS)
64
65 amindexd_SOURCES =      amindexd.c                                      \
66                         disk_history.c                  disk_history.h  \
67                         list_dir.c                      list_dir.h
68
69 amreport_SOURCES =      reporter.c
70
71 amgetconf_SOURCES =     getconf.c
72
73 noinst_HEADERS =        amindex.h       changer.h                       \
74                         conffile.h      diskfile.h      driverio.h      \
75                         holding.h       infofile.h      logfile.h       \
76                         tapefile.h      find.h          server_util.h   \
77                         taperscan.h
78
79 install-exec-hook:
80         @list="$(sbin_PROGRAMS) $(sbin_SCRIPTS)"; \
81         for p in $$list; do \
82                 pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
83                 echo chown $(BINARY_OWNER) $$pa; \
84                 chown $(BINARY_OWNER) $$pa; \
85                 echo chgrp $(SETUID_GROUP) $$pa; \
86                 chgrp $(SETUID_GROUP) $$pa; \
87         done
88         @list="$(libexec_PROGRAMS) $(libexec_SCRIPTS)"; \
89         for p in $$list; do \
90                 pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
91                 echo chown $(BINARY_OWNER) $$pa; \
92                 chown $(BINARY_OWNER) $$pa; \
93                 echo chgrp $(SETUID_GROUP) $$pa; \
94                 chgrp $(SETUID_GROUP) $$pa; \
95         done
96         @list="amcheck"; \
97         for p in $$list; do \
98                 if echo "$(sbin_PROGRAMS)" | grep $$p >/dev/null 2>&1; then \
99                         pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
100                         echo chown root $$pa; \
101                         chown root $$pa; \
102                         echo chmod u+s,o-rwx $$pa; \
103                         chmod u+s,o-rwx $$pa; \
104                 else true; \
105                 fi; \
106         done
107 if !WANT_SSH_SECURITY
108         @list="dumper planner"; \
109         for p in $$list; do \
110                 if echo "$(libexec_PROGRAMS)" | grep $$p >/dev/null 2>&1; then \
111                         pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
112                         echo chown root $$pa; \
113                         chown root $$pa; \
114                         echo chmod u+s,o-rwx $$pa; \
115                         chmod u+s,o-rwx $$pa; \
116                 else true; \
117                 fi; \
118         done
119 endif
120
121 diskfile_SOURCES = diskfile.test.c
122 conffile_SOURCES = conffile.test.c
123 infofile_SOURCES = infofile.test.c
124
125 %.test.c: $(srcdir)/%.c
126         echo '#define TEST' >$@
127         echo '#include "$<"' >>$@