Generate ocamldoc, multiple documentation fixes.
[goaljobs.git] / Makefile.am
1 # goaljobs
2 # Copyright (C) 2013 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 include common-rules.mk
19
20 ACLOCAL_AMFLAGS = -I m4
21
22 EXTRA_DIST = \
23         COPYING \
24         goaljobs \
25         goaljobs_config.ml.in \
26         goaljobs.ml \
27         goaljobs.mli \
28         goaljobs.spec \
29         goaljobs.spec.in \
30         META.in \
31         NOTES \
32         pa_goal.ml \
33         README \
34         TODO
35
36 SUBDIRS = . examples tests
37
38 sources = \
39         goaljobs_config.ml \
40         goaljobs.ml \
41         goaljobs.mli
42
43 bin_SCRIPTS = goaljobs
44
45 # These targets are noinst because we use a custom install hook to
46 # install them, and are _SCRIPTS because automake doesn't know how to
47 # compile OCaml code.
48 noinst_SCRIPTS = goaljobs.cma goaljobs.cmxa pa_goal.cmo
49
50 # Library.
51 goaljobs.cma: goaljobs_config.cmo goaljobs.cmo
52         $(OCAMLFIND) ocamlc -a -o $@ $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $^
53
54 goaljobs.cmxa: goaljobs_config.cmx goaljobs.cmx
55         $(OCAMLFIND) ocamlopt -a -o $@ $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) $^
56
57 # Preprocessor for goaljobs scripts.
58 pa_goal.cmo: pa_goal.ml
59         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -package camlp4.lib -linkpkg \
60             -pp $(CAMLP4OF) -c $< -o $@
61
62 # Install.
63 install-data-hook:
64         mkdir -p $(DESTDIR)$(OCAMLLIB)
65         $(OCAMLFIND) install \
66             -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
67             goaljobs \
68             META goaljobs.cma goaljobs.cmxa pa_goal.cmo *.cmi $(srcdir)/*.mli
69         rm $(DESTDIR)$(OCAMLLIB)/goaljobs/pa_goal.cmi
70
71 # Dependencies.
72 depend: .depend
73
74 .depend: $(sources)
75         rm -f $@ $@-t
76         $(OCAMLFIND) ocamldep -I $(abs_srcdir) $^ | \
77           $(SED) 's/ *$$//' | \
78           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
79           $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
80           sort > $@-t
81         mv $@-t $@
82
83 -include .depend
84
85 rpm: dist
86         rpmbuild -ta $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
87
88 if HAVE_OCAMLDOC
89
90 # HTML library documentation.
91 # XXX The list below probably changes with every ocamldoc version.
92 # How can we use a wildcard?
93 doc_DATA = \
94         html/Goaljobs.html \
95         html/index_attributes.html \
96         html/index_classes.html \
97         html/index_class_types.html \
98         html/index_exceptions.html \
99         html/index.html \
100         html/index_methods.html \
101         html/index_modules.html \
102         html/index_module_types.html \
103         html/index_types.html \
104         html/index_values.html \
105         html/style.css \
106         html/type_Goaljobs.html
107
108 $(doc_DATA): stamp-ocamldoc
109 stamp-ocamldoc: goaljobs.mli goaljobs.ml
110         rm -f $@
111         $(OCAMLFIND) ocamldoc -html -d html $(OCAMLCPACKAGES) $^
112         touch $@
113
114 endif
115
116 # License check.
117 licensecheck:
118         licensecheck $$(git ls-files)