viewer: Run virt-viewer in the background.
[mclu.git] / Makefile.am
index e5fd98f..329e29b 100644 (file)
@@ -1,5 +1,5 @@
-# mclu (mini cluster)
-# Copyright (C) 2014 Red Hat Inc.
+# mclu: Mini Cloud
+# Copyright (C) 2014-2015 Red Hat Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+CLEANFILES = *~ *.cmi *.cmo *.cmx
+
 ACLOCAL_AMFLAGS = -I m4
 
-# Why doesn't automake include _SCRIPTS and _DATA ...?
-EXTRA_DIST = CONFIGURATION mclu.spec $(pkgdata_SCRIPTS) $(conf_DATA)
-
-# This rule just ensures that the wrapper binary and Python files get
-# installed when we do 'make install'.
-
-bin_SCRIPTS = mclu
-
-pkgdata_SCRIPTS = \
-       config.py \
-       lib.py \
-       libvirt_xml.py \
-       mclu.py \
-       mclu_build.py \
-       mclu_console.py \
-       mclu_import.py \
-       mclu_info.py \
-       mclu_list.py \
-       mclu_migrate.py \
-       mclu_off.py \
-       mclu_on.py \
-       mclu_reboot.py \
-       mclu_start.py \
-       mclu_status.py \
-       mclu_stop.py \
-       mclu_viewer.py \
-       node.py
+EXTRA_DIST = \
+       $(SOURCES_MLI) \
+       $(SOURCES_ML) \
+       templates/rawhide.sh
 
-# Configuration file.
+# In alphabetical order.
+SOURCES_MLI = \
+       mclu_boot.mli \
+       mclu_conf.mli \
+       mclu_console.mli \
+       mclu_destroy.mli \
+       mclu_list.mli \
+       mclu_onoff.mli \
+       mclu_reboot.mli \
+       mclu_status.mli \
+       mclu_viewer.mli \
+       parallel.mli \
+       template.mli \
+       utils.mli
+
+# These must appear in dependency order.
+SOURCES_ML = \
+       config.ml \
+       utils.ml \
+       parallel.ml \
+       template.ml \
+       mclu_conf.ml \
+       mclu_list.ml \
+       mclu_status.ml \
+       mclu_onoff.ml \
+       mclu_boot.ml \
+       mclu_destroy.ml \
+       mclu_reboot.ml \
+       mclu_console.ml \
+       mclu_viewer.ml \
+       mclu.ml
+
+OCAMLPACKAGES = -package unix,pcre,libvirt
+OCAMLFLAGS = -g -warn-error CDEFLMPSUVYZX-3
+
+BOBJECTS = $(SOURCES_ML:.ml=.cmo)
+XOBJECTS = $(BOBJECTS:.cmo=.cmx)
+if !HAVE_OCAMLOPT
+OBJECTS  = $(BOBJECTS)
+BEST     = ocamlc
+else
+OBJECTS  = $(XOBJECTS)
+BEST     = ocamlopt
+endif
 
-confdir = $(sysconfdir)/$(PACKAGE_NAME)
-conf_DATA = mclu.conf
+bin_PROGRAMS = mclu
+# Since there are no real C sources (at least, not yet) we have a
+# token C file that is empty, just to keep automake happy.  The real
+# sources are *.ml files.
+mclu_SOURCES = empty.c
+mclu_DEPENDENCIES = $(OBJECTS)
+mclu_LINK = \
+       ./link.sh \
+         $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) \
+         $(OBJECTS) -o $@
 
-install-data-hook:
-       mkdir -p $(DESTDIR)/$(sysconfdir)/$(PACKAGE_NAME)/xmls
+.mli.cmi:
+       $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
+.ml.cmo:
+       $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
+if HAVE_OCAMLOPT
+.ml.cmx:
+       $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
+endif
 
-CLEANFILES = \
-       *~ \
-       *.pyc \
-       config.py \
-       mclu \
-       mclu.spec
+# Dependencies.
+depend: .depend
+
+.depend: $(SOURCES_MLI) $(SOURCES_ML)
+       rm -f $@ $@-t
+       $(OCAMLFIND) ocamldep -I $(abs_srcdir) -I . $^ | \
+         $(SED) 's/ *$$//' | \
+         $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
+         $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
+         sort > $@-t
+       mv $@-t $@
+
+-include .depend
+
+DISTCLEANFILES = .depend
+.PHONY: depend
+
+# Configuration file.
+sysconf_DATA = mclu.conf
 
-# Run pylint.
+# Documentation.
+man_MANS = mclu.1
 
-lint:
-       pylint -E $(pkgdata_SCRIPTS)
+mclu.1: mclu.pod
+       $(POD2MAN) \
+           -c "Virtualization Support" \
+           --release "$(PACKAGE)-$(VERSION)" \
+           $< > $@-t
+       mv $@-t $@