# "make all" builds the executable as well as the "printbig" library designed
# to test linking external code

.PHONY : all
all : ctex.native binom.o gcd.o unit

debug : ctex.d.byte binom.o gcd.o

# "make ctex.native" compiles the compiler
#
# The _tags file controls the operation of ocamlbuild, e.g., by including
# packages, enabling warnings
#
# See https://github.com/ocaml/ocamlbuild/blob/master/manual/manual.adoc

ctex.native :
	opam config exec -- \
	ocamlbuild -use-ocamlfind ctex.native

ctex.d.byte :
	opam config exec -- \
	ocamlbuild -use-ocamlfind -tag 'debug' ctex.d.byte

unit :
	opam config exec -- \
	ocamlbuild -package oUnit test.byte && \
  ./test.byte


# "make clean" removes all generated files

.PHONY : clean
clean :
	ocamlbuild -clean
