Imported Upstream version 2.5.2p1
[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                 -I$(top_srcdir)/amandad-src  \
8                 -I$(top_srcdir)/gnulib
9
10 LINT=@AMLINT@
11 LINTFLAGS=@AMLINTFLAGS@
12
13 lib_LTLIBRARIES =       libamserver.la
14 LIB_EXTENSION = la
15
16 sbin_PROGRAMS =         amadmin         amcheck         amflush         \
17                         amgetconf       amlabel         amtape          \
18                         amreport
19
20 libexec_PROGRAMS =      amindexd        amlogroll       amtrmidx        \
21                         amtrmlog        driver          dumper          \
22                         planner         taper           amcleanupdisk   \
23                         chunker
24
25 sbin_SCRIPTS =          amcheckdb       amcleanup       amdump          \
26                         amoverview      amrmtape        amtoc           \
27                         amverify        amverifyrun     amstatus        \
28                         amcrypt         amaespipe       amcrypt-ossl    \
29                         amcrypt-ossl-asym
30
31 libamserver_la_SOURCES= amindex.c       changer.c                       \
32                         diskfile.c      driverio.c      cmdline.c  \
33                         holding.c       infofile.c      logfile.c       \
34                         tapefile.c      find.c          server_util.c   \
35                         taperscan.c
36
37 libamserver_la_LDFLAGS= -release $(VERSION)
38
39 ###
40 # Because libamanda includes routines (e.g. regex) provided by some system
41 # libraries, and because of the way libtool sets up the command line, we
42 # need to list libamanda twice here, first to override the system library
43 # routines, and second to pick up any references in the other libraries.
44 ###
45
46 LDADD = ../common-src/libamanda.$(LIB_EXTENSION)   \
47         libamserver.$(LIB_EXTENSION)               \
48         ../tape-src/libamtape.$(LIB_EXTENSION)     \
49         ../common-src/libamanda.$(LIB_EXTENSION)   \
50         ../tape-src/libamtape.$(LIB_EXTENSION)     \
51         ../common-src/libamanda.$(LIB_EXTENSION)   \
52         ../gnulib/libgnu.$(LIB_EXTENSION)          \
53         $(READLINE_LIBS)
54
55 amindexd_LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
56         libamserver.$(LIB_EXTENSION) \
57         ../amandad-src/libamandad.$(LIB_EXTENSION) \
58         ../tape-src/libamtape.$(LIB_EXTENSION) \
59         ../common-src/libamanda.$(LIB_EXTENSION) \
60         ../tape-src/libamtape.$(LIB_EXTENSION) \
61         ../common-src/libamanda.$(LIB_EXTENSION) \
62         ../gnulib/libgnu.$(LIB_EXTENSION)
63
64 SUFFIXES =              .sh .pl
65
66 .pl:
67                         cat $< > $@
68                         chmod a+x $@
69                         -test -z "$(PERL)" || $(PERL) -c -w -W -t -T $@
70
71 .sh:
72                         cat $< > $@
73                         chmod a+x $@
74
75 # there are used for testing only:
76 TEST_PROGS = diskfile infofile
77
78 EXTRA_PROGRAMS =        $(TEST_PROGS)
79
80 CLEANFILES = *.test.c $(sbin_SCRIPTS)
81
82 amindexd_CSRC =         amindexd.c      disk_history.c  list_dir.c
83 amindexd_SOURCES =      disk_history.h  list_dir.h      $(amindexd_CSRC)
84
85 amreport_SOURCES =      reporter.c
86
87 amgetconf_SOURCES =     getconf.c
88
89 noinst_HEADERS =        amindex.h       changer.h                       \
90                         diskfile.h      driverio.h      \
91                         holding.h       infofile.h      logfile.h       \
92                         tapefile.h      find.h          server_util.h   \
93                         taperscan.h cmdline.h
94
95 install-exec-hook:
96         @list="$(sbin_PROGRAMS) $(sbin_SCRIPTS)"; \
97         for p in $$list; do \
98                 pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
99                 echo chown $(BINARY_OWNER) $$pa; \
100                 chown $(BINARY_OWNER) $$pa; \
101                 echo chgrp $(SETUID_GROUP) $$pa; \
102                 chgrp $(SETUID_GROUP) $$pa; \
103         done
104         @list="$(libexec_PROGRAMS) $(libexec_SCRIPTS)"; \
105         for p in $$list; do \
106                 pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
107                 echo chown $(BINARY_OWNER) $$pa; \
108                 chown $(BINARY_OWNER) $$pa; \
109                 echo chgrp $(SETUID_GROUP) $$pa; \
110                 chgrp $(SETUID_GROUP) $$pa; \
111         done
112         @list="amcheck"; \
113         for p in $$list; do \
114                 if echo "$(sbin_PROGRAMS)" | grep $$p >/dev/null 2>&1; then \
115                         pa=$(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
116                         echo chown root $$pa; \
117                         chown root $$pa; \
118                         echo chmod u+s,o-rwx $$pa; \
119                         chmod u+s,o-rwx $$pa; \
120                 else true; \
121                 fi; \
122         done
123 ##                                                     ##
124 ## enterprise version will install dumper/planner suid ##
125 ##                                                     ##
126
127         @list="dumper planner"; \
128         for p in $$list; do \
129                 if echo "$(libexec_PROGRAMS)" | grep $$p >/dev/null 2>&1; then \
130                         pa=$(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \
131                         echo chown root $$pa; \
132                         chown root $$pa; \
133                         echo chmod u+s,o-rwx $$pa; \
134                         chmod u+s,o-rwx $$pa; \
135                 else true; \
136                 fi; \
137         done
138
139 lint:
140         @ for p in $(libexec_PROGRAMS) $(sbin_PROGRAMS); do                     \
141                 if [ $$p = "amindexd" ]; then                                   \
142                         s="$(amindexd_CSRC)";                                   \
143                 elif [ $$p = "amreport" ]; then                                 \
144                         s="$(amreport_SOURCES)";                                \
145                 elif [ $$p = "amgetconf" ]; then                                \
146                         s="$(getconf_SOURCES)";                                 \
147                 else                                                            \
148                         s=$$p.c;                                                \
149                 fi;                                                             \
150                 f="$$s $(libamserver_la_SOURCES)";                              \
151                 (cd ../common-src; make listlibsrc);                            \
152                 f="$$f "`cat ../common-src/listlibsrc.output`;                  \
153                 (cd ../tape-src; make listlibsrc);                              \
154                 f="$$f "`cat ../tape-src/listlibsrc.output`;                    \
155                 echo $(LINT) $$f;                                               \
156                 $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I../config        \
157                     $(INCLUDES) $$f;                                            \
158                 if [ $$? -ne 0 ]; then                                          \
159                     exit 1;                                                     \
160                 fi;                                                             \
161         done;                                                                   \
162         exit 0
163
164 listlibsrc:
165         @ for p in $(libamserver_la_SOURCES); do                \
166                 listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
167         done;                                                   \
168         echo $$listlibsrcs >listlibsrc.output
169
170
171 diskfile_SOURCES = diskfile.test.c
172 infofile_SOURCES = infofile.test.c
173
174 %.test.c: $(srcdir)/%.c
175         echo '#define TEST' >$@
176         echo '#include "$<"' >>$@