488b276f083af4d4014f17137e0d90b49e5387c7
[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 .sh:
124         cat $< > $@
125         chmod a+x $@
126
127 EXTRA_PROGRAMS = genversion $(TEST_PROGS)
128
129 # Version-building steps:
130 #
131 # 1. configure builds svn-info.h, if svn info is available; this
132 #    file is included in distribution tarballs
133 # 2. Makefile creates genversion.h with build-time information
134 # 3. Makefile builds genversion
135 # 4. Makefile runs genversion to create version.c
136 # 5. version.c is compiled into libamanda normally
137
138 genversion_SOURCES = genversion.c genversion.h svn-info.h
139 genversion_LDADD = $(libamanda_la_LIBADD)       \
140         versuff.lo                              \
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 = token file bsdsecurity amfeatures
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         debug.lo \
168         util.lo \
169         match.lo \
170         sl.lo
171
172 STANDARD_COMMON_STUFF = \
173         $(STANDARD_COMMON_STUFF_NOT_FILE) \
174         file.lo
175
176 token_SOURCES = token.test.c
177 token_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF)
178
179 file_SOURCES = file.test.c
180 file_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF_NOT_FILE)
181
182 bsdsecurity_SOURCES = bsd-security.test.c
183 bsdsecurity_LDADD = $(libamanda_a_LIBADD) \
184                     alloc.lo \
185                     clock.lo \
186                     debug.lo \
187                     dgram.lo \
188                     event.lo \
189                     file.lo \
190                     packet.lo \
191                     security.lo \
192                     ssh-security.lo \
193                     versuff.lo
194
195 amfeatures_SOURCES = amfeatures.test.c
196 amfeatures_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF)
197
198 # automake-style tests
199
200 TESTS = amflock-test
201 noinst_PROGRAMS = $(TESTS)
202
203 amflock_test_SOURCES = amflock-test.c
204 amflock_test_LDADD = libamanda.la
205
206 # scripts
207
208 # divide scripts up both by language and by destination directory.
209 sbin_SCRIPTS_PERL = \
210             amgpgcrypt \
211             amcryptsimple
212
213 sbin_SCRIPTS_SHELL = \
214             amcrypt \
215             amaespipe \
216             amcrypt-ossl \
217             amcrypt-ossl-asym
218
219 amlibexec_SCRIPTS_PERL = 
220
221 SCRIPTS_INCLUDE = \
222             amanda-sh-lib.sh
223
224 EXTRA_DIST += amanda-sh-lib.sh.in
225
226 CHECK_PERL = $(sbin_SCRIPTS_PERL) $(amlibexec_SCRIPTS_PERL)
227 SCRIPTS_PERL = $(CHECK_PERL)
228 SCRIPTS_SHELL = $(sbin_SCRIPTS_SHELL) $(amlibexec_SCRIPTS_SHELL)
229 amlibexec_DATA = $(SCRIPTS_INCLUDE)
230 amlibexec_SCRIPTS = $(amlibexec_SCRIPTS_PERL) $(amlibexec_SCRIPTS_SHELL)
231 sbin_SCRIPTS = $(sbin_SCRIPTS_PERL) $(sbin_SCRIPTS_SHELL)
232
233 # installation
234
235 INSTALLPERMS_data = dest=$(sbindir) chown=amanda $(sbin_SCRIPTS) \
236                     dest=$(amlibexecdir) chown=amanda $(amlibexec_SCRIPTS) $(amlibexec_DATA)
237
238 lint:
239         @echo $(LINT) $(libamanda_la_SOURCES)
240         @$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $(libamanda_la_SOURCES)
241         @echo $(LINT) $(genversion_SOURCES)
242         @$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $(genversion_SOURCES)
243
244 listlibsrc:
245         @ for p in $(libamanda_la_SOURCES) $(REGEXCSRC); do     \
246                 listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
247         done;                                                   \
248         echo $$listlibsrcs >listlibsrc.output
249
250 %.test.c: $(srcdir)/%.c
251         echo '#define TEST' >$@
252         echo '#include "$<"' >>$@