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