nitc :: ExternCFile
nitc :: ExternCFile :: _cflags
Custom options for the C compiler (CFLAGS)nitc :: ExternCFile :: cflags=
Custom options for the C compiler (CFLAGS)nitc :: ExternCFile :: defaultinit
nitc $ ExternCFile :: SELF
Type of this instance, automatically specialized in every classnitc :: on_demand_compiler $ ExternCFile :: compile
Compile this source filenitc $ ExternCFile :: makefile_rule_content
The content of the rule in the makenitc $ ExternCFile :: makefile_rule_name
The name of the target in the Makefilenitc :: ExternCFile :: _cflags
Custom options for the C compiler (CFLAGS)nitc :: ExternFile :: _filename
Filename relative to the nit-compile foldernitc :: ExternFile :: _pkgconfigs
Additional libraries needed for the compilationnitc :: ExternFile :: add_to_jar
Isself
a Java file to include in the JAR archive?
nitc :: ExternCFile :: cflags=
Custom options for the C compiler (CFLAGS)core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: ExternFile :: compile
Compile this source filenitc :: ExternFile :: compiles_to_o_file
nitc :: ExternCFile :: defaultinit
nitc :: ExternFile :: defaultinit
core :: Object :: defaultinit
nitc :: ExternFile :: filename=
Filename relative to the nit-compile foldercore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: ExternFile :: makefile_rule_content
The content of the rule in the makenitc :: ExternFile :: makefile_rule_name
The name of the target in the Makefilecore :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: ExternFile :: pkgconfigs
Additional libraries needed for the compilationnitc :: ExternFile :: pkgconfigs=
Additional libraries needed for the compilation
# An extern C file to compile
class ExternCFile
super ExternFile
# Custom options for the C compiler (CFLAGS)
var cflags: String
redef fun hash do return filename.hash
redef fun ==(o) do return o isa ExternCFile and filename == o.filename
redef fun makefile_rule_name do
var basename = filename.basename(".c")
var res = "{basename}.extern.o"
return res
end
redef fun makefile_rule_content do
var ff = filename.basename
var o = makefile_rule_name
var pkg = ""
if not pkgconfigs.is_empty then
pkg = "`pkg-config --cflags {pkgconfigs.join(" ")}`"
end
return "$(CC) $(CFLAGS) -Wall -Wno-unused-function {self.cflags} {pkg} -c -o {o} {ff}"
end
redef fun compiles_to_o_file do return true
end
src/c_tools.nit:130,1--157,3
redef class ExternCFile
redef fun compile(v, mmodule, object_files, pkg_cflags)
do
var compile_dir = v.compile_dir
var cflags = mmodule.cflags[""].join(" ") + " " + pkg_cflags
var obj = compile_dir / filename.basename(".c") + ".o"
var cmd = "{v.c_compiler} -Wall -c -fPIC -I {compile_dir} -g -o {obj} {compile_dir / filename} {cflags}"
if sys.system(cmd) != 0 then
v.fatal "FFI Error: Failed to compile C code using `{cmd}`"
return false
end
object_files.add obj
return true
end
end
src/interpreter/dynamic_loading_ffi/on_demand_compiler.nit:400,1--416,3