026f067403cd14b4bfe04ce6a5540ca0a87c59eb
[debian/amanda] / perl / Makefile.am
1 ##
2 ## Prepare for SWIGging
3 ## 
4
5 include $(top_srcdir)/config/automake/vars.am
6 include $(top_srcdir)/config/automake/scripts.am
7
8 # add the SWIG symbol to avoid conflicts with perl definitions.
9 # $AMANDA_WARNING_CFLAGS is omitted because SWIG-generated files tend
10 # to trigger warnings
11 AM_CFLAGS = -DSWIG
12
13 # Appropriate INCLUDES depends on which components (server or client) are 
14 # being built
15 INCLUDES =  \
16             -I$(top_builddir)/common-src \
17             -I$(top_srcdir)/common-src \
18             -I$(top_srcdir)/perl/amglue \
19             -I$(top_srcdir)/gnulib \
20             $(PERL_INC)
21
22 if WANT_SERVER
23 INCLUDES += -I$(top_srcdir)/device-src \
24             -I$(top_srcdir)/server-src
25 endif
26
27 if WANT_CLIENT
28 INCLUDES += -I$(top_srcdir)/client-src
29 endif
30
31 if WANT_RESTORE
32 INCLUDES += -I$(top_srcdir)/restore-src
33 endif
34
35 if WANT_RECOVER
36 INCLUDES += -I$(top_srcdir)/recover-src
37 endif
38
39 # (amplot has a conditional, but doesn't have any header files)
40
41 ##
42 ## libamglue -- helper functions for gluing amanda to perl
43 ##
44
45 amlib_LTLIBRARIES = libamglue.la
46 libamglue_la_SOURCES = \
47         amglue/ghashtable.c \
48         amglue/bigint.c \
49         amglue/amglue.h
50 libamglue_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
51 EXTRA_DIST += $(libamglue_la_SOURCES)
52
53 ##
54 ## HTML Generation
55 ##
56
57 # This isn't a very robust implementation, as it's only meant to make the HTML
58 # available online as part of the automated compilation process.  It assumes
59 # that all perl modules were built (not just server or client), and that the
60 # build directory does not contain any "junk".
61
62 # HTML_SOURCE_FILES should contain the .pm files from which the HTML should
63 # be geneated.  This is just the concatenation of foo_DATA for all $(foodir)
64 # into which perl modules are installed.
65 HTML_SOURCE_FILES=
66 html: make_html amperl.css $(HTML_SOURCE_FILES)
67         rm -rf html-tmp/ && mkdir html-tmp/
68         cp amperl.css html-tmp/
69         $(PERL) make_html html-tmp/ $(HTML_SOURCE_FILES)
70         cd html-tmp/ && tar -zcf $(abs_builddir)/html.tar.gz .
71         rm -rf html-tmp/
72 ##
73 ## SWIG-generated packages
74 ##
75
76 # Tell libtool to not bother versioning the libs we build, since perl won't
77 # pay attention to such things, anyway.
78 PERL_EXT_LDFLAGS = -avoid-version
79
80 # And add any flags the user has requested; on FreeBSD, this pulls in the 
81 # threading library
82 PERL_EXT_LDFLAGS += $(PERLEXTLIBS)
83
84 # list our SWIG libraries. 
85 AMGLUE_SWG = amglue/amglue.swg \
86         amglue/amglue.swg \
87         amglue/constants.swg \
88         amglue/dumpspecs.swg \
89         amglue/exports.swg \
90         amglue/glib.swg \
91         amglue/integers.swg
92 EXTRA_DIST += $(AMGLUE_SWG)
93
94 # SWIG OPTIONS:
95 # -perl5 -proxy: generate perl code, with proxy (shadow) classes
96 # -DSWIG_TYPE_TABLE: the name for the global type table; customized
97 #  to minimize type collisions with other SWIG-generated modules
98 # -I$(srcdir) use include files relative to this directory
99 SWIG_OPTIONS=-perl5 -proxy -DSWIG_TYPE_TABLE=SWIG_TYPES_Amanda -I$(srcdir)
100
101 # Suffix rules.  These are parallel-build compatible, but may cause
102 # strange behavior if there are other .c files in this directory.  The
103 # 'rm -f $@' is needed because SWIG sometimes fails to remove its output
104 # file in the event of a syntax error.  .i files are pre-processor output;
105 # they are only used during development.
106 %.c : %.swg $(AMGLUE_SWG)
107         $(mkdir_p) `dirname $@`
108         $(SWIG) $(SWIG_OPTIONS) -o $@ $(top_srcdir)/perl/$< || { rm -f $@; false; }
109 %.pm : %.c
110         @echo "$@ was produced as a side-effect of creating $<"
111 %.i : %.swg $(AMGLUE_SWG)
112         $(SWIG) $(SWIG_OPTIONS) -E $(top_srcdir)/perl/$< >$@
113
114 Amandadir=$(amperldir)/Amanda
115 Amanda_DATA =
116 HTML_SOURCE_FILES += $(Amanda_DATA)
117
118 if WANT_SERVER
119 # PACKAGE: Amanda::Device
120 libDevicedir = $(amperldir)/auto/Amanda/Device
121 libDevice_LTLIBRARIES = libDevice.la
122 libDevice_la_SOURCES = Amanda/Device.c $(AMGLUE_SWG)
123 libDevice_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
124 libDevice_la_LIBADD = libamglue.la \
125         $(top_builddir)/device-src/libamdevice.la \
126         $(top_builddir)/common-src/libamanda.la
127 Amanda_DATA += Amanda/Device.pm
128 EXTRA_DIST += Amanda/Device.swg Amanda/Device.pm
129 MAINTAINERCLEANFILES += Amanda/Device.c Amanda/Device.pm
130
131 # PACKAGE: Amanda::Logfile
132 libLogfiledir = $(amperldir)/auto/Amanda/Logfile
133 libLogfile_LTLIBRARIES = libLogfile.la
134 libLogfile_la_SOURCES = Amanda/Logfile.c $(AMGLUE_SWG)
135 libLogfile_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
136 libLogfile_la_LIBADD = libamglue.la \
137         $(top_builddir)/server-src/libamserver.la \
138         $(top_builddir)/common-src/libamanda.la
139 Amanda_DATA += Amanda/Logfile.pm
140 EXTRA_DIST += Amanda/Logfile.swg Amanda/Logfile.pm
141 MAINTAINERCLEANFILES += Amanda/Logfile.c Amanda/Logfile.pm
142
143 # PACKAGE: Amanda::Cmdline
144 libCmdlinedir = $(amperldir)/auto/Amanda/Cmdline
145 libCmdline_LTLIBRARIES = libCmdline.la
146 libCmdline_la_SOURCES = Amanda/Cmdline.c $(AMGLUE_SWG)
147 libCmdline_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
148 libCmdline_la_LIBADD = libamglue.la \
149         $(top_builddir)/server-src/libamserver.la \
150         $(top_builddir)/common-src/libamanda.la
151 Amanda_DATA += Amanda/Cmdline.pm
152 EXTRA_DIST += Amanda/Cmdline.swg Amanda/Cmdline.pm
153 MAINTAINERCLEANFILES += Amanda/Cmdline.c Amanda/Cmdline.pm
154
155 # PACKAGE: Amanda::Tapefile
156 libTapefiledir = $(amperldir)/auto/Amanda/Tapefile
157 libTapefile_LTLIBRARIES = libTapefile.la
158 libTapefile_la_SOURCES = Amanda/Tapefile.c $(AMGLUE_SWG)
159 libTapefile_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
160 libTapefile_la_LIBADD = libamglue.la \
161         $(top_builddir)/server-src/libamserver.la \
162         $(top_builddir)/common-src/libamanda.la
163 Amanda_DATA += Amanda/Tapefile.pm
164 EXTRA_DIST += Amanda/Tapefile.swg Amanda/Tapefile.pm
165 MAINTAINERCLEANFILES += Amanda/Tapefile.c Amanda/Tapefile.pm
166
167 # PACKAGE: Amanda::Changer
168 Amanda_DATA += Amanda/Changer.pm
169 EXTRA_DIST += Amanda/Changer.pm
170
171 endif
172
173 # PACKAGE: Amanda::Debug
174 libDebugdir = $(amperldir)/auto/Amanda/Debug
175 libDebug_LTLIBRARIES = libDebug.la
176 libDebug_la_SOURCES = Amanda/Debug.c $(AMGLUE_SWG)
177 libDebug_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
178 libDebug_la_LIBADD = libamglue.la \
179         $(top_builddir)/common-src/libamanda.la
180 Amanda_DATA += Amanda/Debug.pm
181 EXTRA_DIST += Amanda/Debug.swg Amanda/Debug.pm
182 MAINTAINERCLEANFILES += Amanda/Debug.c Amanda/Debug.pm
183
184 # PACKAGE: Amanda::Config
185 libConfigdir = $(amperldir)/auto/Amanda/Config
186 libConfig_LTLIBRARIES = libConfig.la
187 libConfig_la_SOURCES = Amanda/Config.c $(AMGLUE_SWG)
188 libConfig_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
189 libConfig_la_LIBADD = libamglue.la \
190         $(top_builddir)/common-src/libamanda.la
191 Amanda_DATA += Amanda/Config.pm
192 EXTRA_DIST += Amanda/Config.swg Amanda/Config.pm
193 MAINTAINERCLEANFILES += Amanda/Config.c Amanda/Config.pm
194
195 # PACKAGE: Amanda::Util
196 libUtildir = $(amperldir)/auto/Amanda/Util
197 libUtil_LTLIBRARIES = libUtil.la
198 libUtil_la_SOURCES = Amanda/Util.c $(AMGLUE_SWG)
199 libUtil_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
200 libUtil_la_LIBADD = libamglue.la \
201         $(top_builddir)/common-src/libamanda.la
202 Amanda_DATA += Amanda/Util.pm
203 EXTRA_DIST += Amanda/Util.swg Amanda/Util.pm
204 MAINTAINERCLEANFILES += Amanda/Util.c Amanda/Util.pm
205
206 # PACKAGE: Amanda::Types
207 libTypesdir = $(amperldir)/auto/Amanda/Types
208 libTypes_LTLIBRARIES = libTypes.la
209 libTypes_la_SOURCES = Amanda/Types.c $(AMGLUE_SWG)
210 libTypes_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
211 libTypes_la_LIBADD = libamglue.la \
212         $(top_builddir)/common-src/libamanda.la
213 Amanda_DATA += Amanda/Types.pm
214 EXTRA_DIST += Amanda/Types.swg Amanda/Types.pm
215 MAINTAINERCLEANFILES += Amanda/Types.c Amanda/Types.pm
216
217 # PACKAGE: Amanda::Paths
218 Amanda_DATA += Amanda/Paths.pm
219 EXTRA_DIST += Amanda/Paths.pm.in
220 DISTCLEANFILES += Amanda/Paths.pm
221
222 # perl doesn't use the cyg prefix and it doesn't search in the bin
223 # directory, dll must be copied to their modules directories.
224 if WANT_CYGWIN_COPY_PERL_DLL
225 amperldirauto="$(DESTDIR)$(amperldir)/auto/Amanda"
226 install-data-hook:
227         @for cygdll in $(amperldirauto)/bin/cyg*.dll; do \
228             destfname=`echo $$cygdll|sed 's!/bin/cyg\([^.]*\).dll!/\1/\1.dll!'`; \
229             cp "$$cygdll" "$$destfname"; \
230         done
231 endif