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_OPTvariable is to include the.oextension:By doing so, Make applies the right rule and builds
file.ousingocamlc, and then includes it as an additional argument to theocamloptcommand which builds the plug-in's.cmxfile.The previous error was caused by the fact that Make applied an implicit rule to the non-existing
filetarget, as demonstrated by runningmake -d: