Add an explicit interface config.mli.
[whenjobs.git] / lib / Makefile.am
1 # whenjobs
2 # Copyright (C) 2012 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 EXTRA_DIST = whenproto.x pa_when.ml $(SOURCES)
19
20 libwhenjobsdir = $(libdir)/$(PACKAGE_NAME)
21 libwhenjobs_SCRIPTS = whenlib.cma pa_when.cmo
22
23 OCAMLPACKAGES = -package unix,num,camlp4.lib,calendar,rpc
24
25 OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
26 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
27
28 # These should be in alphabetical order. 
29 SOURCES = \
30         config.ml \
31         config.mli \
32         whenfile.ml \
33         whenfile.mli \
34         whenlock.ml \
35         whenlock.mli \
36         whenproto_aux.ml \
37         whenproto_aux.mli \
38         whenutils.mli \
39         whenutils.ml
40
41 # In dependency order.
42 OBJECTS = \
43         config.cmo \
44         whenproto_aux.cmo \
45         whenutils.cmo \
46         whenfile.cmo \
47         whenlock.cmo
48
49 # Library.
50 noinst_LIBRARIES = liblibrary.a
51 liblibrary_a_SOURCES = flock.c
52 liblibrary_a_CFLAGS = -I$(shell $(OCAMLC) -where)
53
54 whenlib.cma: $(OBJECTS) liblibrary.a
55         $(OCAMLFIND) c -a $(OCAMLCFLAGS) $(OBJECTS) -cclib -llibrary -o $@
56
57 whenproto_aux.ml whenproto_aux.mli: whenproto.x
58         $(OCAMLRPCGEN) -int int32 -hyper int64 -aux $<
59
60 # Preprocessor for whenjobs files.
61 # Note that we intentionally don't want this to depend on any
62 # libraries except for camlp4.lib.
63 pa_when.cmo: pa_when.ml
64         $(OCAMLFIND) c -g -warn-error CDEFLMPSUVYZX \
65           -package camlp4.lib -linkpkg \
66           -pp $(CAMLP4OF) -c $< -o $@
67
68 # Rules for all OCaml files.
69 %.cmi: %.mli
70         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
71 %.cmo: %.ml
72         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
73 %.cmx: %.ml
74         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
75
76 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
77
78 # OCaml dependencies.
79 depend: .depend
80
81 .depend: $(SOURCES)
82         rm -f $@ $@-t
83         $(OCAMLFIND) ocamldep $^ | \
84           $(SED) -e 's/ *$$//' | \
85           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
86           LANG=C sort > $@-t
87         mv $@-t $@
88
89 -include .depend
90
91 CLEANFILES = \
92         *.cmi *.cmo *.cmx *.cma *.cmxa *~ \
93         config.ml whenproto_aux.ml whenproto_aux.mli