2015-06-17 31 views
1

我创建了一个邮资-C插件,它使用一个.c源,我想编译它,但运行make后加入如何编译具有C源代码的Frama-C插件?

PLUGIN_EXTRA_OPT = file 

我插件的Makefile的时候,我得到了以下错误:

Packing  Myplugin.cmx 
file.c:1:24: fatal error: caml/alloc.h: No such file or directory 
#include <caml/alloc.h> 
         ^
compilation terminated. 

添加VERBOSEMAKE=yes提供有关错误原因的一些附加信息:

... 
gcc  file.c -o file 
file.c:1:24: fatal error: caml/alloc.h: No such file or directory 
... 

看来GCC因为某种原因被调用,而不是ocamlc

我该如何辨别正确编译我的.c源?

回答

2

在这种情况下,对于PLUGIN_EXTRA_OPT变量正确的语法是包括.o扩展:

PLUGIN_EXTRA_OPT = file.o 

通过这样做,使应用正确的规则,并使用ocamlc建立file.o,然后包括它作为ocamlopt命令的附加参数,它构建插件的.cmx文件。

以前的错误是由使应用一个隐含的规则不存在的file目标造成的事实,这表现在运行make -d

... 
Considering target file `file'. 
File `file' does not exist. 
Looking for an implicit rule for `file'. 
Trying pattern rule with stem `file'. 
Trying implicit prerequisite `file.c'. 
Found an implicit rule for `file'. 
...