daemon: On fork, open stdin/stdout/stderr on /dev/null.
[whenjobs.git] / tools / 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 = $(SOURCES) whenjobs.pod
19
20 bin_SCRIPTS = whenjobs
21
22 OCAMLPACKAGES = -package unix,num,camlp4.lib,calendar,rpc -I ../lib
23
24 OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
25 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
26
27 # These should be in alphabetical order. 
28 SOURCES = \
29         libdir.ml \
30         tutorial.ml \
31         whenproto_clnt.ml \
32         whenproto_clnt.mli \
33         whenjobs.ml
34
35 # In dependency order.
36 OBJECTS = \
37         libdir.cmo \
38         tutorial.cmo \
39         whenproto_clnt.cmo \
40         whenjobs.cmo
41
42 libdir.ml: Makefile
43         rm -f $@ $@-t
44         echo 'let libdir = "$(libdir)/$(PACKAGE_NAME)"' > $@-t
45         mv $@-t $@
46
47 whenproto_clnt.ml whenproto_clnt.mli: whenproto.x
48         $(OCAMLRPCGEN) -int int32 -hyper int64 -clnt $<
49
50 whenproto.x: ../lib/whenproto.x
51         ln -f $< $@
52
53 whenjobs: ../lib/whenlib.cma $(OBJECTS)
54         $(OCAMLFIND) ocamlc -custom $(OCAMLCFLAGS) -ccopt -L../lib \
55           -linkpkg whenlib.cma $(OBJECTS) -o $@
56
57 # Rules for all OCaml files.
58 %.cmi: %.mli ../lib/whenlib.cma
59         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
60 %.cmo: %.ml ../lib/whenlib.cma
61         $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
62 %.cmx: %.ml ../lib/whenlib.cma
63         $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
64
65 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
66
67 # OCaml dependencies.
68 depend: .depend
69
70 .depend: $(SOURCES)
71         rm -f $@ $@-t
72         $(OCAMLFIND) ocamldep $^ | \
73           $(SED) -e 's/ *$$//' | \
74           $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
75           LANG=C sort > $@-t
76         mv $@-t $@
77
78 -include .depend
79
80 # Manual page.
81 man_MANS = whenjobs.1
82
83 whenjobs.1: whenjobs.pod
84         pod2man \
85           -c "Job scheduling" \
86           --release "$(PACKAGE)-$(VERSION)" \
87           --section 1 \
88           --stderr --utf8 \
89           $< > $@
90
91 whenjobs.txt: whenjobs.pod
92         pod2text \
93           --stderr --utf8 \
94           $< > $@
95
96 CLEANFILES = \
97         *.cmi *.cmo *.cmx *.cma *.cmxa *~ \
98         libdir.ml \
99         whenproto.x \
100         whenproto_clnt.ml whenproto_clnt.mli \
101         whenjobs