Skip to content
Browse files

Create tup build rules. All problems are recorded as comments in

appropriate Tupfiles
  • Loading branch information...
1 parent c362316 commit f05cb8e12c16ece6d4114005a9d712c2233e0505 @adept committed Oct 21, 2011
Showing with 77 additions and 0 deletions.
  1. +6 −0 .gitignore
  2. BIN .tup/db
  3. +1 −0 README
  4. +15 −0 Tuprules.tup
  5. +8 −0 lib/Tupfile
  6. +41 −0 sexplib/lib/Tupfile
  7. +3 −0 sexplib/syntax/Tupfile
  8. +3 −0 type-conv/lib/Tupfile
View
6 .gitignore
@@ -0,0 +1,6 @@
+*.cmi
+*.cmo
+*.cma
+/sexplib/lib/lexer.ml
+/sexplib/lib/parser.ml
+/sexplib/lib/parser.mli
View
BIN .tup/db
Binary file not shown.
View
1 README
@@ -0,0 +1 @@
+Both sexplib and type-conv have their own build scripts, I would not be removing them, but I would not be using them either
View
15 Tuprules.tup
@@ -0,0 +1,15 @@
+TOP=$(TUP_CWD)
+LIBDIR=$(TOP)/lib
+OCAMLC_FLAGS=
+
+# Byte-compile preprocessor extension
+!byte_pp = |> ocamlc -I +camlp4 -I $(LIBDIR) $(OCAMLC_FLAGS) -pp camlp4orf -c %f -o %o |>
+
+# Byte-compile interface (.mli -> .cmi)
+!byte_i = |> ocamlc -I +camlp4 -I $(LIBDIR) $(OCAMLC_FLAGS) -c %f -o %o |> %B.cmi
+
+# Byte-compile object file, when interface was compiled separately (.ml -> .cmo, .mli is present)
+!byte_o = |> ocamlc -I +camlp4 -I $(LIBDIR) $(OCAMLC_FLAGS) -c %f -o %o |> %B.cmo
+
+# Byte-compile object file, when interface was compiled separately (.ml -> .cmo, .cmi, no .mli)
+!byte_io = |> ocamlc -I +camlp4 -I $(LIBDIR) $(OCAMLC_FLAGS) -c %f -o %o |> %B.cmo | %B.cmi
View
8 lib/Tupfile
@@ -0,0 +1,8 @@
+include_rules
+
+# "Install" preprocessor extensions to local search path
+: $(TOP)/type-conv/lib/pa_type_conv.cmi |> cp %f %o |> pa_type_conv.cmi
+: $(TOP)/type-conv/lib/pa_type_conv.cmo |> cp %f %o |> pa_type_conv.cmo
+# Those cause circular dependecy - why?
+#: $(TOP)/sexplib/syntax/pa_sexp_conv.cmi |> cp %f %o |> pa_sexp_conv.cmi
+#: $(TOP)/sexplib/syntax/pa_sexp_conv.cmo |> cp %f %o |> pa_sexp_conv.cmo
View
41 sexplib/lib/Tupfile
@@ -0,0 +1,41 @@
+include_rules
+
+# First, generate auto-generated sources
+: foreach *.mll |> ocamllex -q %f |> %B.ml
+: foreach *.mly |> ocamlyacc %f |> %B.ml %B.mli
+
+# Building library modules
+: type.ml |> !byte_io |> {cmo}
+
+: parser.mli | type.cmi |> !byte_i |>
+: parser.ml | parser.cmi |> !byte_o |> {cmo}
+
+: lexer.ml | parser.cmi |> !byte_io |> {cmo}
+
+# It would be nice to avoid such manual management of flags
+OCAMLC_FLAGS_BAK = $(OCAMLC_FLAGS)
+OCAMLC_FLAGS += -pp cpp
+: pre_sexp.ml | lexer.cmi |> !byte_io |> {cmo}
+OCAMLC_FLAGS = $(OCAMLC_FLAGS_BAK)
+
+: sexp_intf.ml | pre_sexp.cmi |> !byte_io |> {cmo}
+
+: sexp.mli | sexp_intf.cmi |> !byte_i |>
+: sexp.ml | sexp.cmi |> !byte_o |> {cmo}
+
+: path.mli | sexp.cmi |> !byte_i |>
+: path.ml | path.cmi |> !byte_o |> {cmo}
+
+: conv.mli | path.cmi sexp.cmi |> !byte_i |>
+: conv.ml | conv.cmi |> !byte_o |> {cmo}
+
+: conv_error.ml | conv.cmi |> !byte_io |> {cmo}
+
+: exn_magic.mli | path.cmi sexp.cmi conv.cmi |> !byte_i |>
+: exn_magic.ml | exn_magic.cmi conv.cmi |> !byte_o |> {cmo}
+
+: std.ml | conv.cmi |> !byte_io |> {cmo}
+
+: {cmo} |> ocamlc -a -o %o %f |> sexplib.cma
+
+# Now I would like to "install" .cma to $(LIBDIR)/sexplib/sexplib.cma, but apparently I can't create sexplib subdir on the fly :(
View
3 sexplib/syntax/Tupfile
@@ -0,0 +1,3 @@
+include_rules
+: pa_sexp_conv.mli |> !byte_pp |> pa_sexp_conv.cmi
+: pa_sexp_conv.ml | $(LIBDIR)/pa_type_conv.cmi pa_sexp_conv.cmi |> !byte_pp |> pa_sexp_conv.cmo
View
3 type-conv/lib/Tupfile
@@ -0,0 +1,3 @@
+include_rules
+: pa_type_conv.mli |> !byte_pp |> pa_type_conv.cmi
+: pa_type_conv.ml | pa_type_conv.cmi |> !byte_pp |> pa_type_conv.cmo

0 comments on commit f05cb8e

Please sign in to comment.
Something went wrong with that request. Please try again.