Ignore warning 3 about String.set (for OCaml 4.02).
[guestfs-browser.git] / Makefile.am
index d76c28a..1949724 100644 (file)
@@ -21,6 +21,7 @@ EXTRA_DIST = \
        $(SOURCES) \
        HACKING \
        Throbber.png Throbber.gif \
+       config.ml.in \
        .gitignore \
        guestfs-browser.pod \
        guestfs-browser.1 \
@@ -40,18 +41,41 @@ SOURCES = \
        cmdline.mli \
        cmdline.ml \
        config.mli \
-       config.ml \
        deviceSet.mli \
        deviceSet.ml \
        filetree.mli \
        filetree.ml \
        filetree_markup.mli \
        filetree_markup.ml \
-       filetree_ops.mli \
-       filetree_ops.ml \
-       filetree_type.mli \
-       filetree_type.ml \
        main.ml \
+       menu_about.mli \
+       menu_about.ml \
+       menu_open_disk.mli \
+       menu_open_disk.ml \
+       menu_open_uri.mli \
+       menu_open_uri.ml \
+       op_checksum_file.mli \
+       op_checksum_file.ml \
+       op_copy_regvalue.mli \
+       op_copy_regvalue.ml \
+       op_disk_usage.mli \
+       op_disk_usage.ml \
+       op_download_as_reg.mli \
+       op_download_as_reg.ml \
+       op_download_dir_find0.mli \
+       op_download_dir_find0.ml \
+       op_download_dir_tarball.mli \
+       op_download_dir_tarball.ml \
+       op_download_file.mli \
+       op_download_file.ml \
+       op_file_information.mli \
+       op_file_information.ml \
+       op_file_properties.mli \
+       op_file_properties.ml \
+       op_inspection_dialog.mli \
+       op_inspection_dialog.ml \
+       op_view_file.mli \
+       op_view_file.ml \
        slave.mli \
        slave.ml \
        slave_types.mli \
@@ -64,45 +88,70 @@ SOURCES = \
        window.mli \
        window.ml
 
+BUILT_SOURCES = \
+       config.ml
+
 # Note this list must be in dependency order.
 OBJECTS = \
-       config.cmx \
-       throbber.cmx \
-       utils.cmx \
-       cmdline.cmx \
-       deviceSet.cmx \
-       slave_types.cmx \
-       slave_utils.cmx \
-       slave.cmx \
-       filetree_type.cmx \
-       filetree_markup.cmx \
-       filetree_ops.cmx \
-       filetree.cmx \
-       window.cmx \
-       main.cmx
+       config.cmo \
+       throbber.cmo \
+       utils.cmo \
+       cmdline.cmo \
+       deviceSet.cmo \
+       slave_types.cmo \
+       slave_utils.cmo \
+       slave.cmo \
+       filetree_markup.cmo \
+       filetree.cmo \
+       op_checksum_file.cmo \
+       op_copy_regvalue.cmo \
+       op_disk_usage.cmo \
+       op_download_as_reg.cmo \
+       op_download_dir_find0.cmo \
+       op_download_dir_tarball.cmo \
+       op_download_file.cmo \
+       op_file_information.cmo \
+       op_file_properties.cmo \
+       op_inspection_dialog.cmo \
+       op_view_file.cmo \
+       window.cmo \
+       menu_open_uri.cmo \
+       menu_open_disk.cmo \
+       menu_about.cmo \
+       main.cmo
+
+XOBJECTS = $(OBJECTS:.cmo=.cmx)
 
 bin_SCRIPTS = guestfs-browser
 
 OCAMLPACKAGES = \
-       -package libvirt,guestfs,hivex,lablgtk2,extlib,xml-light,camomile,threads,bitstring,bitstring.syntax -syntax bitstring
+       -package libvirt,guestfs,hivex,lablgtk2,lablgtk2.auto-init,extlib,xml-light,calendar,camomile,threads,bitstring,bitstring.syntax -syntax bitstring
 OCAMLCFLAGS = \
        -g \
-       -warn-error CDEFLMPSUVYZX \
+       -warn-error CDEFLMPSUVYZX-3 \
        -thread \
        $(OCAMLPACKAGES) \
        -predicates threads
-OCAMLOPTFLAGS = $(OCAMLCFLAGS)
+OCAMLOPTFLAGS = \
+       -ccopt -g \
+       $(OCAMLCFLAGS)
 OCAMLDOCFLAGS = \
        $(OCAMLPACKAGES) \
        -predicates threads \
        -I +threads \
        -sort -html
 
-guestfs-browser: $(OBJECTS)
+if HAVE_OCAMLOPT
+guestfs-browser: $(XOBJECTS)
        $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) \
-         -predicates init,threads \
-         -linkpkg gtkThread.cmx \
+         -linkpkg \
+         $^ -o $@
+else
+guestfs-browser: $(OBJECTS)
+       $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
+         -linkpkg \
          $^ -o $@
+endif
 
 # This file is built.  However gdk_pixbuf_mlsource requires X11 to
 # run, which prevents this from being built in places where an X
@@ -129,11 +178,25 @@ icon_DATA = guestfs-browser.svg guestfs-browser-large.png guestfs-browser.png
 desktopdir = $(datadir)/applications
 desktop_DATA = guestfs-browser.desktop
 
-guestfs-browser.desktop: guestfs-browser.desktop.in
-       $(SED) "s,\@icondir\@,$(icondir),g" < $< > $@
+guestfs-browser.desktop: guestfs-browser.desktop.in Makefile
+       $(SED) "s,\@icondir\@,$(icondir),g" < $< > $@-t
+       mv $@-t $@
 
 TESTS += test-desktop-file-validate.sh
 
+# Config.  Can't use autoconf to build this because we want
+# to embed the true icondir path.
+config.ml: config.ml.in Makefile
+       < $< \
+       $(SED) \
+         -e "s,\@PACKAGE_NAME\@,$(PACKAGE_NAME),g" \
+         -e "s,\@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g" \
+         -e "s,\@HIVEXREGEDIT\@,$(HIVEXREGEDIT),g" \
+         -e "s,\@OPENER\@,$(OPENER),g" \
+         -e "s,\@icondir\@,$(icondir),g" \
+         > $@-t
+       mv $@-t $@
+
 # Man page.
 man_MANS = guestfs-browser.1
 
@@ -180,12 +243,16 @@ docs:
 depend: .depend
 
 .depend: $(wildcard *.mli) $(wildcard *.ml)
-       rm -f $@ $@-t
        $(OCAMLFIND) ocamldep $(OCAMLPACKAGES) $^ | \
+         $(SED) -e 's/ *$$//' | \
+         $(SED) -e 's/[ \t]:/:/' | \
          $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
-         sort > $@-t
+         LANG=C sort > $@-t
        mv $@-t $@
 
 include .depend
 
 .PHONY: depend docs
+
+# The dependencies aren't safe for parallel make (XXX fixme).
+.NOTPARALLEL: