Don't include debug* commands in the documentation.
[libguestfs.git] / generator / Makefile.am
1 # libguestfs
2 # Copyright (C) 2010 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., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 SOURCES = \
19         generator_types.ml \
20         generator_utils.mli \
21         generator_utils.ml \
22         generator_actions.mli \
23         generator_actions.ml \
24         generator_structs.mli \
25         generator_structs.ml \
26         generator_api_versions.mli \
27         generator_api_versions.ml \
28         generator_optgroups.ml \
29         generator_prepopts.mli \
30         generator_prepopts.ml \
31         generator_pr.mli \
32         generator_pr.ml \
33         generator_docstrings.ml \
34         generator_checks.ml \
35         generator_c.ml \
36         generator_xdr.ml \
37         generator_daemon.ml \
38         generator_capitests.ml \
39         generator_fish.ml \
40         generator_ocaml.ml \
41         generator_perl.ml \
42         generator_python.ml \
43         generator_ruby.ml \
44         generator_java.ml \
45         generator_haskell.ml \
46         generator_csharp.ml \
47         generator_php.ml \
48         generator_bindtests.ml \
49         generator_errnostring.ml \
50         generator_main.ml
51
52 SOURCES_ML = $(filter %.ml,$(SOURCES))
53 OBJECTS = $(SOURCES_ML:.ml=.cmo)
54
55 EXTRA_DIST = $(SOURCES)
56
57 OCAMLCFLAGS = -I +xml-light -I +../pkg-lib/xml-light -warn-error CDEFLMPSUVYZX
58 OCAMLCLIBS = xml-light.cma unix.cma str.cma
59
60 noinst_PROGRAM = generator
61
62 if HAVE_OCAML
63
64 generator: $(OBJECTS)
65         $(OCAMLC) -o generator $(OCAMLCFLAGS) $(OCAMLCLIBS) $(OBJECTS)
66
67 .ml.cmo:
68         $(OCAMLC) $(OCAMLCFLAGS) -c $< -o $@
69
70 .mli.cmi:
71         $(OCAMLC) $(OCAMLCFLAGS) -c $< -o $@
72
73 depend: .depend
74
75 .depend: $(SOURCES)
76         rm -f $@ $@-t
77         $(OCAMLDEP) $^ | sed 's/  *$$//' > $@-t
78         mv $@-t $@
79
80 include .depend
81
82 else
83
84 # No OCaml compiler.  Just replace the generator with a script that
85 # touches stamp-generator and prints a warning.
86
87 generator: $(SOURCES)
88         rm -f $@ $@-t
89         echo 'echo Warning: Install OCaml compiler in order to rebuild the generated files.' >> $@-t
90         echo 'touch generator/stamp-generator' >> $@-t
91         chmod +x $@-t
92         mv $@-t $@
93
94 endif
95
96 noinst_DATA = stamp-generator
97
98 # Run the generator.
99 # Git removes empty directories, so in cases where the
100 # generator is creating the sole file in a directory, we
101 # have to create the directory first.
102 stamp-generator: generator
103         mkdir -p $(top_srcdir)/perl/lib/Sys
104         mkdir -p $(top_srcdir)/ruby/ext/guestfs
105         mkdir -p $(top_srcdir)/java/com/redhat/et/libguestfs
106         mkdir -p $(top_srcdir)/csharp
107         cd $(top_srcdir) && generator/generator
108
109 CLEANFILES = $(noinst_DATA) $(noinst_PROGRAM) *.cmi *.cmo *~
110
111 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly