I created a Frama-C plug-in which uses a .c
source and I'd like to compile it, but when adding
PLUGIN_EXTRA_OPT = file
to my plug-in's Makefile, I obtain the following error after running make
:
Packing Myplugin.cmx
file.c:1:24: fatal error: caml/alloc.h: No such file or directory
#include <caml/alloc.h>
^
compilation terminated.
Adding VERBOSEMAKE=yes
gives some additional information about the error cause:
...
gcc file.c -o file
file.c:1:24: fatal error: caml/alloc.h: No such file or directory
...
It seems that GCC is being called for some reason, instead of ocamlc
.
How can I tell make to correctly compile my .c
sources?
In this case, the right syntax for the
PLUGIN_EXTRA_OPT
variable is to include the.o
extension:By doing so, Make applies the right rule and builds
file.o
usingocamlc
, and then includes it as an additional argument to theocamlopt
command which builds the plug-in's.cmx
file.The previous error was caused by the fact that Make applied an implicit rule to the non-existing
file
target, as demonstrated by runningmake -d
: