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/05/16 00:28:40 UTC

[lucy-commits] [06/21] git commit: refs/heads/master - Eliminate Makefile variables for file extensions

Eliminate Makefile variables for file extensions


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

Branch: refs/heads/master
Commit: 239afba4600d1ce7034e1bfa09a48023d3bce03a
Parents: 8aacc86
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed May 15 00:28:41 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed May 15 19:13:54 2013 +0200

----------------------------------------------------------------------
 charmonizer/src/Charmonizer/Core/Make.c    |   10 +++++++---
 clownfish/compiler/common/charmonizer.main |   21 ++++++++++-----------
 common/charmonizer.main                    |   18 +++++++-----------
 3 files changed, 24 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/239afba4/charmonizer/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.c b/charmonizer/src/Charmonizer/Core/Make.c
index b3aba56..d15751d 100644
--- a/charmonizer/src/Charmonizer/Core/Make.c
+++ b/charmonizer/src/Charmonizer/Core/Make.c
@@ -169,6 +169,9 @@ chaz_Make_audition(const char *make) {
 chaz_MakeFile*
 chaz_MakeFile_new() {
     chaz_MakeFile *makefile = (chaz_MakeFile*)malloc(sizeof(chaz_MakeFile));
+    const char    *exe_ext  = chaz_OS_exe_ext();
+    const char    *obj_ext  = chaz_CC_obj_ext();
+    char *generated;
 
     makefile->vars = (chaz_MakeVar**)malloc(sizeof(chaz_MakeVar*));
     makefile->vars[0] = NULL;
@@ -181,10 +184,11 @@ chaz_MakeFile_new() {
     makefile->clean     = S_new_rule("clean", NULL);
     makefile->distclean = S_new_rule("distclean", "clean");
 
-    chaz_MakeRule_add_rm_command(makefile->distclean,
-                                 "charmonizer$(EXE_EXT) charmonizer$(OBJ_EXT)"
-                                 " charmony.h Makefile");
+    generated = chaz_Util_join("", "charmonizer", exe_ext, " charmonizer",
+                               obj_ext, " charmony.h Makefile", NULL);
+    chaz_MakeRule_add_rm_command(makefile->distclean, generated);
 
+    free(generated);
     return makefile;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/239afba4/clownfish/compiler/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.main b/clownfish/compiler/common/charmonizer.main
index ff38656..4a9df5d 100644
--- a/clownfish/compiler/common/charmonizer.main
+++ b/clownfish/compiler/common/charmonizer.main
@@ -72,9 +72,8 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
 static void
 S_source_file_callback(const char *dir, char *file, void *context) {
     SourceFileContext *sfc = (SourceFileContext*)context;
+    const char *obj_ext = chaz_CC_obj_ext();
     size_t file_len = strlen(file);
-    size_t obj_file_size;
-    const char *pattern;
     char *obj_file;
 
     if (strcmp(file, "CFCParseHeader.c") == 0) { return; }
@@ -86,7 +85,7 @@ S_source_file_callback(const char *dir, char *file, void *context) {
     }
     file[file_len-2] = '\0';
 
-    obj_file = chaz_Util_join("", dir, DIR_SEP, file, "$(OBJ_EXT)", NULL);
+    obj_file = chaz_Util_join("", dir, DIR_SEP, file, obj_ext, NULL);
     if (strlen(file) >= 7 && memcmp(file, "CFCTest", 7) == 0) {
         chaz_MakeVar_append(sfc->test_cfc_objs, obj_file);
     }
@@ -134,11 +133,6 @@ S_write_makefile(struct chaz_CLIArgs *args) {
 
     chaz_MakeFile_add_var(makefile, "BASE_DIR", base_dir);
 
-    /* File extensions */
-
-    chaz_MakeFile_add_var(makefile, "EXE_EXT", exe_ext);
-    chaz_MakeFile_add_var(makefile, "OBJ_EXT", obj_ext);
-
     /* C compiler */
 
     chaz_MakeFile_add_var(makefile, "CC", chaz_CC_get_cc());
@@ -167,12 +161,17 @@ S_write_makefile(struct chaz_CLIArgs *args) {
 
     chaz_Make_list_files(src_dir, "c", S_source_file_callback, &sfc);
 
-    scratch = chaz_Util_join("", parse_header, "$(OBJ_EXT)", NULL);
+    scratch = chaz_Util_join("", parse_header, obj_ext, NULL);
     chaz_MakeVar_append(sfc.common_objs, scratch);
     free(scratch);
-    chaz_MakeVar_append(sfc.test_cfc_objs, "t" DIR_SEP "test_cfc$(OBJ_EXT)");
 
-    chaz_MakeFile_add_var(makefile, "CFC_OBJS", "cfc$(OBJ_EXT)");
+    scratch = chaz_Util_join("", "t", DIR_SEP, "test_cfc", obj_ext, NULL);
+    chaz_MakeVar_append(sfc.test_cfc_objs, scratch);
+    free(scratch);
+
+    scratch = chaz_Util_join("", "cfc", obj_ext, NULL);
+    chaz_MakeFile_add_var(makefile, "CFC_OBJS", scratch);
+    free(scratch);
 
     /* Rules */
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/239afba4/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 7a8bc4c..60cd820 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -102,11 +102,10 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
 static void
 S_source_file_callback(const char *dir, char *file, void *context) {
     SourceFileContext *sfc = (SourceFileContext*)context;
+    const char *obj_ext       = chaz_CC_obj_ext();
     const char *json_parser_c = "Lucy" DIR_SEP "Util" DIR_SEP "Json" DIR_SEP
                                 "JsonParser.c";
     size_t file_len = strlen(file);
-    size_t obj_file_size;
-    const char *pattern;
     char *obj_file;
 
     if (strcmp(file, json_parser_c) == 0) { return; }
@@ -118,7 +117,7 @@ S_source_file_callback(const char *dir, char *file, void *context) {
     }
     file[file_len-2] = '\0';
 
-    obj_file = chaz_Util_join("", dir, DIR_SEP, file, "$(OBJ_EXT)", NULL);
+    obj_file = chaz_Util_join("", dir, DIR_SEP, file, obj_ext, NULL);
     chaz_MakeVar_append(sfc->var, obj_file);
     free(obj_file);
 }
@@ -178,11 +177,6 @@ S_write_makefile(struct chaz_CLIArgs *args) {
 
     chaz_MakeFile_add_var(makefile, "BASE_DIR", base_dir);
 
-    /* File extensions */
-
-    chaz_MakeFile_add_var(makefile, "EXE_EXT", exe_ext);
-    chaz_MakeFile_add_var(makefile, "OBJ_EXT", obj_ext);
-
     /* C compiler */
 
     chaz_MakeFile_add_var(makefile, "CC", chaz_CC_get_cc());
@@ -222,12 +216,14 @@ S_write_makefile(struct chaz_CLIArgs *args) {
     chaz_Make_list_files(snowstop_dir, "c", S_source_file_callback, &sfc);
     chaz_Make_list_files(utf8proc_dir, "c", S_source_file_callback, &sfc);
 
-    scratch = chaz_Util_join("", json_parser, "$(OBJ_EXT)", NULL);
+    scratch = chaz_Util_join("", json_parser, obj_ext, NULL);
     chaz_MakeVar_append(var, scratch);
     free(scratch);
 
-    chaz_MakeVar_append(var, "autogen" DIR_SEP "source" DIR_SEP
-                        "parcel$(OBJ_EXT)");
+    scratch = chaz_Util_join("", "autogen", DIR_SEP, "source", DIR_SEP,
+                             "parcel", obj_ext, NULL);
+    chaz_MakeVar_append(var, scratch);
+    free(scratch);
 
     /* Rules */