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