You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2014/10/08 00:52:49 UTC
[6/6] git commit: Support Makefile rules for static libraries.
Support Makefile rules for static libraries.
Project: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/commit/98f53fb0
Tree: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/tree/98f53fb0
Diff: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/diff/98f53fb0
Branch: refs/heads/master
Commit: 98f53fb093961beb66bee06c22ee46fb447c25a8
Parents: 303df8a
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Tue Sep 23 17:53:05 2014 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Tue Sep 23 17:53:05 2014 -0700
----------------------------------------------------------------------
src/Charmonizer/Core/Make.c | 51 ++++++++++++++++++++++++++++++++++++++++
src/Charmonizer/Core/Make.h | 11 +++++++++
2 files changed, 62 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/98f53fb0/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/src/Charmonizer/Core/Make.c b/src/Charmonizer/Core/Make.c
index 34911c8..a45fdd5 100644
--- a/src/Charmonizer/Core/Make.c
+++ b/src/Charmonizer/Core/Make.c
@@ -407,6 +407,57 @@ chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, chaz_Lib *lib,
}
chaz_MakeRule*
+chaz_MakeFile_add_static_lib(chaz_MakeFile *makefile, chaz_Lib *lib,
+ const char *objects) {
+ const char *shlib_ext = chaz_OS_shared_lib_ext();
+ chaz_MakeRule *rule;
+ char *filename;
+ char *command;
+
+ filename = chaz_Lib_filename(lib);
+ rule = chaz_MakeFile_add_rule(makefile, filename, objects);
+ command = chaz_CC_format_archiver_command(filename, objects);
+ chaz_MakeRule_add_command(rule, command);
+ free(command);
+ command = chaz_CC_format_ranlib_command(filename);
+ if (command) {
+ chaz_MakeRule_add_command(rule, command);
+ free(command);
+ }
+ chaz_MakeRule_add_rm_command(makefile->clean, filename);
+
+ /* Add symlinks. */
+ if (strcmp(shlib_ext, ".dll") != 0) {
+ char *major_v_name = chaz_Lib_major_version_filename(lib);
+ char *no_v_name = chaz_Lib_no_version_filename(lib);
+
+ command = chaz_Util_join(" ", "ln -sf", filename, major_v_name, NULL);
+ chaz_MakeRule_add_command(rule, command);
+ free(command);
+
+ if (strcmp(shlib_ext, ".dylib") == 0) {
+ command = chaz_Util_join(" ", "ln -sf", filename, no_v_name,
+ NULL);
+ }
+ else {
+ command = chaz_Util_join(" ", "ln -sf", major_v_name, no_v_name,
+ NULL);
+ }
+ chaz_MakeRule_add_command(rule, command);
+ free(command);
+
+ chaz_MakeRule_add_rm_command(makefile->clean, major_v_name);
+ chaz_MakeRule_add_rm_command(makefile->clean, no_v_name);
+
+ free(major_v_name);
+ free(no_v_name);
+ }
+
+ free(filename);
+ return rule;
+}
+
+chaz_MakeRule*
chaz_MakeFile_add_lemon_exe(chaz_MakeFile *makefile, const char *dir) {
chaz_CFlags *cflags = chaz_CC_new_cflags();
chaz_MakeRule *rule;
http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/98f53fb0/src/Charmonizer/Core/Make.h
----------------------------------------------------------------------
diff --git a/src/Charmonizer/Core/Make.h b/src/Charmonizer/Core/Make.h
index ce8b3e5..e15c3a4 100644
--- a/src/Charmonizer/Core/Make.h
+++ b/src/Charmonizer/Core/Make.h
@@ -151,6 +151,17 @@ chaz_MakeRule*
chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, chaz_Lib *lib,
const char *sources, chaz_CFlags *link_flags);
+/** Add a rule to create a static library. The static library will also be added
+ * to the list of files to clean.
+ *
+ * @param makefile The makefile.
+ * @param lib The static library.
+ * @param objects The list of object files to be archived.
+ */
+chaz_MakeRule*
+chaz_MakeFile_add_static_lib(chaz_MakeFile *makefile, chaz_Lib *lib,
+ const char *objects);
+
/** Add a rule to build the lemon parser generator.
*
* @param makefile The makefile.