whenjobs initial version.
[whenjobs.git] / lib / Makefile.am
diff --git a/lib/Makefile.am b/lib/Makefile.am
new file mode 100644 (file)
index 0000000..47285cd
--- /dev/null
@@ -0,0 +1,87 @@
+# whenjobs
+# Copyright (C) 2012 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+libwhenjobsdir = $(libdir)/$(PACKAGE_NAME)
+libwhenjobs_SCRIPTS = whenlib.cma pa_when.cmo
+
+OCAMLPACKAGES = -package unix,num,camlp4.lib,rpc
+
+OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX $(OCAMLPACKAGES)
+OCAMLOPTFLAGS = $(OCAMLCFLAGS)
+
+# These should be in alphabetical order. 
+SOURCES = \
+       config.ml \
+       whenfile.mli \
+       whenfile.ml \
+       whenlock.ml \
+       whenlock.mli \
+       whenproto_aux.ml \
+       whenproto_aux.mli \
+       whenutils.mli \
+       whenutils.ml
+
+# In dependency order.
+OBJECTS = \
+       config.cmo \
+       whenproto_aux.cmo \
+       whenutils.cmo \
+       whenfile.cmo \
+       whenlock.cmo
+
+# Library.
+noinst_LIBRARIES = liblibrary.a
+liblibrary_a_SOURCES = flock.c
+liblibrary_a_CFLAGS = -I$(shell $(OCAMLC) -where)
+
+whenlib.cma: $(OBJECTS) liblibrary.a
+       $(OCAMLFIND) c -a $(OCAMLCFLAGS) $(OBJECTS) -cclib -llibrary -o $@
+
+whenproto_aux.ml whenproto_aux.mli: whenproto.x
+       $(OCAMLRPCGEN) -int int32 -hyper int64 -aux $<
+
+# Preprocessor for whenjobs files.
+pa_when.cmo: pa_when.ml whenlib.cma
+       $(OCAMLFIND) c $(OCAMLCFLAGS) \
+         -linkpkg whenlib.cma -pp $(CAMLP4OF) -c $< -o $@
+
+# Rules for all OCaml files.
+%.cmi: %.mli
+       $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
+%.cmo: %.ml
+       $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
+%.cmx: %.ml
+       $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@
+
+SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
+
+# OCaml dependencies.
+depend: .depend
+
+.depend: $(SOURCES)
+       rm -f $@ $@-t
+       $(OCAMLFIND) ocamldep $^ | \
+         $(SED) -e 's/ *$$//' | \
+         $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
+         LANG=C sort > $@-t
+       mv $@-t $@
+
+-include .depend
+
+CLEANFILES = \
+       *.cmi *.cmo *.cmx *.cma *.cmxa *~ \
+       config.ml whenproto_aux.ml whenproto_aux.mli