build system: Added some serious voodoo to make MakeMaker behave.
[liboping.git] / bindings / Makefile.am
index 2378c74..0c1c660 100644 (file)
@@ -2,7 +2,7 @@ EXTRA_DIST = perl/Changes perl/MANIFEST perl/META.yml perl/Makefile.PL \
                perl/Oping.xs perl/README perl/lib/Net/Oping.pm perl/t/Oping.t \
                perl/typemap
 
-all-local:
+all-local: @BINDINGS@
        [ ! -f perl/Makefile ] || ( cd perl && $(MAKE) all )
 
 install-exec-local:
@@ -19,6 +19,8 @@ perl: perl-bindings
 perl-bindings: perl/Makefile
        cd perl && $(MAKE)
 
+# Check if the `perl' directory exists in the _build_ directory. If not, copy
+# the files from the _source_ directory.
 perl/Makefile: perl/Makefile.PL $(top_builddir)/config.status
        if test ! -d perl; then \
                for file in $(EXTRA_DIST); do \
@@ -26,9 +28,7 @@ perl/Makefile: perl/Makefile.PL $(top_builddir)/config.status
                        cp $(srcdir)/$$file `dirname $$file`; \
                done \
        fi
-       
-       cd perl && @PERL@ Makefile.PL PREFIX=$(prefix) @PERL_BINDINGS_OPTIONS@
-
+       cd perl && @PERL@ Makefile.PL PREFIX="$(prefix)" TOP_BUILDDIR="$(top_builddir)" TARGET_LIBDIR="$(libdir)" @PERL_BINDINGS_OPTIONS@
 
 .PHONY: perl perl-bindings