867e3e3f2cb2f13c6a80d0f81a4fa68bb69a785d
[debian/amanda] / server-src / Makefile.am
1 # Makefile for Amanda server programs.
2
3 include $(top_srcdir)/config/automake/vars.am
4 include $(top_srcdir)/config/automake/scripts.am
5 include $(top_srcdir)/config/automake/installperms.am
6 include $(top_srcdir)/config/automake/precompile.am
7
8 INCLUDES =      -I$(top_builddir)/common-src \
9                 -I$(top_srcdir)/common-src   \
10                 -I$(top_srcdir)/amandad-src  \
11                 -I$(top_srcdir)/device-src   \
12                 -I$(top_srcdir)/xfer-src   \
13                 -I$(top_srcdir)/gnulib
14
15 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
16 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
17
18 LINT=$(AMLINT)
19 LINTFLAGS=$(AMLINTFLAGS)
20
21 amlib_LTLIBRARIES =     libamserver.la
22
23 sbin_PROGRAMS =         amadmin         amcheck         \
24                         amflush         \
25                         amservice
26
27 amlibexec_PROGRAMS =    amindexd        amlogroll       amtrmidx        \
28                         amtrmlog        driver          dumper          \
29                         planner         amcleanupdisk   \
30                         chunker
31
32 amlibexec_SCRIPTS_PERL = \
33             taper \
34             amcheck-device
35
36 sbin_SCRIPTS_PERL = \
37             amaddclient \
38             amoverview \
39             amserverconfig \
40             amtoc \
41             amcheckdump \
42             amcleanup \
43             amrmtape \
44             amlabel \
45             amreport \
46             amtape \
47             amvault \
48             amstatus
49 if WANT_RESTORE
50 amlibexec_SCRIPTS_PERL += \
51             amidxtaped
52 sbin_SCRIPTS_PERL += \
53             amfetchdump \
54             amrestore
55 endif
56
57 sbin_SCRIPTS_SHELL = \
58             amcheckdb \
59             amdump
60
61 SCRIPTS_PERL = $(sbin_SCRIPTS_PERL) $(amlibexec_SCRIPTS_PERL)
62 SCRIPTS_SHELL = $(sbin_SCRIPTS_SHELL) $(amlibexec_SCRIPTS_SHELL)
63 sbin_SCRIPTS = $(sbin_SCRIPTS_PERL) $(sbin_SCRIPTS_SHELL)
64 amlibexec_SCRIPTS = $(amlibexec_SCRIPTS_PERL) $(amlibexec_SCRIPTS_SHELL)
65
66 INSTALLPERMS_exec = \
67         dest=$(sbindir) chown=amanda chmod= \
68                 $(sbin_PROGRAMS) \
69         chown=root chmod=04750 \
70                 amcheck amservice \
71         dest=$(amlibexecdir) chown=amanda chmod= \
72                 $(amlibexec_PROGRAMS) \
73                 $(amlibexec_SCRIPTS) \
74         chown=root chmod=04750 \
75                 dumper planner
76
77 INSTALLPERMS_data = \
78         dest=$(sbindir) chown=amanda chmod= \
79                 $(sbin_SCRIPTS) \
80         dest=$(amlibexecdir) chown=amanda chmod= \
81                 $(amlibexec_SCRIPTS)
82
83 ###
84 # Because libamanda includes routines (e.g. regex) provided by some system
85 # libraries, and because of the way libtool sets up the command line, we
86 # need to list libamanda twice here, first to override the system library
87 # routines, and second to pick up any references in the other libraries.
88 ###
89
90 LDADD = ../common-src/libamanda.la   \
91         libamserver.la               \
92         ../device-src/libamdevice.la     \
93         ../common-src/libamanda.la   \
94         $(READLINE_LIBS)
95
96 libamserver_la_SOURCES= amindex.c       \
97                         diskfile.c      driverio.c      cmdline.c  \
98                         holding.c       infofile.c      logfile.c       \
99                         tapefile.c      find.c          server_util.c   \
100                         xfer-source-holding.c
101
102 libamserver_la_LDFLAGS= -release $(VERSION)
103 libamserver_la_LIBADD= ../device-src/libamdevice.la \
104                        ../common-src/libamanda.la
105
106 amindexd_LDADD = $(LDADD) \
107         ../amandad-src/libamandad.la
108
109 # there are used for testing only:
110 TEST_PROGS = diskfile infofile
111
112 EXTRA_PROGRAMS =        $(TEST_PROGS)
113
114 CLEANFILES += *.test.c
115
116 amindexd_CSRC =         amindexd.c      disk_history.c  list_dir.c
117 amindexd_SOURCES =      disk_history.h  list_dir.h      $(amindexd_CSRC)
118
119 noinst_HEADERS =        amindex.h       cmdline.h       \
120                         diskfile.h      driverio.h      \
121                         holding.h       infofile.h      logfile.h       \
122                         tapefile.h      find.h          server_util.h   \
123                         xfer-server.h
124
125 lint:
126         @ for p in $(amlibexec_PROGRAMS) $(sbin_PROGRAMS); do                   \
127                 p=`basename $$p $(EXEEXT)`;                                     \
128                 if [ $$p = "amindexd" ]; then                                   \
129                         s="$(amindexd_CSRC)";                                   \
130                 else                                                            \
131                         s=$$p.c;                                                \
132                 fi;                                                             \
133                 f="$$s $(libamserver_la_SOURCES)";                              \
134                 (cd ../common-src; make listlibsrc);                            \
135                 f="$$f "`cat ../common-src/listlibsrc.output`;                  \
136                 echo $(LINT) $$f;                                               \
137                 $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config   \
138                     $(INCLUDES) $$f;                                            \
139                 if [ $$? -ne 0 ]; then                                          \
140                     exit 1;                                                     \
141                 fi;                                                             \
142         done;                                                                   \
143         exit 0
144
145 listlibsrc:
146         @ for p in $(libamserver_la_SOURCES); do                \
147                 listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
148         done;                                                   \
149         echo $$listlibsrcs >listlibsrc.output
150
151
152 diskfile_SOURCES = diskfile.test.c
153 infofile_SOURCES = infofile.test.c
154
155 %.test.c: $(srcdir)/%.c
156         echo '#define TEST' >$@
157         echo '#include "$<"' >>$@