summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-02-21 11:28:30 +0800
committerruki <[email protected]>2017-02-21 11:28:30 +0800
commit4d635c3a48b87f92866ebfbc229558becf896158 (patch)
treeee06a532b0f10dfe889f869b5e6981d888770336
parent02aa42bce096ac637a932c2c96cf0d538746308a (diff)
add dlang languages and tools for macosx
-rw-r--r--tests/console_dlang/src/main.d6
-rwxr-xr-xtests/console_dlang/xmake.lua32
-rw-r--r--tests/console_go/src/main.go8
-rwxr-xr-xxmake/actions/config/xmake.lua2
-rwxr-xr-xxmake/actions/global/xmake.lua2
-rw-r--r--xmake/core/base/os.lua2
-rw-r--r--xmake/core/tool/debugger.lua2
-rw-r--r--xmake/languages/dlang/api.lua56
-rw-r--r--xmake/languages/dlang/check_main.lua44
-rw-r--r--xmake/languages/dlang/load.lua38
-rwxr-xr-xxmake/languages/dlang/xmake.lua124
-rwxr-xr-xxmake/languages/golang/xmake.lua29
-rw-r--r--xmake/platforms/linux/check.lua10
-rw-r--r--xmake/platforms/macosx/check.lua20
-rw-r--r--xmake/platforms/windows/check.lua8
-rwxr-xr-xxmake/tools/dmd.lua122
16 files changed, 467 insertions, 38 deletions
diff --git a/tests/console_dlang/src/main.d b/tests/console_dlang/src/main.d
new file mode 100644
index 000000000..524c4f94c
--- /dev/null
+++ b/tests/console_dlang/src/main.d
@@ -0,0 +1,6 @@
+import std.stdio;
+
+void main()
+{
+ writeln("hello world!");
+}
diff --git a/tests/console_dlang/xmake.lua b/tests/console_dlang/xmake.lua
new file mode 100755
index 000000000..2f040a763
--- /dev/null
+++ b/tests/console_dlang/xmake.lua
@@ -0,0 +1,32 @@
+-- the debug mode
+if is_mode("debug") then
+
+ -- enable the debug symbols
+ set_symbols("debug")
+
+ -- disable optimization
+ set_optimize("none")
+end
+
+-- the release mode
+if is_mode("release") then
+
+ -- set the symbols visibility: hidden
+ set_symbols("hidden")
+
+ -- enable fastest optimization
+ set_optimize("fastest")
+
+ -- strip all symbols
+ set_strip("all")
+end
+
+-- add target
+target("console_dlang")
+
+ -- set kind
+ set_kind("binary")
+
+ -- add files
+ add_files("src/*.d")
+
diff --git a/tests/console_go/src/main.go b/tests/console_go/src/main.go
index c91ae5091..8ea127243 100644
--- a/tests/console_go/src/main.go
+++ b/tests/console_go/src/main.go
@@ -1,11 +1,3 @@
-/*!The Qiyi Golang Backend Server
- *
- * Copyright (C) 2016, qiyi.com All rights reserved.
- *
- * @author ruki
- * @file main.go
- *
- */
package main
/* /////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua
index cc9bf0e28..3effd29bb 100755
--- a/xmake/actions/config/xmake.lua
+++ b/xmake/actions/config/xmake.lua
@@ -123,7 +123,7 @@ task("config")
, " - sdk/include" }
, {}
- , {nil, "dd", "kv", "auto", "The Debugger" }
+ , {nil, "dg", "kv", "auto", "The Debugger" }
-- show language menu options
, function ()
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index 0cf4e605e..4af28342f 100755
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -54,7 +54,7 @@ task("global")
, " --ccache=[y|n]" }
, {}
- , {nil, "dd", "kv", "auto", "The Debugger" }
+ , {nil, "dg", "kv", "auto", "The Debugger" }
, {}
-- show platform menu options
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 6928e293b..9fcae713a 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -416,7 +416,7 @@ end
function os.tmpfile()
-- make it
- return path.join(os.tmpdir(), (os.uuid():gsub("-", "")))
+ return path.join(os.tmpdir(), "_" .. (os.uuid():gsub("-", "")))
end
-- run shell
diff --git a/xmake/core/tool/debugger.lua b/xmake/core/tool/debugger.lua
index c6f223f87..a906b7371 100644
--- a/xmake/core/tool/debugger.lua
+++ b/xmake/core/tool/debugger.lua
@@ -55,7 +55,7 @@ function debugger.load()
local instance = table.inherit(debugger)
-- load the debugger tool
- local result, errors = tool.load("dd")
+ local result, errors = tool.load("dg")
if not result then
return nil, errors
end
diff --git a/xmake/languages/dlang/api.lua b/xmake/languages/dlang/api.lua
new file mode 100644
index 000000000..60441d086
--- /dev/null
+++ b/xmake/languages/dlang/api.lua
@@ -0,0 +1,56 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file api.lua
+--
+
+-- get apis
+function apis()
+
+ -- init apis
+ _g.values =
+ {
+ -- target.add_xxx
+ "target.add_links"
+ , "target.add_goflags"
+ , "target.add_ldflags"
+ , "target.add_arflags"
+ , "target.add_shflags"
+ -- option.add_xxx
+ , "option.add_links"
+ , "option.add_goflags"
+ , "option.add_ldflags"
+ , "option.add_arflags"
+ , "option.add_shflags"
+ }
+ _g.pathes =
+ {
+ -- target.add_xxx
+ "target.add_linkdirs"
+ -- option.add_xxx
+ , "option.add_linkdirs"
+ }
+
+ -- ok
+ return _g
+end
+
+
diff --git a/xmake/languages/dlang/check_main.lua b/xmake/languages/dlang/check_main.lua
new file mode 100644
index 000000000..286485147
--- /dev/null
+++ b/xmake/languages/dlang/check_main.lua
@@ -0,0 +1,44 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file check_main.lua
+--
+
+-- check it
+function main(sourcefile)
+
+ -- load source code
+ local sourcecode = io.read(sourcefile)
+
+ -- remove comment first
+ sourcecode = sourcecode:gsub("/%*.-%*/", "")
+ sourcecode = sourcecode:gsub("//.-\n", "\n")
+
+ -- find func main() {
+ if sourcecode:find("void%s+main%s*%(.-%)") then
+ return true
+ end
+
+ -- no main function
+ return false
+end
+
+
diff --git a/xmake/languages/dlang/load.lua b/xmake/languages/dlang/load.lua
new file mode 100644
index 000000000..4eb290d07
--- /dev/null
+++ b/xmake/languages/dlang/load.lua
@@ -0,0 +1,38 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file load.lua
+--
+
+-- imports
+import("api")
+
+-- load it
+function main()
+
+ -- init apis
+ _g.apis = api.apis()
+
+ -- ok
+ return _g
+end
+
+
diff --git a/xmake/languages/dlang/xmake.lua b/xmake/languages/dlang/xmake.lua
new file mode 100755
index 000000000..a6fb829fb
--- /dev/null
+++ b/xmake/languages/dlang/xmake.lua
@@ -0,0 +1,124 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file xmake.lua
+--
+
+-- define language
+language("dlang")
+
+ -- set source file kinds
+ set_sourcekinds {dd = ".d"}
+
+ -- set source file flags
+ set_sourceflags {dd = "dflags"}
+
+ -- set target kinds
+ set_targetkinds {binary = "dd-ld", static = "dd-ar", shared = "dd-sh"}
+
+ -- set target flags
+ set_targetflags {binary = "dd-ldflags", static = "dd-arflags", shared = "dd-shflags"}
+
+ -- on load
+ on_load("load")
+
+ -- on check_main
+ on_check_main("check_main")
+
+ -- set name flags
+ set_nameflags
+ {
+ object =
+ {
+ "config.includedirs"
+ , "target.symbols"
+ , "target.warnings"
+ , "target.optimize:check"
+ , "target.vectorexts:check"
+ , "target.defines"
+ , "target.undefines"
+ , "target.includedirs"
+ , "platform.includedirs"
+ , "platform.defines"
+ , "platform.undefines"
+ }
+ , binary =
+ {
+ "config.linkdirs"
+ , "target.linkdirs"
+ , "target.strip"
+ , "target.symbols"
+ , "option.linkdirs"
+ , "platform.linkdirs"
+ , "config.links"
+ , "target.links"
+ , "option.links"
+ , "platform.links"
+ }
+ , shared =
+ {
+ "config.linkdirs"
+ , "target.linkdirs"
+ , "target.strip"
+ , "target.symbols"
+ , "option.linkdirs"
+ , "platform.linkdirs"
+ , "config.links"
+ , "target.links"
+ , "option.links"
+ , "platform.links"
+ }
+ , static =
+ {
+ "target.strip"
+ , "target.symbols"
+ }
+ }
+
+ -- set menu
+ set_menu {
+ config =
+ {
+ { }
+ , {nil, "dd", "kv", nil, "The Dlang Compiler" }
+ , {nil, "dflags", "kv", nil, "The Dlang Compiler Flags" }
+
+ , { }
+ , {nil, "dd-ld", "kv", nil, "The Dlang Linker" }
+ , {nil, "dd-ldflags", "kv", nil, "The Dlang Linker Flags" }
+
+ , { }
+ , {nil, "dd-ar", "kv", nil, "The Dlang Static Library Archiver" }
+ , {nil, "dd-arflags", "kv", nil, "The Dlang Static Library Archvier Flags" }
+
+
+ , { }
+ , {nil, "dd-sh", "kv", nil, "The Dlang Shared Library Linker" }
+ , {nil, "dd-shflags", "kv", nil, "The Dlang Shared Library Linker Flags" }
+
+ -- TODO
+ , { }
+ , {nil, "links", "kv", nil, "The Link Libraries" }
+ , {nil, "linkdirs", "kv", nil, "The Link Search Directories" }
+ , {nil, "includedirs","kv", nil, "The Include Search Directories" }
+ }
+ }
+
diff --git a/xmake/languages/golang/xmake.lua b/xmake/languages/golang/xmake.lua
index 04f915e5e..ab2e7566c 100755
--- a/xmake/languages/golang/xmake.lua
+++ b/xmake/languages/golang/xmake.lua
@@ -97,22 +97,23 @@ language("golang")
set_menu {
config =
{
- {}
- , {nil, "go", "kv", nil, "The Golang Compiler" }
- , {nil, "goflags", "kv", nil, "The Golang Compiler Flags" }
+ { }
+ , {nil, "go", "kv", nil, "The Golang Compiler" }
+ , {nil, "goflags", "kv", nil, "The Golang Compiler Flags" }
- , {}
- , {nil, "go-ld", "kv", nil, "The Linker" }
- , {nil, "go-ldflags", "kv", nil, "The Binary Linker Flags" }
+ , { }
+ , {nil, "go-ld", "kv", nil, "The Golang Linker" }
+ , {nil, "go-ldflags", "kv", nil, "The Golang Linker Flags" }
- , {}
- , {nil, "go-ar", "kv", nil, "The Static Library Linker" }
- , {nil, "go-arflags", "kv", nil, "The Static Library Linker Flags" }
+ , { }
+ , {nil, "go-ar", "kv", nil, "The Golang Static Library Linker" }
+ , {nil, "go-arflags", "kv", nil, "The Golang Static Library Linker Flags" }
- , {}
- , {nil, "links", "kv", nil, "The Link Libraries" }
- , {nil, "linkdirs", "kv", nil, "The Link Search Directories" }
- , {nil, "includedirs","kv", nil, "The Include Search Directories" }
- }
+ -- TODO
+ , { }
+ , {nil, "links", "kv", nil, "The Link Libraries" }
+ , {nil, "linkdirs", "kv", nil, "The Link Search Directories" }
+ , {nil, "includedirs","kv", nil, "The Include Search Directories" }
+ }
}
diff --git a/xmake/platforms/linux/check.lua b/xmake/platforms/linux/check.lua
index 6c92ec684..8b0c38dc6 100644
--- a/xmake/platforms/linux/check.lua
+++ b/xmake/platforms/linux/check.lua
@@ -78,7 +78,7 @@ function _check_toolchains(config)
checker.check_toolchain_from_env(config, "ex", "AR", "the static library extractor")
checker.check_toolchain_from_env(config, "sh", "SH", "the shared library linker")
checker.check_toolchain_from_env(config, "sc", "SC", "the swift compiler")
- checker.check_toolchain_from_env(config, "dd", "DD", "the debugger")
+ checker.check_toolchain_from_env(config, "dg", "DD", "the debugger")
end
-- check for gcc
@@ -95,7 +95,7 @@ function _check_toolchains(config)
checker.check_toolchain(config, "ex", cross, "ar", "the static library extractor")
checker.check_toolchain(config, "sh", cross, "g++", "the shared library linker")
checker.check_toolchain(config, "sh", cross, "gcc", "the shared library linker")
- checker.check_toolchain(config, "dd", cross, "gdb", "the debugger")
+ checker.check_toolchain(config, "dg", cross, "gdb", "the debugger")
-- check for clang
checker.check_toolchain(config, "cc", cross, "clang", "the c compiler")
@@ -112,13 +112,13 @@ function _check_toolchains(config)
checker.check_toolchain(config, "sh", cross, "clang++", "the shared library linker")
checker.check_toolchain(config, "sh", cross, "clang", "the shared library linker")
checker.check_toolchain(config, "sc", cross, "swiftc", "the swift compiler")
- checker.check_toolchain(config, "dd", cross, "lldb", "the debugger")
+ checker.check_toolchain(config, "dg", cross, "lldb", "the debugger")
-- check for golang tools
checker.check_toolchain(config, "go", "", "go", "the golang compiler")
checker.check_toolchain(config, "go", "", "gccgo", "the golang compiler")
- checker.check_toolchain(config, "go-ar","", "go", "the golang archiver")
- checker.check_toolchain(config, "go-ar","", "gccgo", "the golang archiver")
+ checker.check_toolchain(config, "go-ar","", "go", "the golang static library archiver")
+ checker.check_toolchain(config, "go-ar","", "gccgo", "the golang static library archiver")
checker.check_toolchain(config, "go-ld","", "go", "the golang linker")
checker.check_toolchain(config, "go-ld","", "gccgo", "the golang linker")
end
diff --git a/xmake/platforms/macosx/check.lua b/xmake/platforms/macosx/check.lua
index fd11d6fb2..6a670534b 100644
--- a/xmake/platforms/macosx/check.lua
+++ b/xmake/platforms/macosx/check.lua
@@ -74,15 +74,29 @@ function _check_toolchains(config)
checker.check_toolchain(config, "ex", "", "ar", "the static library extractor")
checker.check_toolchain(config, "sh", "", "clang++", "the shared library linker")
checker.check_toolchain(config, "sh", "", "clang", "the shared library linker")
- checker.check_toolchain(config, "dd", "", "lldb", "the debugger")
+ checker.check_toolchain(config, "dg", "", "lldb", "the debugger")
-- check for golang tools
checker.check_toolchain(config, "go", "", "go", "the golang compiler")
checker.check_toolchain(config, "go", "", "gccgo", "the golang compiler")
- checker.check_toolchain(config, "go-ar","", "go", "the golang archiver")
- checker.check_toolchain(config, "go-ar","", "gccgo", "the golang archiver")
+ checker.check_toolchain(config, "go-ar","", "go", "the golang static library archiver")
+ checker.check_toolchain(config, "go-ar","", "gccgo", "the golang static library archiver")
checker.check_toolchain(config, "go-ld","", "go", "the golang linker")
checker.check_toolchain(config, "go-ld","", "gccgo", "the golang linker")
+
+ -- check for dlang tools
+ checker.check_toolchain(config, "dd", "", "dmd", "the dlang compiler")
+ checker.check_toolchain(config, "dd", "", "ldc2", "the dlang compiler")
+ checker.check_toolchain(config, "dd", "", "gdc", "the dlang compiler")
+ checker.check_toolchain(config, "dd-ar","", "dmd", "the dlang static library archiver")
+ checker.check_toolchain(config, "dd-ar","", "ldc2", "the dlang static library archiver")
+ checker.check_toolchain(config, "dd-ar","", "gdc", "the dlang static library archiver")
+ checker.check_toolchain(config, "dd-sh","", "dmd", "the dlang shared library linker")
+ checker.check_toolchain(config, "dd-sh","", "ldc2", "the dlang shared library linker")
+ checker.check_toolchain(config, "dd-sh","", "gdc", "the dlang shared library linker")
+ checker.check_toolchain(config, "dd-ld","", "dmd", "the dlang linker")
+ checker.check_toolchain(config, "dd-ld","", "ldc2", "the dlang linker")
+ checker.check_toolchain(config, "dd-ld","", "gdc", "the dlang linker")
end
-- check it
diff --git a/xmake/platforms/windows/check.lua b/xmake/platforms/windows/check.lua
index 6d8411e92..d66f4308c 100644
--- a/xmake/platforms/windows/check.lua
+++ b/xmake/platforms/windows/check.lua
@@ -208,8 +208,8 @@ function _check_toolchains(config)
-- check for golang tools
checker.check_toolchain(config, "go", "", "go", "the golang compiler")
checker.check_toolchain(config, "go", "", "gccgo", "the golang compiler")
- checker.check_toolchain(config, "go-ar","", "go", "the golang archiver")
- checker.check_toolchain(config, "go-ar","", "gccgo", "the golang archiver")
+ checker.check_toolchain(config, "go-ar","", "go", "the golang static library archiver")
+ checker.check_toolchain(config, "go-ar","", "gccgo", "the golang static library archiver")
checker.check_toolchain(config, "go-ld","", "go", "the golang linker")
checker.check_toolchain(config, "go-ld","", "gccgo", "the golang linker")
end
@@ -218,7 +218,7 @@ end
function _check_debugger(config)
-- get debugger
- local debugger = config.get("dd")
+ local debugger = config.get("dg")
if debugger then
return
end
@@ -262,7 +262,7 @@ function _check_debugger(config)
if debugger then
-- save it
- config.set("dd", debugger)
+ config.set("dg", debugger)
-- trace
print("checking for the debugger ... %s", path.filename(debugger))
diff --git a/xmake/tools/dmd.lua b/xmake/tools/dmd.lua
new file mode 100755
index 000000000..3be2f5d12
--- /dev/null
+++ b/xmake/tools/dmd.lua
@@ -0,0 +1,122 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file dmd.lua
+--
+
+-- imports
+import("core.tool.tool")
+import("core.base.option")
+import("core.project.config")
+import("core.project.project")
+
+-- init it
+function init(shellname, kind)
+
+ -- save the shell name
+ _g.shellname = shellname or "dmd"
+
+ -- save the kind
+ _g.kind = kind
+
+ -- init features
+ _g.features =
+ {
+ ["compile:multifiles"] = false
+ }
+end
+
+-- get the property
+function get(name)
+
+ -- get it
+ return _g[name]
+end
+
+-- make the includedir flag
+function nf_includedir(dir)
+
+ -- make it
+ return "-I " .. dir
+end
+
+-- make the linkdir flag
+function nf_linkdir(dir)
+
+ -- make it
+ return "-L " .. dir
+end
+
+-- make the link command
+function linkcmd(objectfiles, targetkind, targetfile, flags)
+
+ -- make it
+ if targetkind == "static" then
+ return format("%s tool pack %s %s %s", _g.shellname, flags, targetfile, objectfiles)
+ else
+ return format("%s tool link %s -o %s %s", _g.shellname, flags, targetfile, objectfiles)
+ end
+end
+
+-- link the target file
+function link(objectfiles, targetkind, targetfile, flags)
+
+ -- ensure the target directory
+ os.mkdir(path.directory(targetfile))
+
+ -- link it
+ os.run(linkcmd(objectfiles, targetkind, targetfile, flags))
+end
+
+-- make the complie command
+function compcmd(sourcefiles, objectfile, flags)
+
+ -- make it
+ return format("%s %s -of%s %s", _g.shellname, flags, objectfile, table.concat(table.wrap(sourcefiles), " "))
+end
+
+-- complie the source file
+function compile(sourcefiles, objectfile, incdepfile, flags)
+
+ -- ensure the object directory
+ os.mkdir(path.directory(objectfile))
+
+ -- compile it
+ os.run(compcmd(sourcefiles, objectfile, flags))
+end
+
+-- check the given flags
+function check(flags)
+
+ -- make an stub source file
+ local objectfile = os.tmpfile() .. ".o"
+ local sourcefile = os.tmpfile() .. ".d"
+
+ -- make stub code
+ io.write(sourcefile, "void main() {\n}")
+
+ -- check it
+ os.run("%s %s -of%s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
+
+ -- remove files
+ os.rm(objectfile)
+ os.rm(sourcefile)
+end