nitc :: ExternCFile :: defaultinit
# 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