Add commands to list, cancel, start jobs.
[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 $(CMI_FILES)
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         whenexpr.ml \
33         whenexpr.mli \
34         whenfile.ml \
35         whenfile.mli \
36         whenlock.ml \
37         whenlock.mli \
38         whenproto_aux.ml \
39         whenproto_aux.mli \
40         whenstate.ml \
41         whenstate.mli \
42         whentools.ml \
43         whentools.mli \
44         whenutils.ml \
45         whenutils.mli
46
47 # In alphabetical order.
48 CMI_FILES = \
49         config.cmi \
50         whenexpr.cmi \
51         whenfile.cmi \
52         whenlock.cmi \
53         whenproto_aux.cmi \
54         whenstate.cmi \
55         whentools.cmi \
56         whenutils.cmi
57
58 # In dependency order.
59 OBJECTS = \
60         config.cmo \
61         whenproto_aux.cmo \
62         whenutils.cmo \
63         whenexpr.cmo \
64         whenstate.cmo \
65         whenfile.cmo \
66         whentools.cmo \
67         whenlock.cmo
68
69 # Library.
70 noinst_LIBRARIES = liblibrary.a
71 liblibrary_a_SOURCES = flock.c
72 liblibrary_a_CFLAGS = -I$(shell $(OCAMLC) -where)
73
74 whenlib.cma: $(OBJECTS) liblibrary.a
75         $(OCAMLFIND) c -a $(OCAMLCFLAGS) $(OBJECTS) -cclib -llibrary -o $@
76
77 whenproto_aux.ml whenproto_aux.mli: whenproto.x
78         $(OCAMLRPCGEN) -int int32 -hyper int64 -aux $<
79
80 # Preprocessor for whenjobs files.
81 # Note that we intentionally don't want this to depend on any
82 # libraries except for camlp4.lib.
83 pa_when.cmo: pa_when.ml
84         $(OCAMLFIND) c -g -warn-error CDEFLMPSUVYZX \
85           -package camlp4.lib -linkpkg \
86           -pp $(CAMLP4OF) -c $< -o $@
87
88 # Rules for all OCaml files.
89 %.cmi: %.mli
90         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
91 %.cmo: %.ml
92         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
93 %.cmx: %.ml
94         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
95
96 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
97
98 # OCaml dependencies.
99 depend: .depend
100
101 .depend: $(SOURCES)
102         rm -f $@ $@-t
103         $(OCAMLFIND) ocamldep $^ | \
104           $(SED) -e 's/ *$$//' | \
105           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
106           LANG=C sort > $@-t
107         mv $@-t $@
108
109 -include .depend
110
111 CLEANFILES = \
112         *.cmi *.cmo *.cmx *.cma *.cmxa *~ \
113         config.ml whenproto_aux.ml whenproto_aux.mli