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