Merge pull request #2975 from octo/issue/2954
[collectd.git] / bindings / Makefile.am
1 SUBDIRS =
2
3 if BUILD_WITH_JAVA
4 SUBDIRS += java
5 endif
6
7 EXTRA_DIST = perl/Makefile.PL \
8              perl/uninstall_mod.pl \
9              perl/lib/Collectd.pm \
10              perl/lib/Collectd/Unixsock.pm \
11              perl/lib/Collectd/Plugins/Monitorus.pm \
12              perl/lib/Collectd/Plugins/OpenVZ.pm
13
14 CLEANFILES = \
15         buildperl/Collectd.pm \
16         buildperl/Collectd/Plugins/OpenVZ.pm \
17         buildperl/Collectd/Unixsock.pm \
18         buildperl/Makefile.PL \
19         .perl-directory-stamp
20
21 DISTCLEANFILES = \
22         buildperl/Collectd.pm \
23         buildperl/Collectd/Plugins/OpenVZ.pm \
24         buildperl/Collectd/Unixsock.pm \
25         buildperl/Makefile.PL \
26         .perl-directory-stamp
27
28 all-local: @PERL_BINDINGS@
29
30
31 install-exec-local:
32         [ ! -f buildperl/Makefile ] || ( cd buildperl && $(MAKE) install )
33
34 # Perl 'make uninstall' does not work as well as wanted.
35 # So we do the work here.
36 uninstall-local:
37         @PERL@ -I$(DESTDIR)$(prefix) $(srcdir)/perl/uninstall_mod.pl Collectd
38         find $(DESTDIR)$(prefix) -name "perllocal.pod" -exec rm {} \;
39
40 clean-local:
41         rm -rf buildperl
42
43 perl: buildperl/Makefile
44         cd buildperl && $(MAKE)
45
46 buildperl/Makefile: .perl-directory-stamp buildperl/Makefile.PL \
47         $(top_builddir)/config.status
48         @# beautify the output a bit
49         @echo 'cd buildperl && @PERL@ Makefile.PL @PERL_BINDINGS_OPTIONS@'
50         @cd buildperl && ( if ! @PERL@ Makefile.PL @PERL_BINDINGS_OPTIONS@; then \
51                         echo ""; \
52                         echo 'Check whether you have set $$PERL_MM_OPT in your environment and try using ./configure --with-perl-bindings=""'; \
53                         echo ""; \
54                 fi )
55
56 buildperl/Makefile.PL: .perl-directory-stamp $(top_builddir)/config.status
57
58 .perl-directory-stamp:
59         if test ! -d buildperl; then \
60           mkdir -p buildperl/Collectd/Plugins; \
61           cp $(srcdir)/perl/lib/Collectd.pm buildperl/; \
62           cp $(srcdir)/perl/Makefile.PL buildperl/; \
63           cp $(srcdir)/perl/lib/Collectd/Unixsock.pm buildperl/Collectd/; \
64           cp $(srcdir)/perl/lib/Collectd/Plugins/OpenVZ.pm buildperl/Collectd/Plugins/; \
65         fi
66         touch $@
67
68 .PHONY: perl
69