91a42a1159cf478454660984dc59f8fba5ae13a2
[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         clock.c                 \
23         columnar.c              \
24         conffile.c              \
25         debug.c                 \
26         dgram.c                 \
27         event.c                 \
28         file.c                  \
29         fileheader.c            \
30         glib-util.c             \
31         match.c                 \
32         packet.c                \
33         pipespawn.c             \
34         protocol.c              \
35         security.c              \
36         security-util.c         \
37         sl.c                    \
38         sockaddr-util.c         \
39         stream.c                \
40         tapelist.c              \
41         timestamp.c             \
42         token.c                 \
43         util.c                  \
44         versuff.c
45 # version.c is generated; see below
46 nodist_libamanda_la_SOURCES = version.c
47
48 libamanda_la_LIBADD =           \
49         ../gnulib/libgnu.la
50
51 if WANT_AMFLOCK_POSIX
52 libamanda_la_SOURCES += amflock-posix.c
53 endif
54
55 if WANT_AMFLOCK_FLOCK
56 libamanda_la_SOURCES += amflock-flock.c
57 endif
58
59 if WANT_AMFLOCK_LOCKF
60 libamanda_la_SOURCES += amflock-lockf.c
61 endif
62
63 if WANT_AMFLOCK_LNLOCK
64 libamanda_la_SOURCES += amflock-lnlock.c
65 endif
66
67
68 if WANT_RSH_SECURITY
69 libamanda_la_SOURCES += rsh-security.c
70 endif
71 if WANT_SSH_SECURITY
72 libamanda_la_SOURCES += ssh-security.c
73 endif
74 if WANT_BSD_SECURITY
75 libamanda_la_SOURCES += bsd-security.c
76 endif
77 if WANT_BSDTCP_SECURITY
78 libamanda_la_SOURCES += bsdtcp-security.c
79 endif
80 if WANT_BSDUDP_SECURITY
81 libamanda_la_SOURCES += bsdudp-security.c
82 endif
83 if WANT_KRB4_SECURITY
84 libamanda_la_SOURCES += krb4-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         arglist.h               \
98         clock.h                 \
99         columnar.h              \
100         amflock.h               \
101         conffile.h              \
102         debug.h                 \
103         dgram.h                 \
104         event.h                 \
105         file.h                  \
106         fileheader.h            \
107         glib-util.h             \
108         packet.h                \
109         pipespawn.h             \
110         protocol.h              \
111         queue.h                 \
112         security.h              \
113         security-util.h         \
114         sl.h                    \
115         sockaddr-util.h         \
116         stream.h                \
117         tapelist.h              \
118         timestamp.h             \
119         token.h                 \
120         util.h                  \
121         version.h
122
123 EXTRA_PROGRAMS = genversion $(TEST_PROGS)
124
125 # Version-building steps:
126 #
127 # 1. configure builds svn-info.h, if svn info is available; this
128 #    file is included in distribution tarballs
129 # 2. Makefile creates genversion.h with build-time information
130 # 3. Makefile builds genversion
131 # 4. Makefile runs genversion to create version.c
132 # 5. version.c is compiled into libamanda normally
133
134 genversion_SOURCES = genversion.c genversion.h svn-info.h
135 genversion_LDADD = $(libamanda_la_LIBADD)       \
136         versuff.lo                              \
137         ../gnulib/libgnu.la
138
139 genversion.h: $(top_builddir)/config.status
140         -rm -f $@ $@.new
141         echo '#define CC "$(CC)"' > $@.new
142         echo '#define BUILT_DATE "'`date`'"' >> $@.new
143         echo '#define BUILT_MACH "$(target)"' >> $@.new
144         mv $@.new $@
145
146 version.c: genversion$(EXEEXT)
147         -rm -f version.c
148         ./genversion$(EXEEXT) > version.c
149
150 BUILT_SOURCES += genversion.h version.c
151
152 # these are used for testing only:
153 TEST_PROGS = token file bsdsecurity amfeatures
154
155 CLEANFILES += *.test.c
156 DISTCLEANFILES += version.c genversion genversion.h
157
158 # used for testing only
159
160 STANDARD_COMMON_STUFF_NOT_FILE = \
161         alloc.lo \
162         clock.lo \
163         debug.lo \
164         util.lo \
165         match.lo \
166         sl.lo
167
168 STANDARD_COMMON_STUFF = \
169         $(STANDARD_COMMON_STUFF_NOT_FILE) \
170         file.lo
171
172 token_SOURCES = token.test.c
173 token_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF)
174
175 file_SOURCES = file.test.c
176 file_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF_NOT_FILE)
177
178 bsdsecurity_SOURCES = bsd-security.test.c
179 bsdsecurity_LDADD = $(libamanda_a_LIBADD) \
180                     alloc.lo \
181                     clock.lo \
182                     debug.lo \
183                     dgram.lo \
184                     event.lo \
185                     file.lo \
186                     packet.lo \
187                     security.lo \
188                     ssh-security.lo \
189                     versuff.lo
190
191 amfeatures_SOURCES = amfeatures.test.c
192 amfeatures_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF)
193
194 # automake-style tests
195
196 TESTS = amflock-test
197 noinst_PROGRAMS = $(TESTS)
198
199 amflock_test_SOURCES = amflock-test.c
200 amflock_test_LDADD = libamanda.la
201
202 # scripts
203
204 # divide scripts up both by language and by destination directory.
205 sbin_SCRIPTS_PERL = \
206             amgpgcrypt \
207             amcryptsimple
208
209 sbin_SCRIPTS_SHELL = \
210             amcrypt \
211             amaespipe \
212             amcrypt-ossl \
213             amcrypt-ossl-asym
214
215 amlibexec_SCRIPTS_PERL = 
216
217 SCRIPTS_INCLUDE = \
218             amanda-sh-lib.sh
219
220 EXTRA_DIST += amanda-sh-lib.sh.in
221
222 CHECK_PERL = $(sbin_SCRIPTS_PERL) $(amlibexec_SCRIPTS_PERL)
223 SCRIPTS_PERL = $(CHECK_PERL)
224 SCRIPTS_SHELL = $(sbin_SCRIPTS_SHELL) $(amlibexec_SCRIPTS_SHELL)
225 amlibexec_DATA = $(SCRIPTS_INCLUDE)
226 amlibexec_SCRIPTS = $(amlibexec_SCRIPTS_PERL) $(amlibexec_SCRIPTS_SHELL)
227 sbin_SCRIPTS = $(sbin_SCRIPTS_PERL) $(sbin_SCRIPTS_SHELL)
228
229 # installation
230
231 INSTALLPERMS_data = dest=$(sbindir) chown=amanda $(sbin_SCRIPTS) \
232                     dest=$(amlibexecdir) chown=amanda $(amlibexec_SCRIPTS) $(amlibexec_DATA)
233
234 lint:
235         @echo $(LINT) $(libamanda_la_SOURCES)
236         @$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $(libamanda_la_SOURCES)
237         @echo $(LINT) $(genversion_SOURCES)
238         @$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $(genversion_SOURCES)
239
240 listlibsrc:
241         @ for p in $(libamanda_la_SOURCES) $(REGEXCSRC); do     \
242                 listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
243         done;                                                   \
244         echo $$listlibsrcs >listlibsrc.output
245
246 %.test.c: $(srcdir)/%.c
247         echo '#define TEST' >$@
248         echo '#include "$<"' >>$@