mclu version 2
[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_list.mli \
32         mclu_onoff.mli \
33         mclu_status.mli \
34         parallel.mli \
35         template.mli \
36         utils.mli
37
38 # These must appear in dependency order.
39 SOURCES_ML = \
40         config.ml \
41         utils.ml \
42         parallel.ml \
43         template.ml \
44         mclu_conf.ml \
45         mclu_list.ml \
46         mclu_status.ml \
47         mclu_onoff.ml \
48         mclu_boot.ml \
49         mclu.ml
50
51 OCAMLPACKAGES = -package unix,pcre,libvirt
52 OCAMLFLAGS = -g -warn-error CDEFLMPSUVYZX-3
53
54 BOBJECTS = $(SOURCES_ML:.ml=.cmo)
55 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
56 if !HAVE_OCAMLOPT
57 OBJECTS  = $(BOBJECTS)
58 BEST     = ocamlc
59 else
60 OBJECTS  = $(XOBJECTS)
61 BEST     = ocamlopt
62 endif
63
64 bin_PROGRAMS = mclu
65 # Since there are no real C sources (at least, not yet) we have a
66 # token C file that is empty, just to keep automake happy.  The real
67 # sources are *.ml files.
68 mclu_SOURCES = empty.c
69 mclu_DEPENDENCIES = $(OBJECTS)
70 mclu_LINK = \
71         ./link.sh \
72           $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) \
73           $(OBJECTS) -o $@
74
75 .mli.cmi:
76         $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
77 .ml.cmo:
78         $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
79 if HAVE_OCAMLOPT
80 .ml.cmx:
81         $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
82 endif
83
84 # Dependencies.
85 depend: .depend
86
87 .depend: $(SOURCES_MLI) $(SOURCES_ML)
88         rm -f $@ $@-t
89         $(OCAMLFIND) ocamldep -I $(abs_srcdir) -I . $^ | \
90           $(SED) 's/ *$$//' | \
91           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
92           $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
93           sort > $@-t
94         mv $@-t $@
95
96 -include .depend
97
98 DISTCLEANFILES = .depend
99 .PHONY: depend
100
101 # Configuration file.
102 sysconf_DATA = mclu.conf
103
104 # Documentation.
105 man_MANS = mclu.1
106
107 mclu.1: mclu.pod
108         $(POD2MAN) \
109             -c "Virtualization Support" \
110             --release "$(PACKAGE)-$(VERSION)" \
111             $< > $@-t
112         mv $@-t $@