build: Set TMPDIR for local testing.
[libguestfs.git] / ruby / Makefile.am
index 2b4b201..a2e962d 100644 (file)
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+include $(top_srcdir)/subdir-rules.mk
+
+generator_built = \
+       ext/guestfs/_guestfs.c \
+       bindtests.rb
+
 EXTRA_DIST = \
+       $(generator_built) \
        Rakefile.in \
-       ext/guestfs/_guestfs.c \
+       README.rdoc \
+       doc/site/index.html \
        ext/guestfs/extconf.rb \
        lib/guestfs.rb \
+       run-bindtests \
        run-ruby-tests \
        tests/tc_*.rb
 
-CLEANFILES = *~ \
+CLEANFILES = \
        lib/*~ \
        tests/*~ \
        ext/guestfs/*~ \
@@ -35,9 +44,24 @@ CLEANFILES = *~ \
 
 if HAVE_RUBY
 
-TESTS = run-ruby-tests
+TESTS = run-bindtests run-ruby-tests
 
-all:
+TESTS_ENVIRONMENT = \
+       LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
+       LIBGUESTFS_PATH=$(top_builddir)/appliance \
+       TMPDIR=$(top_builddir)
+
+all: $(generator_built)
        rake build
+       rake rdoc
+
+RUBY_SITELIB := $(shell ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
+RUBY_SITEARCH := $(shell ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")
+
+install:
+       $(MKDIR_P) $(DESTDIR)$(RUBY_SITELIB)
+       $(MKDIR_P) $(DESTDIR)$(RUBY_SITEARCH)
+       $(INSTALL) -p -m 0644 lib/guestfs.rb $(DESTDIR)$(RUBY_SITELIB)
+       $(INSTALL) -p -m 0755 ext/guestfs/_guestfs.so $(DESTDIR)$(RUBY_SITEARCH)
 
-endif
\ No newline at end of file
+endif