ocaml-indent / OMakefile

# How-to-build using OMake
#
# yes no | omake --install # to create OMakeroot for the first time

# If OMakeroot is here, include OMyMakefile
if $(file-exists OMakeroot)
   include OMyMakefile
   export

.PHONY: all install clean

OCAMLINCLUDES +=

OCAMLFLAGS    = -annot -w A-4-9 -warn-error A-4-9-32
OCAMLCFLAGS   +=
OCAMLOPTFLAGS +=
OCAML_LINK_FLAGS +=
OCAML_BYTE_LINK_FLAGS +=
OCAML_NATIVE_LINK_FLAGS +=

CAMLP4PACKS[]= sexplib compiler-libs.common

OCAMLPACKS[]= sexplib compiler-libs.common

OCAMLDEPFLAGS= -syntax camlp4o -package sexplib.syntax
OCAMLPPFLAGS= -syntax camlp4o -package sexplib.syntax

FILES[] =
    pos
    reader
    tokenstr
    xparser
    machine
    args
    main

PROGRAM = ocaml-indent

OCAML_LIBS +=
OCAML_CLIBS +=
OCAML_OTHER_LIBS +=
OCAML_LIB_FLAGS +=

MyOCamlProgram($(PROGRAM), $(FILES))

.DEFAULT: ocaml-indent

clean:
	rm -f *.cm* *.o *output *.sp?t

.PHONY: test


TESTS=$(glob tests/*.ml)
test_out(file) = 
    return $(addprefix tests_out, $(removeprefix tests, $(file)))

TESTS_OUT=$(test_out $(TESTS))

foreach (file, $(TESTS))
  $(test_out $(file)): $(file) ./ocaml-indent
    mkdir_if_not_exists(tests_out)
    ./ocaml-indent $< > $@
  export

result.diff: $(TESTS_OUT)
    diff -x '*~' -c -r tests tests_out > $@

test: result.diff

SELFTESTS=$(glob *.ml *.mli)
selftest_out(file) = 
    return $(addprefix self_tests_out/, $(file))

SELFTESTS_OUT=$(selftest_out $(TESTS))

.PHONY: selftest
selftest: $(SELFTESTS_OUT)

#|ditto.
mkdir_if_not_exists(dir) =
  if $(not $(test -e $(dir))):
    mkdir $(dir) 
  return

WithOCamlVeryClean()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.