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