diff options
| author | ruki <[email protected]> | 2015-06-02 11:38:44 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-02 11:38:44 +0800 |
| commit | e1498eebcd687db0ccd8786906746642a173c01a (patch) | |
| tree | d93258273e977dcd7a878cdd7ab29579c0473ae2 | |
| parent | 4b85064e874d050de835f4a4a0b2158f1405a6aa (diff) | |
impl build
| -rw-r--r-- | tests/console/xmake.xproj | 9 | ||||
| -rw-r--r-- | xmake/scripts/base/makefile.lua | 28 | ||||
| -rw-r--r-- | xmake/scripts/linker/_clang.lua | 2 | ||||
| -rw-r--r-- | xmake/scripts/platform/android/_android.lua | 2 | ||||
| -rw-r--r-- | xmake/scripts/platform/iphoneos/_iphoneos.lua | 2 | ||||
| -rw-r--r-- | xmake/scripts/platform/iphonesimulator/_iphonesimulator.lua | 2 | ||||
| -rw-r--r-- | xmake/scripts/platform/linux/_linux.lua | 2 | ||||
| -rw-r--r-- | xmake/scripts/platform/macosx/_macosx.lua | 2 |
8 files changed, 26 insertions, 23 deletions
diff --git a/tests/console/xmake.xproj b/tests/console/xmake.xproj index ac39513b0..4bf7e7d4a 100644 --- a/tests/console/xmake.xproj +++ b/tests/console/xmake.xproj @@ -54,8 +54,8 @@ project: console deps: hello1 files: src/demo/*.c links: hello1 - linkdirs: $(buildir)/src/hello1 - includedirs: $(buildir)/src/hello1 + linkdirs: $(buildir) + includedirs: $(buildir) cflags: -DHELLO1 # the modes @@ -71,8 +71,8 @@ project: console deps: hello2 files: src/demo/*.cpp links: hello2 - linkdirs: $(buildir)/src/hello2 - includedirs: $(buildir)/src/hello2 + linkdirs: $(buildir) + includedirs: $(buildir) cxxflags: -DHELLO1 } @@ -109,7 +109,6 @@ project: console platforms: macosx, ios { ldflags: -framework Cocoa, "-framework IOKit" - , -framework UIKit , -framework CoreFoundation } } diff --git a/xmake/scripts/base/makefile.lua b/xmake/scripts/base/makefile.lua index 1a3bbbbe6..b39da2f86 100644 --- a/xmake/scripts/base/makefile.lua +++ b/xmake/scripts/base/makefile.lua @@ -77,22 +77,26 @@ function makefile._srcfiles(target) end -- get object files for the given source files -function makefile._objfiles(name, srcfiles) +function makefile._objfiles(target, name, srcfiles) -- check - assert(name and srcfiles) + assert(target and name and srcfiles) -- the build directory local buildir = config.get("buildir") assert(buildir) + -- the object directory + local objectdir = target.objectdir or buildir .. "/.objs" + assert(objectdir and type(objectdir) == "string") + -- make object files local i = 1 local objfiles = {} for _, srcfile in ipairs(srcfiles) do -- make object file - local objfile = string.format("%s/%s/%s/%s", buildir, name, path.directory(srcfile), platform.filename(path.basename(srcfile), "object")) + local objfile = string.format("%s/%s/%s/%s", objectdir, name, path.directory(srcfile), platform.filename(path.basename(srcfile), "object")) -- save it objfiles[i] = path.translate(objfile) @@ -105,21 +109,21 @@ function makefile._objfiles(name, srcfiles) end -- get target file for the given target name and kind -function makefile._targetfile(name, kind) +function makefile._targetfile(name, target) -- check - assert(name and kind) + assert(name and target and target.kind) - -- the build directory - local buildir = config.get("buildir") - assert(buildir) + -- the target directory + local targetdir = target.targetdir or config.get("buildir") + assert(targetdir and type(targetdir) == "string") -- the target file name - local filename = platform.filename(name, kind) + local filename = platform.filename(name, target.kind) assert(filename) -- make the target file path - return buildir .. "/" .. name .. "/" .. filename + return targetdir .. "/" .. filename end -- make the object to the makefile @@ -185,11 +189,11 @@ function makefile._make_target(file, name, target) -- get source and object files local srcfiles = makefile._srcfiles(target) - local objfiles = makefile._objfiles(name, srcfiles) + local objfiles = makefile._objfiles(target, name, srcfiles) assert(srcfiles and objfiles) -- get target file - local targetfile = makefile._targetfile(name, target.kind) + local targetfile = makefile._targetfile(name, target) assert(targetfile) -- the linker diff --git a/xmake/scripts/linker/_clang.lua b/xmake/scripts/linker/_clang.lua index c5d778e04..7cb0ed859 100644 --- a/xmake/scripts/linker/_clang.lua +++ b/xmake/scripts/linker/_clang.lua @@ -54,7 +54,7 @@ end function _clang._make(configs, objfiles, targetfile, flags) -- make it - return string.format("%s %s -o%s %s", configs.name, flags, objfiles, targetfile) + return string.format("%s %s -o%s %s", configs.name, flags, targetfile, objfiles) end -- make the link flag diff --git a/xmake/scripts/platform/android/_android.lua b/xmake/scripts/platform/android/_android.lua index 112d464dd..49dd8ce0e 100644 --- a/xmake/scripts/platform/android/_android.lua +++ b/xmake/scripts/platform/android/_android.lua @@ -42,7 +42,7 @@ function _android.make(configs) configs.format = {} configs.format.static = {"lib", ".a"} configs.format.object = {"", ".o"} - configs.format.shared = {"", ".so"} + configs.format.shared = {"lib", ".so"} end diff --git a/xmake/scripts/platform/iphoneos/_iphoneos.lua b/xmake/scripts/platform/iphoneos/_iphoneos.lua index 5fbea1558..9242da6da 100644 --- a/xmake/scripts/platform/iphoneos/_iphoneos.lua +++ b/xmake/scripts/platform/iphoneos/_iphoneos.lua @@ -42,7 +42,7 @@ function _iphoneos.make(configs) configs.format = {} configs.format.static = {"lib", ".a"} configs.format.object = {"", ".o"} - configs.format.shared = {"", ".dylib"} + configs.format.shared = {"lib", ".dylib"} -- init xcode sdk directory configs.xcode_sdkdir = config.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" .. config.get("xcode_sdkver") .. ".sdk" diff --git a/xmake/scripts/platform/iphonesimulator/_iphonesimulator.lua b/xmake/scripts/platform/iphonesimulator/_iphonesimulator.lua index 5028f8bbb..f2d01244a 100644 --- a/xmake/scripts/platform/iphonesimulator/_iphonesimulator.lua +++ b/xmake/scripts/platform/iphonesimulator/_iphonesimulator.lua @@ -42,7 +42,7 @@ function _iphonesimulator.make(configs) configs.format = {} configs.format.static = {"lib", ".a"} configs.format.object = {"", ".o"} - configs.format.shared = {"", ".dylib"} + configs.format.shared = {"lib", ".dylib"} -- init xcode sdk directory configs.xcode_sdkdir = config.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" .. config.get("xcode_sdkver") .. ".sdk" diff --git a/xmake/scripts/platform/linux/_linux.lua b/xmake/scripts/platform/linux/_linux.lua index 391a4d2cd..cd1fdd139 100644 --- a/xmake/scripts/platform/linux/_linux.lua +++ b/xmake/scripts/platform/linux/_linux.lua @@ -42,7 +42,7 @@ function _linux.make(configs) configs.format = {} configs.format.static = {"lib", ".a"} configs.format.object = {"", ".o"} - configs.format.shared = {"", ".so"} + configs.format.shared = {"lib", ".so"} end -- get the option menu for action: xmake config or global diff --git a/xmake/scripts/platform/macosx/_macosx.lua b/xmake/scripts/platform/macosx/_macosx.lua index 532a540df..6ab67da0f 100644 --- a/xmake/scripts/platform/macosx/_macosx.lua +++ b/xmake/scripts/platform/macosx/_macosx.lua @@ -42,7 +42,7 @@ function _macosx.make(configs) configs.format = {} configs.format.static = {"lib", ".a"} configs.format.object = {"", ".o"} - configs.format.shared = {"", ".dylib"} + configs.format.shared = {"lib", ".dylib"} -- init the compiler configs.compiler = {} |
