X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=Goalfile.in;h=d28b9312342809ca02ad82cdee707291b44a8c6f;hb=915b9bff547705bf9df287ffb2a057eeaec4ca02;hp=7a085e33cee2f79e318967893c4938cf34644af2;hpb=f2f4e11474538948ffdd503ff6e136fcdf9c81ef;p=goals.git diff --git a/Goalfile.in b/Goalfile.in index 7a085e3..d28b931 100644 --- a/Goalfile.in +++ b/Goalfile.in @@ -29,15 +29,18 @@ goal all = : "Goalfile", tool, documentation; ./config.status %@ } -goal clean = { - for d in %subdirs; do - pushd $d - rm -f *~ - rm -f *.cmi *.cmo *.cmx *.o - popd - done +goal clean = : wrap ("clean-subdir", subdirs), clean-subdir ("."), clean-other + +goal clean-subdir (dir) = { + cd %dir + rm -f *~ + rm -f *.cmi *.cmo *.cmx *.o +} + +goal clean-other = { rm -f src/parser.ml src/parser.mli src/lexer.ml src/parser.conflicts rm -f man/*.1 man/*.5 + rm -f tests/*.log # We don't delete src/goals because it is required to do builds. # If you want to really delete it, use the maintainer-clean rule. @@ -50,11 +53,15 @@ goal maintainer-clean = : clean { #---------------------------------------------------------------------- # Build the goals tool itself. +let CC = "@CC@" +let OCAMLLIB = "@OCAMLLIB@" let MENHIR = "@MENHIR@" let OCAMLDEP = "@OCAMLDEP@" let OCAMLFIND = "@OCAMLFIND@" let OCAMLLEX = "@OCAMLLEX@" # XXX +let CFLAGS = [ "-g", "-O2", "-I%OCAMLLIB", "-I." ] +#let CFLAGS = "@CFLAGS@ -I%OCAMLLIB -I." let OCAMLFLAGS = [ "-g", "-safe-string", "-warn-error", "CDEFLMPSUVYZX+52-3" ] let OCAMLPACKAGES = [ "-package", "str,unix,threads", "-I", "src", "-thread" ] #let OCAMLFLAGS = "@OCAMLFLAGS@" @@ -63,6 +70,7 @@ let OCAMLPACKAGES = [ "-package", "str,unix,threads", "-I", "src", "-thread" ] let objects = [ # These must be in dependency order. "src/config.cmx", + "src/utils-c.o", "src/utils.cmx", "src/cmdline.cmx", "src/jobs.cmx", @@ -71,12 +79,18 @@ let objects = [ "src/lexer.cmx", "src/parse.cmx", "src/eval.cmx", + "src/deps.cmx", "src/run.cmx", "src/main.cmx" ] goal tool = : ocaml_link ("src/goals", objects) ; +# C code. +"src/utils-c.o" : "src/utils-c.c" { + %CC %CFLAGS -c %< -o %@ +} + # Parser. "src/parser.mli", "src/parser.ml" : "src/parser.mly" { %MENHIR --explain %< @@ -112,8 +126,7 @@ goal depend = let POD2MAN = "@POD2MAN@" goal documentation = : pod2man ("goals", "1"), - pod2man ("Goalfile", "5"), - pod2man ("goals-reference", "5") + pod2man ("Goalfile", "5") goal pod2man (page, section) = "man/%page.%section" : "docs/%page.pod" { @@ -125,4 +138,28 @@ goal pod2man (page, section) = --release "@PACKAGE_NAME@-@PACKAGE_VERSION@" \ --section %section %< > %@-t mv %@-t %@ -} \ No newline at end of file +} + +#---------------------------------------------------------------------- +# Tests. + +let tests = wrap ("test", wildcard ("tests/*.sh")) + +goal check () = : tests + +goal test (name) = @{ + t=`basename %name` + cd tests + if ../run ./$t > $t.log 2>&1; then + start_green + echo -n "PASS: " + end_colour + echo $t + else + start_red + echo -n "FAIL: " + end_colour + echo $t + exit 1 + fi +}