whenjobs initial version.
[whenjobs.git] / tests / parsing / Makefile.am
diff --git a/tests/parsing/Makefile.am b/tests/parsing/Makefile.am
new file mode 100644 (file)
index 0000000..9a693a6
--- /dev/null
@@ -0,0 +1,69 @@
+# 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.
+
+tests = t010_load.cmo t020_simple.cmo t030_jobnames.cmo
+
+check_SCRIPTS = test_load $(tests)
+
+TESTS_ENVIRONMENT = ./test_load
+TESTS = $(tests)
+
+OCAMLPACKAGES = -package unix,camlp4.lib
+
+OCAMLCFLAGS = \
+       -g -warn-error CDEFLMPSUVYZX \
+       -I +camlp4 -I ../../daemon \
+       $(OCAMLPACKAGES)
+OCAMLOPTFLAGS = $(OCAMLCFLAGS)
+
+PP = -pp '$(CAMLP4O) ../../daemon/pa_when.cmo'
+
+test_load: test_load.cmo
+       $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -linkpkg whenlib.cma $< -o $@
+
+# Rules for all OCaml files.
+%.cmi: %.mli ../../daemon/pa_when.cmo
+       $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) -c $< -o $@
+%.cmo: %.ml ../../daemon/pa_when.cmo
+       $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(PP) -c $< -o $@
+#%.cmx: %.ml ../../daemon/pa_when.cmo
+#      $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(PP) -c $< -o $@
+
+SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
+
+# OCaml dependencies.
+depend: .depend
+
+.depend: $(SOURCES)
+       rm -f $@ $@-t
+       $(OCAMLFIND) ocamldep $(PP) $^ | \
+         $(SED) -e 's/ *$$//' | \
+         $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
+         LANG=C sort > $@-t
+       mv $@-t $@
+
+-include .depend
+
+# Useful for debugging: print the generated AST for the tests.
+print:
+       @for f in $(check_SCRIPTS); do \
+         b=`basename $$f .cmo`; \
+         echo "Test: $$b.ml"; \
+         camlp4o ../../daemon/pa_when.cmo -printer pr_o.cmo $$b.ml; \
+       done
+
+CLEANFILES = *.cmi *.cmo *.cmx *.cma *.cmxa *~ test_load