28 lines
575 B
Plaintext
28 lines
575 B
Plaintext
// compile.ce — compile a .cm or .ce file to native .dylib via QBE
|
|
//
|
|
// Usage:
|
|
// cell compile <file.cm|file.ce>
|
|
//
|
|
// Installs the dylib to .cell/lib/<pkg>/<stem>.dylib
|
|
|
|
var shop = use('internal/shop')
|
|
var build = use('build')
|
|
var fd = use('fd')
|
|
|
|
if (length(args) < 1) {
|
|
log.compile('usage: cell compile <file.cm|file.ce>')
|
|
return
|
|
}
|
|
|
|
var file = args[0]
|
|
if (!fd.is_file(file)) {
|
|
log.error('file not found: ' + file)
|
|
return
|
|
}
|
|
|
|
var abs = fd.realpath(file)
|
|
var file_info = shop.file_info(abs)
|
|
var pkg = file_info.package
|
|
|
|
build.compile_native(abs, null, null, pkg)
|