Support portable static lib creation commands. Format commands for `ar` and `ranlib` or equivalent.
Project: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/commit/303df8a5 Tree: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/tree/303df8a5 Diff: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/diff/303df8a5 Branch: refs/heads/master Commit: 303df8a58ba3965127bcb6edc9058bed73a7aec7 Parents: 334b1e7 Author: Marvin Humphrey <[email protected]> Authored: Tue Sep 23 17:49:02 2014 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Tue Sep 23 17:49:02 2014 -0700 ---------------------------------------------------------------------- src/Charmonizer/Core/Compiler.c | 22 ++++++++++++++++++++++ src/Charmonizer/Core/Compiler.h | 15 +++++++++++++++ 2 files changed, 37 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/303df8a5/src/Charmonizer/Core/Compiler.c ---------------------------------------------------------------------- diff --git a/src/Charmonizer/Core/Compiler.c b/src/Charmonizer/Core/Compiler.c index dbe36e7..9317c42 100644 --- a/src/Charmonizer/Core/Compiler.c +++ b/src/Charmonizer/Core/Compiler.c @@ -376,4 +376,26 @@ chaz_CC_link_command() { } } +char* +chaz_CC_format_archiver_command(const char *target, const char *objects) { + if (chaz_CC.intval__MSC_VER) { + /* TODO: Write `objects` to a temporary file in order to avoid + * exceeding line length limits. */ + char *out = chaz_Util_join("", "/OUT:", target, NULL); + char *command = chaz_Util_join(" ", "lib", "/NOLOGO", out, NULL); + free(out); + return command; + } + else { + return chaz_Util_join(" ", "ar", "rcs", target, objects, NULL); + } +} + +char* +chaz_CC_format_ranlib_command(const char *target) { + if (chaz_CC.intval__MSC_VER) { + return NULL; + } + return chaz_Util_join(" ", "ranlib", target, NULL); +} http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/303df8a5/src/Charmonizer/Core/Compiler.h ---------------------------------------------------------------------- diff --git a/src/Charmonizer/Core/Compiler.h b/src/Charmonizer/Core/Compiler.h index e33cf81..af1a7dd 100644 --- a/src/Charmonizer/Core/Compiler.h +++ b/src/Charmonizer/Core/Compiler.h @@ -111,6 +111,21 @@ chaz_CC_sun_c_version_num(void); const char* chaz_CC_link_command(void); +/* Create a command for building a static library. + * + * @param target The target library filename. + * @param objects The list of object files to be archived in the library. + */ +char* +chaz_CC_format_archiver_command(const char *target, const char *objects); + +/* Returns a "ranlib" command if valid. + * + * @param target The library filename. + */ +char* +chaz_CC_format_ranlib_command(const char *target); + #ifdef __cplusplus } #endif
