Version 0.2.
[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.pod \
29         goaljobs-reference.pod \
30         goaljobs.spec \
31         goaljobs.spec.in \
32         html/.gitignore \
33         META.in \
34         NOTES \
35         pa_goal.ml \
36         README \
37         TODO
38
39 SUBDIRS = . examples tests
40
41 sources = \
42         goaljobs_config.ml \
43         goaljobs.ml \
44         goaljobs.mli
45
46 bin_SCRIPTS = goaljobs
47
48 # These targets are noinst because we use a custom install hook to
49 # install them, and are _SCRIPTS because automake doesn't know how to
50 # compile OCaml code.
51 noinst_SCRIPTS = goaljobs.cma goaljobs.cmxa pa_goal.cmo
52
53 # Library.
54 goaljobs.cma: goaljobs_config.cmo goaljobs.cmo
55         $(OCAMLFIND) ocamlc -a -o $@ $(OCAMLCFLAGS) $(OCAMLCPACKAGES) $^
56
57 goaljobs.cmxa: goaljobs_config.cmx goaljobs.cmx
58         $(OCAMLFIND) ocamlopt -a -o $@ $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) $^
59
60 # Preprocessor for goaljobs scripts.
61 pa_goal.cmo: pa_goal.ml
62         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -package camlp4.lib -linkpkg \
63             -pp $(CAMLP4OF) -c $< -o $@
64
65 # Install.
66 install-data-hook:
67         mkdir -p $(DESTDIR)$(OCAMLLIB)
68         $(OCAMLFIND) install \
69             -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
70             goaljobs \
71             META goaljobs.cma goaljobs.cmxa pa_goal.cmo *.cmi $(srcdir)/*.mli
72         rm $(DESTDIR)$(OCAMLLIB)/goaljobs/pa_goal.cmi
73
74 # Dependencies.
75 depend: .depend
76
77 .depend: $(sources)
78         rm -f $@ $@-t
79         $(OCAMLFIND) ocamldep -I $(abs_srcdir) $^ | \
80           $(SED) 's/ *$$//' | \
81           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
82           $(SED) -e 's,$(abs_srcdir)/,$(builddir)/,g' | \
83           sort > $@-t
84         mv $@-t $@
85
86 -include .depend
87
88 rpm: dist
89         rpmbuild -ta $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
90
91 if HAVE_POD2MAN
92
93 man_MANS = goaljobs.1 goaljobs-reference.1
94
95 goaljobs.1: goaljobs.pod
96         $(POD2MAN) -c "Goaljobs" --release $(PACKAGE)-$(VERSION) $< > $@-t
97         mv $@-t $@
98
99 goaljobs-reference.1: goaljobs-reference.pod
100         $(POD2MAN) -c "Goaljobs" --release $(PACKAGE)-$(VERSION) $< > $@-t
101         mv $@-t $@
102
103 goaljobs.1.txt: goaljobs.pod
104         pod2text $< > $@-t
105         mv $@-t $@
106
107 goaljobs-reference.1.txt: goaljobs-reference.pod
108         pod2text $< > $@-t
109         mv $@-t $@
110
111 endif
112
113 if HAVE_OCAMLDOC
114
115 # HTML library documentation.
116 # XXX The list below probably changes with every ocamldoc version.
117 # How can we use a wildcard?
118 doc_DATA = \
119         html/Goaljobs.html \
120         html/index_attributes.html \
121         html/index_classes.html \
122         html/index_class_types.html \
123         html/index_exceptions.html \
124         html/index.html \
125         html/index_methods.html \
126         html/index_modules.html \
127         html/index_module_types.html \
128         html/index_types.html \
129         html/index_values.html \
130         html/style.css \
131         html/type_Goaljobs.html
132
133 $(doc_DATA): stamp-ocamldoc
134 stamp-ocamldoc: goaljobs.mli goaljobs.ml
135         rm -f $@
136         $(OCAMLFIND) ocamldoc -html -d html $(OCAMLCPACKAGES) $^
137         touch $@
138
139 endif
140
141 # License check.
142 licensecheck:
143         licensecheck $$(git ls-files)