I'm following this OCamlbuild example, and accordingly have created the Makefile below:
OCB_FLAGS = -use-ocamlfind -I src -I lib
OCB = ocamlbuild $(OCB_FLAGS)
check: ocamlfind query core async
clean: $(OCB) -clean
byte: $(OCB) main.byte
native: $(OCB) main.native
.PHONY: check clean byte native
The root directory contains two sub-directories, src and lib. The src sub-directory contains the file main.ml.
When I execute any of the targets, e.g. make clean
, make byte
, etc., I receive the error message:
make: *** No rule to make target 'ocamlfind', needed by 'check'. Stop.
or
make: *** No rule to make target 'ocamlbuild', needed by 'byte'. Stop.
I'd appreciate help in understanding the cause of and solution to this error. Thanks.
This line:
clean: $(OCB) -clean
Means that clean
has two dependencies, $(OCB)
and -clean
. So it tries to build ocamlbuild
first.
You want this, as in the linked makefile:
clean:
$(OCB) -clean
This means that clean
has no dependencies, and is "done" by running $(OCB) -clean
.
Note that you need an actual tab character before the $
character, not 8 spaces.