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 2017/02/04 17:47:39 UTC

[08/11] lucy-clownfish git commit: Update charmonizer code

Update charmonizer code

- CC is now set automatically.
- Simplify runtime valgrind target.
- Remove unused variables.


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

Branch: refs/heads/master
Commit: c9514ada66321ba8f285a9de920a92224a3b15cb
Parents: 931b490
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Feb 3 23:36:14 2017 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Feb 4 18:13:34 2017 +0100

----------------------------------------------------------------------
 compiler/common/charmonizer.c    | 15 +++++++-------
 compiler/common/charmonizer.main |  2 --
 runtime/common/charmonizer.c     | 37 +++++++++++------------------------
 runtime/common/charmonizer.main  | 24 ++++-------------------
 4 files changed, 22 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/c9514ada/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/compiler/common/charmonizer.c b/compiler/common/charmonizer.c
index 08afcf3..d45c84a 100644
--- a/compiler/common/charmonizer.c
+++ b/compiler/common/charmonizer.c
@@ -4923,7 +4923,6 @@ chaz_MakeFile_add_exe(chaz_MakeFile *self, const char *dir,
 
 void
 S_chaz_MakeFile_finish_exe(chaz_MakeFile *self, chaz_MakeBinary *binary) {
-    const char *link = chaz_CC_link_command();
     const char *link_flags_string;
     char *command;
 
@@ -4938,8 +4937,8 @@ S_chaz_MakeFile_finish_exe(chaz_MakeFile *self, chaz_MakeBinary *binary) {
     /* Objects in dollar var must come before flags since flags may
      * contain libraries.
      */
-    command = chaz_Util_join(" ", link, binary->dollar_var, link_flags_string,
-                             NULL);
+    command = chaz_Util_join(" ", "$(LINK)", binary->dollar_var,
+                             link_flags_string, NULL);
     chaz_MakeRule_add_command(binary->rule, command);
     free(command);
 }
@@ -4975,7 +4974,6 @@ chaz_MakeFile_add_shared_lib(chaz_MakeFile *self, const char *dir,
 void
 S_chaz_MakeFile_finish_shared_lib(chaz_MakeFile *self,
                                   chaz_MakeBinary *binary) {
-    const char *link = chaz_CC_link_command();
     const char *link_flags_string;
     int binfmt = chaz_CC_binary_format();
     char *no_v_name
@@ -5000,8 +4998,8 @@ S_chaz_MakeFile_finish_shared_lib(chaz_MakeFile *self,
     chaz_CFlags_set_link_output(binary->link_flags, "$@");
     link_flags_string = chaz_CFlags_get_string(binary->link_flags);
 
-    command = chaz_Util_join(" ", link, binary->dollar_var, link_flags_string,
-                             NULL);
+    command = chaz_Util_join(" ", "$(LINK)", binary->dollar_var,
+                             link_flags_string, NULL);
     chaz_MakeRule_add_command(binary->rule, command);
     free(command);
 
@@ -5185,6 +5183,9 @@ chaz_MakeFile_write(chaz_MakeFile *self) {
         fprintf(out, "SHELL = cmd\n");
     }
 
+    fprintf(out, "CC = %s\n", chaz_CC_get_cc());
+    fprintf(out, "LINK = %s\n", chaz_CC_link_command());
+
     for (i = 0; self->vars[i]; i++) {
         chaz_MakeVar *var = self->vars[i];
         fprintf(out, "%s = %s\n", var->name, var->value);
@@ -8549,8 +8550,6 @@ S_write_makefile(struct chaz_CLI *cli) {
 
     /* C compiler */
 
-    chaz_MakeFile_add_var(makefile, "CC", chaz_CC_get_cc());
-
     makefile_cflags = chaz_CC_new_cflags();
 
     chaz_CFlags_enable_optimization(makefile_cflags);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/c9514ada/compiler/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/compiler/common/charmonizer.main b/compiler/common/charmonizer.main
index 7165cf0..47ad302 100644
--- a/compiler/common/charmonizer.main
+++ b/compiler/common/charmonizer.main
@@ -169,8 +169,6 @@ S_write_makefile(struct chaz_CLI *cli) {
 
     /* C compiler */
 
-    chaz_MakeFile_add_var(makefile, "CC", chaz_CC_get_cc());
-
     makefile_cflags = chaz_CC_new_cflags();
 
     chaz_CFlags_enable_optimization(makefile_cflags);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/c9514ada/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/runtime/common/charmonizer.c b/runtime/common/charmonizer.c
index c9eceb2..e989f0a 100644
--- a/runtime/common/charmonizer.c
+++ b/runtime/common/charmonizer.c
@@ -4923,7 +4923,6 @@ chaz_MakeFile_add_exe(chaz_MakeFile *self, const char *dir,
 
 void
 S_chaz_MakeFile_finish_exe(chaz_MakeFile *self, chaz_MakeBinary *binary) {
-    const char *link = chaz_CC_link_command();
     const char *link_flags_string;
     char *command;
 
@@ -4938,8 +4937,8 @@ S_chaz_MakeFile_finish_exe(chaz_MakeFile *self, chaz_MakeBinary *binary) {
     /* Objects in dollar var must come before flags since flags may
      * contain libraries.
      */
-    command = chaz_Util_join(" ", link, binary->dollar_var, link_flags_string,
-                             NULL);
+    command = chaz_Util_join(" ", "$(LINK)", binary->dollar_var,
+                             link_flags_string, NULL);
     chaz_MakeRule_add_command(binary->rule, command);
     free(command);
 }
@@ -4975,7 +4974,6 @@ chaz_MakeFile_add_shared_lib(chaz_MakeFile *self, const char *dir,
 void
 S_chaz_MakeFile_finish_shared_lib(chaz_MakeFile *self,
                                   chaz_MakeBinary *binary) {
-    const char *link = chaz_CC_link_command();
     const char *link_flags_string;
     int binfmt = chaz_CC_binary_format();
     char *no_v_name
@@ -5000,8 +4998,8 @@ S_chaz_MakeFile_finish_shared_lib(chaz_MakeFile *self,
     chaz_CFlags_set_link_output(binary->link_flags, "$@");
     link_flags_string = chaz_CFlags_get_string(binary->link_flags);
 
-    command = chaz_Util_join(" ", link, binary->dollar_var, link_flags_string,
-                             NULL);
+    command = chaz_Util_join(" ", "$(LINK)", binary->dollar_var,
+                             link_flags_string, NULL);
     chaz_MakeRule_add_command(binary->rule, command);
     free(command);
 
@@ -5185,6 +5183,9 @@ chaz_MakeFile_write(chaz_MakeFile *self) {
         fprintf(out, "SHELL = cmd\n");
     }
 
+    fprintf(out, "CC = %s\n", chaz_CC_get_cc());
+    fprintf(out, "LINK = %s\n", chaz_CC_link_command());
+
     for (i = 0; self->vars[i]; i++) {
         chaz_MakeVar *var = self->vars[i];
         fprintf(out, "%s = %s\n", var->name, var->value);
@@ -8690,14 +8691,12 @@ cfish_MakeFile_destroy(cfish_MakeFile *self) {
 
 static void
 cfish_MakeFile_write(cfish_MakeFile *self, chaz_CFlags *extra_link_flags) {
-    const char *dir_sep = chaz_OS_dir_sep();
-    const char *host    = chaz_CLI_strval(self->cli, "host");
+    const char *host = chaz_CLI_strval(self->cli, "host");
 
     const char *lib_objs      = NULL;
     const char *test_lib_objs = NULL;
 
     chaz_MakeVar  *var;
-    chaz_MakeRule *rule;
 
     chaz_CFlags *extra_cflags = chaz_CC_get_extra_cflags();
     chaz_CFlags *makefile_cflags;
@@ -8712,8 +8711,6 @@ cfish_MakeFile_write(cfish_MakeFile *self, chaz_CFlags *extra_link_flags) {
 
     /* C compiler */
 
-    chaz_MakeFile_add_var(self->makefile, "CC", chaz_CC_get_cc());
-
     makefile_cflags = chaz_CC_new_cflags();
 
     chaz_CFlags_enable_optimization(makefile_cflags);
@@ -8962,23 +8959,11 @@ cfish_MakeFile_write_c_test_rules(cfish_MakeFile *self) {
     chaz_MakeRule_add_command(rule, "$(TEST_CFISH_EXE)");
 
     if (chaz_OS_shell_type() == CHAZ_OS_POSIX) {
-        const char *valgrind_command;
-
         rule = chaz_MakeFile_add_rule(self->makefile, "valgrind",
                                       "$(TEST_CFISH_EXE)");
-        if (chaz_CC_binary_format() == CHAZ_CC_BINFMT_ELF) {
-            valgrind_command = "LD_LIBRARY_PATH=. CLOWNFISH_VALGRIND=1"
-                               " valgrind"
-                               " --leak-check=full"
-                               " $(TEST_CFISH_EXE)";
-        }
-        else {
-            valgrind_command = "CLOWNFISH_VALGRIND=1"
-                               " valgrind"
-                               " --leak-check=full"
-                               " $(TEST_CFISH_EXE)";
-        }
-        chaz_MakeRule_add_command(rule, valgrind_command);
+        chaz_MakeRule_add_command(rule,
+                                  "valgrind --leak-check=full"
+                                  " $(TEST_CFISH_EXE)");
     }
 
     if (chaz_CLI_defined(self->cli, "enable-coverage")) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/c9514ada/runtime/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/runtime/common/charmonizer.main b/runtime/common/charmonizer.main
index e8a21fd..22b8f01 100644
--- a/runtime/common/charmonizer.main
+++ b/runtime/common/charmonizer.main
@@ -310,14 +310,12 @@ cfish_MakeFile_destroy(cfish_MakeFile *self) {
 
 static void
 cfish_MakeFile_write(cfish_MakeFile *self, chaz_CFlags *extra_link_flags) {
-    const char *dir_sep = chaz_OS_dir_sep();
-    const char *host    = chaz_CLI_strval(self->cli, "host");
+    const char *host = chaz_CLI_strval(self->cli, "host");
 
     const char *lib_objs      = NULL;
     const char *test_lib_objs = NULL;
 
     chaz_MakeVar  *var;
-    chaz_MakeRule *rule;
 
     chaz_CFlags *extra_cflags = chaz_CC_get_extra_cflags();
     chaz_CFlags *makefile_cflags;
@@ -332,8 +330,6 @@ cfish_MakeFile_write(cfish_MakeFile *self, chaz_CFlags *extra_link_flags) {
 
     /* C compiler */
 
-    chaz_MakeFile_add_var(self->makefile, "CC", chaz_CC_get_cc());
-
     makefile_cflags = chaz_CC_new_cflags();
 
     chaz_CFlags_enable_optimization(makefile_cflags);
@@ -582,23 +578,11 @@ cfish_MakeFile_write_c_test_rules(cfish_MakeFile *self) {
     chaz_MakeRule_add_command(rule, "$(TEST_CFISH_EXE)");
 
     if (chaz_OS_shell_type() == CHAZ_OS_POSIX) {
-        const char *valgrind_command;
-
         rule = chaz_MakeFile_add_rule(self->makefile, "valgrind",
                                       "$(TEST_CFISH_EXE)");
-        if (chaz_CC_binary_format() == CHAZ_CC_BINFMT_ELF) {
-            valgrind_command = "LD_LIBRARY_PATH=. CLOWNFISH_VALGRIND=1"
-                               " valgrind"
-                               " --leak-check=full"
-                               " $(TEST_CFISH_EXE)";
-        }
-        else {
-            valgrind_command = "CLOWNFISH_VALGRIND=1"
-                               " valgrind"
-                               " --leak-check=full"
-                               " $(TEST_CFISH_EXE)";
-        }
-        chaz_MakeRule_add_command(rule, valgrind_command);
+        chaz_MakeRule_add_command(rule,
+                                  "valgrind --leak-check=full"
+                                  " $(TEST_CFISH_EXE)");
     }
 
     if (chaz_CLI_defined(self->cli, "enable-coverage")) {