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