You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/03/09 18:14:55 UTC

[lucy-commits] [8/16] git commit: refs/heads/c-bindings-wip3 - Rework chaz_MakeFile_add_{exe|shared_obj}

Rework chaz_MakeFile_add_{exe|shared_obj}

* Add extra_link_flags
* Return added rule


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/e6c3ffde
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/e6c3ffde
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/e6c3ffde

Branch: refs/heads/c-bindings-wip3
Commit: e6c3ffde69b56c8626151c83cedd93d627c641fc
Parents: 90153df
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Feb 24 19:52:18 2013 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Mar 9 17:51:54 2013 +0100

----------------------------------------------------------------------
 charmonizer/src/Charmonizer/Core/Make.c    |   26 +++++++++++++++--------
 charmonizer/src/Charmonizer/Core/Make.h    |   11 ++++++---
 clownfish/compiler/common/charmonizer.main |    6 ++--
 3 files changed, 27 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/e6c3ffde/charmonizer/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.c b/charmonizer/src/Charmonizer/Core/Make.c
index 3470af1..ec9e5d1 100644
--- a/charmonizer/src/Charmonizer/Core/Make.c
+++ b/charmonizer/src/Charmonizer/Core/Make.c
@@ -225,10 +225,10 @@ chaz_MakeFile_add_to_cleanup(chaz_MakeFile *makefile, const char *target) {
     makefile->num_cleanups = num_cleanups;
 }
 
-void
+chaz_MakeRule*
 chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
-                      const char *objects) {
-    const char    *pattern     = "%s %s %s %s%s";
+                      const char *objects, const char *extra_link_flags) {
+    const char    *pattern     = "%s %s %s %s %s%s";
     const char    *link        = chaz_CC_link_command();
     const char    *link_flags  = chaz_CC_link_flags();
     const char    *output_flag = chaz_CC_link_output_flag();
@@ -241,21 +241,26 @@ chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
     size = strlen(pattern)
            + strlen(link)
            + strlen(link_flags)
+           + strlen(extra_link_flags)
            + strlen(objects)
            + strlen(output_flag)
            + strlen(exe)
            + 50;
     command = (char*)malloc(size);
-    sprintf(command, pattern, link, link_flags, objects, output_flag, exe);
+    sprintf(command, pattern, link, link_flags, extra_link_flags, objects,
+            output_flag, exe);
     chaz_MakeRule_add_command(rule, command);
 
     chaz_MakeFile_add_to_cleanup(makefile, exe);
+
+    return rule;
 }
 
-void
+chaz_MakeRule*
 chaz_MakeFile_add_shared_obj(chaz_MakeFile *makefile, const char *shared_obj,
-                             const char *objects) {
-    const char    *pattern     = "%s %s %s %s %s%s";
+                             const char *objects,
+                             const char *extra_link_flags) {
+    const char    *pattern     = "%s %s %s %s %s %s%s";
     const char    *link        = chaz_CC_link_command();
     const char    *shobj_flags = chaz_CC_link_shared_obj_flag();
     const char    *link_flags  = chaz_CC_link_flags();
@@ -270,16 +275,19 @@ chaz_MakeFile_add_shared_obj(chaz_MakeFile *makefile, const char *shared_obj,
            + strlen(link)
            + strlen(shobj_flags)
            + strlen(link_flags)
+           + strlen(extra_link_flags)
            + strlen(objects)
            + strlen(output_flag)
            + strlen(shared_obj)
            + 50;
     command = (char*)malloc(size);
-    sprintf(command, pattern, link, shobj_flags, link_flags, objects,
-            output_flag, shared_obj);
+    sprintf(command, pattern, link, shobj_flags, link_flags, extra_link_flags,
+            objects, output_flag, shared_obj);
     chaz_MakeRule_add_command(rule, command);
 
     chaz_MakeFile_add_to_cleanup(makefile, shared_obj);
+
+    return rule;
 }
 
 void

http://git-wip-us.apache.org/repos/asf/lucy/blob/e6c3ffde/charmonizer/src/Charmonizer/Core/Make.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.h b/charmonizer/src/Charmonizer/Core/Make.h
index 430ae33..4122b26 100644
--- a/charmonizer/src/Charmonizer/Core/Make.h
+++ b/charmonizer/src/Charmonizer/Core/Make.h
@@ -101,10 +101,11 @@ chaz_MakeFile_add_to_cleanup(chaz_MakeFile *makefile, const char *target);
  * @param makefile The makefile.
  * @param exe The name of the executable.
  * @param objects The list of object files.
+ * @param extra_link_flags Additional link flags.
  */
-void
+chaz_MakeRule*
 chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
-                      const char *objects);
+                      const char *objects, const char *extra_link_flags);
 
 /** Add a rule to link a shared object. The shared object will also be added to
  * the list of files to clean.
@@ -112,10 +113,12 @@ chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe,
  * @param makefile The makefile.
  * @param shared_obj The name of the shared object.
  * @param objects The list of object files.
+ * @param extra_link_flags Additional link flags.
  */
-void
+chaz_MakeRule*
 chaz_MakeFile_add_shared_obj(chaz_MakeFile *makefile, const char *shared_obj,
-                             const char *objects);
+                             const char *objects,
+                             const char *extra_link_flags);
 
 /** Write the makefile to a file named 'Makefile' in the current directory.
  *

http://git-wip-us.apache.org/repos/asf/lucy/blob/e6c3ffde/clownfish/compiler/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.main b/clownfish/compiler/common/charmonizer.main
index 4b45c3a..b28d71c 100644
--- a/clownfish/compiler/common/charmonizer.main
+++ b/clownfish/compiler/common/charmonizer.main
@@ -174,7 +174,7 @@ S_write_makefile() {
 
     chaz_MakeFile_add_rule(makefile, "all", "$(CFC_EXE)");
 
-    chaz_MakeFile_add_exe(makefile, "$(LEMON_EXE)", "$(LEMON_OBJS)");
+    chaz_MakeFile_add_exe(makefile, "$(LEMON_EXE)", "$(LEMON_OBJS)", "");
 
     rule = chaz_MakeFile_add_rule(makefile, parse_header_c, NULL);
     chaz_MakeRule_add_prereq(rule, "$(LEMON_EXE)");
@@ -187,9 +187,9 @@ S_write_makefile() {
     chaz_MakeFile_add_rule(makefile, "$(COMMON_OBJS)", parse_header_c);
 
     chaz_MakeFile_add_exe(makefile, "$(CFC_EXE)",
-                          "$(COMMON_OBJS) $(CFC_OBJS)");
+                          "$(COMMON_OBJS) $(CFC_OBJS)", "");
     chaz_MakeFile_add_exe(makefile, "$(TEST_CFC_EXE)",
-                          "$(COMMON_OBJS) $(TEST_CFC_OBJS)");
+                          "$(COMMON_OBJS) $(TEST_CFC_OBJS)", "");
 
     rule = chaz_MakeFile_add_rule(makefile, "test", "$(TEST_CFC_EXE)");
     chaz_MakeRule_add_command(rule, "$(TEST_CFC_EXE)");