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