daemon: debug segv correct use of dereferencing NULL.
[libguestfs.git] / haskell / Makefile.am
index 1086ee9..5c1ff98 100644 (file)
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-EXTRA_DIST = *.hs
+include $(top_srcdir)/subdir-rules.mk
 
-CLEANFILES = *~
+generator_built = \
+       Guestfs.hs \
+       Bindtests.hs
+
+# $(generator_built) isn't redundant below as the wildcard rule won't match, and
+# therefore won't generate, the files if they haven't been created yet
+EXTRA_DIST = $(generator_built) *.hs run-bindtests
 
 if HAVE_HASKELL
 
 TESTS_ENVIRONMENT = \
        LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
        LIBGUESTFS_PATH=$(top_builddir)/appliance \
+       TMPDIR=$(top_builddir) \
        $(VG)
 
-TESTS = Guestfs005Load Guestfs010Launch Guestfs050LVCreate
+TESTS = run-bindtests Guestfs005Load Guestfs010Basic
+
+check_DATA = Bindtests
+
+GHCFLAGS = -I$(top_builddir)/src -L$(top_builddir)/src/.libs -i$(srcdir)
 
-GHCFLAGS = -I$(abs_top_builddir)/src -L$(abs_top_builddir)/src/.libs
+all_targets = Bindtests Guestfs005Load Guestfs010Basic
+$(all_targets): $(top_builddir)/src/libguestfs.la
 
-Guestfs005Load: Guestfs005Load.hs Guestfs.hs
+all: $(all_targets)
+
+Guestfs.o: $(srcdir)/Guestfs.hs
+       $(GHC)  $(GHCFLAGS) -c $< -o $@
+
+Bindtests: $(srcdir)/Bindtests.hs Guestfs.o
        $(GHC)  $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
 
-Guestfs010Launch: Guestfs010Launch.hs Guestfs.hs
+Guestfs005Load: $(srcdir)/Guestfs005Load.hs Guestfs.o
        $(GHC)  $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
 
-Guestfs050LVCreate: Guestfs050LVCreate.hs Guestfs.hs
+Guestfs010Basic: $(srcdir)/Guestfs010Basic.hs Guestfs.o
        $(GHC)  $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
 
-endif
\ No newline at end of file
+CLEANFILES = $(all_targets) *~ *.hi *.o
+
+endif