Implement serial console (mclu console ..)
[mclu.git] / Makefile.am
1 # mclu: Mini Cloud
2 # Copyright (C) 2014-2015 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 CLEANFILES = *~ *.cmi *.cmo *.cmx
19
20 ACLOCAL_AMFLAGS = -I m4
21
22 EXTRA_DIST = \
23         $(SOURCES_MLI) \
24         $(SOURCES_ML) \
25         templates/rawhide.sh
26
27 # In alphabetical order.
28 SOURCES_MLI = \
29         mclu_boot.mli \
30         mclu_conf.mli \
31         mclu_console.mli \
32         mclu_list.mli \
33         mclu_onoff.mli \
34         mclu_status.mli \
35         parallel.mli \
36         template.mli \
37         utils.mli
38
39 # These must appear in dependency order.
40 SOURCES_ML = \
41         config.ml \
42         utils.ml \
43         parallel.ml \
44         template.ml \
45         mclu_conf.ml \
46         mclu_list.ml \
47         mclu_status.ml \
48         mclu_onoff.ml \
49         mclu_boot.ml \
50         mclu_console.ml \
51         mclu.ml
52
53 OCAMLPACKAGES = -package unix,pcre,libvirt
54 OCAMLFLAGS = -g -warn-error CDEFLMPSUVYZX-3
55
56 BOBJECTS = $(SOURCES_ML:.ml=.cmo)
57 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
58 if !HAVE_OCAMLOPT
59 OBJECTS  = $(BOBJECTS)
60 BEST     = ocamlc
61 else
62 OBJECTS  = $(XOBJECTS)
63 BEST     = ocamlopt
64 endif
65
66 bin_PROGRAMS = mclu
67 # Since there are no real C sources (at least, not yet) we have a
68 # token C file that is empty, just to keep automake happy.  The real
69 # sources are *.ml files.
70 mclu_SOURCES = empty.c
71 mclu_DEPENDENCIES = $(OBJECTS)
72 mclu_LINK = \
73         ./link.sh \
74           $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) \
75           $(OBJECTS) -o $@
76
77 .mli.cmi:
78         $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
79 .ml.cmo:
80         $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
81 if HAVE_OCAMLOPT
82 .ml.cmx:
83         $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
84 endif
85
86 # Dependencies.
87 depend: .depend
88
89 .depend: $(SOURCES_MLI) $(SOURCES_ML)
90         rm -f $@ $@-t
91         $(OCAMLFIND) ocamldep -I $(abs_srcdir) -I . $^ | \
92           $(SED) 's/ *$$//' | \
93           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
94           $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
95           sort > $@-t
96         mv $@-t $@
97
98 -include .depend
99
100 DISTCLEANFILES = .depend
101 .PHONY: depend
102
103 # Configuration file.
104 sysconf_DATA = mclu.conf
105
106 # Documentation.
107 man_MANS = mclu.1
108
109 mclu.1: mclu.pod
110         $(POD2MAN) \
111             -c "Virtualization Support" \
112             --release "$(PACKAGE)-$(VERSION)" \
113             $< > $@-t
114         mv $@-t $@