Imported Upstream version 3.2.0
[debian/amanda] / common-src / Makefile.am
1 # Makefile for Amanda library.
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_srcdir)/gnulib   
9
10 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
11 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
12
13 amlib_LTLIBRARIES =     libamanda.la
14
15 LINT=$(AMLINT)
16 LINTFLAGS=$(AMLINTFLAGS)
17
18 libamanda_la_SOURCES =          \
19         alloc.c                 \
20         amfeatures.c            \
21         amflock.c               \
22         ipc-binary.c            \
23         amxml.c                 \
24         clock.c                 \
25         columnar.c              \
26         conffile.c              \
27         debug.c                 \
28         dgram.c                 \
29         event.c                 \
30         file.c                  \
31         fileheader.c            \
32         glib-util.c             \
33         match.c                 \
34         packet.c                \
35         pipespawn.c             \
36         protocol.c              \
37         semaphore.c             \
38         security.c              \
39         security-util.c         \
40         simpleprng.c            \
41         sl.c                    \
42         sockaddr-util.c         \
43         stream.c                \
44         tapelist.c              \
45         timestamp.c             \
46         util.c
47 # version.c is generated; see below
48 nodist_libamanda_la_SOURCES = version.c
49
50 libamanda_la_LIBADD =           \
51         ../gnulib/libgnu.la
52
53 if WANT_AMFLOCK_POSIX
54 libamanda_la_SOURCES += amflock-posix.c
55 endif
56
57 if WANT_AMFLOCK_FLOCK
58 libamanda_la_SOURCES += amflock-flock.c
59 endif
60
61 if WANT_AMFLOCK_LOCKF
62 libamanda_la_SOURCES += amflock-lockf.c
63 endif
64
65 if WANT_AMFLOCK_LNLOCK
66 libamanda_la_SOURCES += amflock-lnlock.c
67 endif
68
69
70 if WANT_RSH_SECURITY
71 libamanda_la_SOURCES += rsh-security.c
72 endif
73 if WANT_SSH_SECURITY
74 libamanda_la_SOURCES += ssh-security.c
75 endif
76 if WANT_BSD_SECURITY
77 libamanda_la_SOURCES += bsd-security.c
78 endif
79 if WANT_BSDTCP_SECURITY
80 libamanda_la_SOURCES += bsdtcp-security.c
81 endif
82 if WANT_BSDUDP_SECURITY
83 libamanda_la_SOURCES += bsdudp-security.c
84 endif
85 if WANT_KRB5_SECURITY
86 libamanda_la_SOURCES += krb5-security.c
87 endif
88
89 libamanda_la_SOURCES += local-security.c
90
91 libamanda_la_LDFLAGS =  -release $(VERSION)
92
93 noinst_HEADERS =                \
94         amanda.h                \
95         amfeatures.h            \
96         ipc-binary.h            \
97         amxml.h                 \
98         arglist.h               \
99         clock.h                 \
100         columnar.h              \
101         directtcp.h             \
102         amflock.h               \
103         conffile.h              \
104         debug.h                 \
105         dgram.h                 \
106         event.h                 \
107         file.h                  \
108         fileheader.h            \
109         glib-util.h             \
110         match.h                 \
111         packet.h                \
112         pipespawn.h             \
113         protocol.h              \
114         semaphore.h             \
115         security.h              \
116         security-util.h         \
117         simpleprng.h            \
118         sl.h                    \
119         sockaddr-util.h         \
120         stream.h                \
121         tapelist.h              \
122         timestamp.h             \
123         util.h                  \
124         version.h
125
126 EXTRA_PROGRAMS = genversion $(TEST_PROGS)
127
128 # Version-building steps:
129 #
130 # 1. configure builds svn-info.h, if svn info is available; this
131 #    file is included in distribution tarballs
132 # 2. Makefile creates genversion.h with build-time information
133 # 3. Makefile builds genversion
134 # 4. Makefile runs genversion to create version.c
135 # 5. version.c is compiled into libamanda normally
136
137 genversion_SOURCES = genversion.c svn-info.h
138 genversion_LDADD = $(libamanda_la_LIBADD)       \
139         ../gnulib/libgnu.la
140
141 genversion.h: $(top_builddir)/config.status
142         -rm -f $@ $@.new
143         echo '#define CC "$(CC)"' > $@.new
144         echo '#define BUILT_DATE "'`date`'"' >> $@.new
145         echo '#define BUILT_MACH "$(target)"' >> $@.new
146         mv $@.new $@
147
148 version.c: genversion$(EXEEXT)
149         -rm -f version.c
150         ./genversion$(EXEEXT) > version.c
151
152 BUILT_SOURCES += genversion.h version.c
153
154 # these are used for testing only:
155 TEST_PROGS = file bsdsecurity
156
157 CLEANFILES += *.test.c
158 DISTCLEANFILES += version.c genversion genversion.h
159
160 # used for testing only
161
162 STANDARD_COMMON_STUFF_NOT_FILE = \
163         alloc.lo \
164         clock.lo \
165         conffile.lo \
166         debug.lo \
167         glib-util.lo \
168         util.lo \
169         match.lo \
170         sl.lo \
171         sockaddr-util.lo \
172         timestamp.lo
173
174 STANDARD_COMMON_STUFF = \
175         $(STANDARD_COMMON_STUFF_NOT_FILE) \
176         file.lo
177
178 file_SOURCES = file.test.c
179 file_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF_NOT_FILE)
180
181 bsdsecurity_SOURCES = bsd-security.test.c
182 bsdsecurity_LDADD = $(libamanda_a_LIBADD) \
183                     alloc.lo \
184                     clock.lo \
185                     debug.lo \
186                     dgram.lo \
187                     event.lo \
188                     file.lo \
189                     packet.lo \
190                     security.lo \
191                     ssh-security.lo
192
193 # libtestutils.la
194 #
195 # Convenience library (never installed) for 'make check'-based tests.
196
197 noinst_LTLIBRARIES = libtestutils.la
198 libtestutils_la_SOURCES = \
199         testutils.c \
200         testutils.h
201
202 # automake-style tests
203
204 # automake-style tests
205
206 TESTS = amflock-test event-test semaphore-test quoting-test \
207         ipc-binary-test hexencode-test fileheader-test match-test
208 noinst_PROGRAMS = $(TESTS)
209
210 amflock_test_SOURCES = amflock-test.c
211 amflock_test_LDADD = libamanda.la libtestutils.la
212
213 event_test_SOURCES = event-test.c
214 event_test_LDADD = libamanda.la libtestutils.la
215
216 semaphore_test_SOURCES = semaphore-test.c
217 semaphore_test_LDADD = libamanda.la libtestutils.la
218
219 quoting_test_SOURCES = quoting-test.c
220 quoting_test_LDADD = libamanda.la libtestutils.la
221
222 ipc_binary_test_SOURCES = ipc-binary-test.c
223 ipc_binary_test_LDADD = libamanda.la libtestutils.la
224
225 hexencode_test_SOURCES = hexencode-test.c
226 hexencode_test_LDADD = libamanda.la libtestutils.la
227
228 fileheader_test_SOURCES = fileheader-test.c
229 fileheader_test_LDADD = libamanda.la libtestutils.la
230
231 match_test_SOURCES = match-test.c
232 match_test_LDADD = libamanda.la libtestutils.la
233
234 # scripts
235
236 # divide scripts up both by language and destination directory
237 sbin_SCRIPTS_PERL = \
238             amgpgcrypt \
239             amcryptsimple \
240             amgetconf
241
242 amlibexec_SCRIPTS_PERL =
243
244 sbin_SCRIPTS_SHELL = \
245             amcrypt \
246             amaespipe \
247             amcrypt-ossl \
248             amcrypt-ossl-asym
249
250 amlibexec_SCRIPTS_SHELL = 
251
252 SCRIPTS_INCLUDE = \
253             amanda-sh-lib.sh
254
255 EXTRA_DIST += amanda-sh-lib.sh.in
256
257 SCRIPTS_PERL = $(sbin_SCRIPTS_PERL) $(amlibexec_SCRIPTS_PERL)
258 SCRIPTS_SHELL = $(sbin_SCRIPTS_SHELL) $(amlibexec_SCRIPTS_SHELL)
259
260 amlibexec_DATA = $(SCRIPTS_INCLUDE)
261 amlibexec_SCRIPTS = $(amlibexec_SCRIPTS_PERL) $(amlibexec_SCRIPTS_SHELL)
262 sbin_SCRIPTS = $(sbin_SCRIPTS_PERL) $(sbin_SCRIPTS_SHELL)
263
264 # installation
265
266 lint:
267         @echo $(LINT) $(libamanda_la_SOURCES)
268         @$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $(libamanda_la_SOURCES)
269         @echo $(LINT) $(genversion_SOURCES)
270         @$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $(genversion_SOURCES)
271
272 listlibsrc:
273         @ for p in $(libamanda_la_SOURCES) $(REGEXCSRC); do     \
274                 listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
275         done;                                                   \
276         echo $$listlibsrcs >listlibsrc.output
277
278 %.test.c: $(srcdir)/%.c
279         echo '#define TEST' >$@
280         echo '#include "$<"' >>$@
281
282 distclean-local:
283         if test `cd $(srcdir) && pwd` != `pwd`; then rm -f svn-info.h; fi
284 MAINTAINERCLEANFILES+=svn-info.h