Imported Upstream version 2.6.0
[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 ## SWIG-generated packages
55 ##
56
57 # Tell libtool to not bother versioning the libs we build, since perl won't
58 # pay attention to such things, anyway.
59 PERL_EXT_LDFLAGS = -avoid-version
60
61 # And add any flags the user has requested; on FreeBSD, this pulls in the 
62 # threading library
63 PERL_EXT_LDFLAGS += $(PERLEXTLIBS)
64
65 # list our SWIG libraries. 
66 AMGLUE_SWG = amglue/amglue.swg \
67         amglue/amglue.swg \
68         amglue/constants.swg \
69         amglue/exports.swg \
70         amglue/glib.swg \
71         amglue/integers.swg
72 EXTRA_DIST += $(AMGLUE_SWG)
73
74 # SWIG OPTIONS:
75 # -perl5 -proxy: generate perl code, with proxy (shadow) classes
76 # -DSWIG_TYPE_TABLE: the name for the global type table; customized
77 #  to minimize type collisions with other SWIG-generated modules
78 # -I$(srcdir) use include files relative to this directory
79 SWIG_OPTIONS=-perl5 -proxy -DSWIG_TYPE_TABLE=SWIG_TYPES_Amanda -I$(srcdir)
80
81 # Suffix rules.  These are parallel-build compatible, but may cause
82 # strange behavior if there are other .c files in this directory.  The
83 # 'rm -f $@' is needed because SWIG sometimes fails to remove its output
84 # file in the event of a syntax error.  .i files are pre-processor output;
85 # they are only used during development.
86 %.c : %.swg $(AMGLUE_SWG)
87         $(mkdir_p) `dirname $@`
88         $(SWIG) $(SWIG_OPTIONS) -o $@ $(top_srcdir)/perl/$< || { rm -f $@; false; }
89 %.pm : %.c
90         @echo "$@ was produced as a side-effect of creating $<"
91 %.i : %.swg $(AMGLUE_SWG)
92         $(SWIG) $(SWIG_OPTIONS) -E $(top_srcdir)/perl/$< >$@
93
94 Amandadir=$(amperldir)/Amanda
95 Amanda_DATA =
96
97 if WANT_SERVER
98 # PACKAGE: Amanda::Device
99 libDevicedir = $(amperldir)/auto/Amanda/Device
100 libDevice_LTLIBRARIES = libDevice.la
101 libDevice_la_SOURCES = Amanda/Device.c $(AMGLUE_SWG)
102 libDevice_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
103 libDevice_la_LIBADD = libamglue.la \
104         $(top_builddir)/device-src/libamdevice.la \
105         $(top_builddir)/common-src/libamanda.la
106 Amanda_DATA += Amanda/Device.pm
107 EXTRA_DIST += Amanda/Device.swg Amanda/Device.pm
108 MAINTAINERCLEANFILES += Amanda/Device.c Amanda/Device.pm
109
110 # PACKAGE: Amanda::Logfile
111 libLogfiledir = $(amperldir)/auto/Amanda/Logfile
112 libLogfile_LTLIBRARIES = libLogfile.la
113 libLogfile_la_SOURCES = Amanda/Logfile.c $(AMGLUE_SWG)
114 libLogfile_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
115 libLogfile_la_LIBADD = libamglue.la \
116         $(top_builddir)/server-src/libamserver.la \
117         $(top_builddir)/common-src/libamanda.la
118 Amanda_DATA += Amanda/Logfile.pm
119 EXTRA_DIST += Amanda/Logfile.swg Amanda/Logfile.pm
120 MAINTAINERCLEANFILES += Amanda/Logfile.c Amanda/Logfile.pm
121
122 # PACKAGE: Amanda::Cmdline
123 libCmdlinedir = $(amperldir)/auto/Amanda/Cmdline
124 libCmdline_LTLIBRARIES = libCmdline.la
125 libCmdline_la_SOURCES = Amanda/Cmdline.c $(AMGLUE_SWG)
126 libCmdline_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
127 libCmdline_la_LIBADD = libamglue.la \
128         $(top_builddir)/server-src/libamserver.la \
129         $(top_builddir)/common-src/libamanda.la
130 Amanda_DATA += Amanda/Cmdline.pm
131 EXTRA_DIST += Amanda/Cmdline.swg Amanda/Cmdline.pm
132 MAINTAINERCLEANFILES += Amanda/Cmdline.c Amanda/Cmdline.pm
133
134 # PACKAGE: Amanda::Tapefile
135 libTapefiledir = $(amperldir)/auto/Amanda/Tapefile
136 libTapefile_LTLIBRARIES = libTapefile.la
137 libTapefile_la_SOURCES = Amanda/Tapefile.c $(AMGLUE_SWG)
138 libTapefile_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
139 libTapefile_la_LIBADD = libamglue.la \
140         $(top_builddir)/server-src/libamserver.la \
141         $(top_builddir)/common-src/libamanda.la
142 Amanda_DATA += Amanda/Tapefile.pm
143 EXTRA_DIST += Amanda/Tapefile.swg Amanda/Tapefile.pm
144 MAINTAINERCLEANFILES += Amanda/Tapefile.c Amanda/Tapefile.pm
145
146 # PACKAGE: Amanda::Changer
147 Amanda_DATA += Amanda/Changer.pm
148 EXTRA_DIST += Amanda/Changer.pm
149
150 endif
151
152 # PACKAGE: Amanda::Debug
153 libDebugdir = $(amperldir)/auto/Amanda/Debug
154 libDebug_LTLIBRARIES = libDebug.la
155 libDebug_la_SOURCES = Amanda/Debug.c $(AMGLUE_SWG)
156 libDebug_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
157 libDebug_la_LIBADD = libamglue.la \
158         $(top_builddir)/common-src/libamanda.la
159 Amanda_DATA += Amanda/Debug.pm
160 EXTRA_DIST += Amanda/Debug.swg Amanda/Debug.pm
161 MAINTAINERCLEANFILES += Amanda/Debug.c Amanda/Debug.pm
162
163 # PACKAGE: Amanda::Config
164 libConfigdir = $(amperldir)/auto/Amanda/Config
165 libConfig_LTLIBRARIES = libConfig.la
166 libConfig_la_SOURCES = Amanda/Config.c $(AMGLUE_SWG)
167 libConfig_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
168 libConfig_la_LIBADD = libamglue.la \
169         $(top_builddir)/common-src/libamanda.la
170 Amanda_DATA += Amanda/Config.pm
171 EXTRA_DIST += Amanda/Config.swg Amanda/Config.pm
172 MAINTAINERCLEANFILES += Amanda/Config.c Amanda/Config.pm
173
174 # PACKAGE: Amanda::Util
175 libUtildir = $(amperldir)/auto/Amanda/Util
176 libUtil_LTLIBRARIES = libUtil.la
177 libUtil_la_SOURCES = Amanda/Util.c $(AMGLUE_SWG)
178 libUtil_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
179 libUtil_la_LIBADD = libamglue.la \
180         $(top_builddir)/common-src/libamanda.la
181 Amanda_DATA += Amanda/Util.pm
182 EXTRA_DIST += Amanda/Util.swg Amanda/Util.pm
183 MAINTAINERCLEANFILES += Amanda/Util.c Amanda/Util.pm
184
185 # PACKAGE: Amanda::Types
186 libTypesdir = $(amperldir)/auto/Amanda/Types
187 libTypes_LTLIBRARIES = libTypes.la
188 libTypes_la_SOURCES = Amanda/Types.c $(AMGLUE_SWG)
189 libTypes_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
190 libTypes_la_LIBADD = libamglue.la \
191         $(top_builddir)/common-src/libamanda.la
192 Amanda_DATA += Amanda/Types.pm
193 EXTRA_DIST += Amanda/Types.swg Amanda/Types.pm
194 MAINTAINERCLEANFILES += Amanda/Types.c Amanda/Types.pm
195
196 # PACKAGE: Amanda::Paths
197 Amanda_DATA += Amanda/Paths.pm
198 EXTRA_DIST += Amanda/Paths.pm.in
199 DISTCLEANFILES += Amanda/Paths.pm
200
201 # perl doesn't use the cyg prefix and it doesn't search in the bin
202 # directory, dll must be copied to their modules directories.
203 if WANT_CYGWIN_COPY_PERL_DLL
204 amperldirauto="$(DESTDIR)$(amperldir)/auto/Amanda"
205 install-data-hook:
206         @for cygdll in $(amperldirauto)/bin/cyg*.dll; do \
207             destfname=`echo $$cygdll|sed 's!/bin/cyg\([^.]*\).dll!/\1/\1.dll!'`; \
208             cp "$$cygdll" "$$destfname"; \
209         done
210 endif