lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [10/13] git commit: refs/heads/makefile-rework - Add dependency on .cfh files in Makefile
Date Wed, 15 May 2013 17:24:34 GMT
Add dependency on .cfh files in Makefile


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

Branch: refs/heads/makefile-rework
Commit: 3b36502434c43a08d60c5fa20cac7e767ce1f15d
Parents: e472376
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Wed May 15 02:50:48 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Wed May 15 19:19:52 2013 +0200

----------------------------------------------------------------------
 common/charmonizer.main |   42 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/3b365024/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 88219d6..5b8519c 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -102,7 +102,7 @@ S_ends_with(const char *string, const char *postfix) {
 }
 
 static void
-S_source_file_callback(const char *dir, char *file, void *context) {
+S_c_file_callback(const char *dir, char *file, void *context) {
     SourceFileContext *sfc = (SourceFileContext*)context;
     const char *dir_sep = chaz_OS_dir_sep();
     const char *obj_ext = chaz_CC_obj_ext();
@@ -111,7 +111,7 @@ S_source_file_callback(const char *dir, char *file, void *context) {
 
     /* Strip extension */
     if (!S_ends_with(file, ".c")) {
-        chaz_Util_warn("Unexpected source file name: %s", file);
+        chaz_Util_warn("Unexpected C filename: %s", file);
         return;
     }
     file[file_len-2] = '\0';
@@ -124,6 +124,22 @@ S_source_file_callback(const char *dir, char *file, void *context) {
 }
 
 static void
+S_cfh_file_callback(const char *dir, char *file, void *context) {
+    SourceFileContext *sfc = (SourceFileContext*)context;
+    const char *dir_sep = chaz_OS_dir_sep();
+    char *cfh_file;
+
+    if (!S_ends_with(file, ".cfh")) {
+        chaz_Util_warn("Unexpected Clownfish header filename: %s", file);
+        return;
+    }
+
+    cfh_file = chaz_Util_join(dir_sep, dir, file, NULL);
+    chaz_MakeVar_append(sfc->var, cfh_file);
+    free(cfh_file);
+}
+
+static void
 S_write_makefile(struct chaz_CLIArgs *args) {
     SourceFileContext sfc;
 
@@ -215,11 +231,11 @@ S_write_makefile(struct chaz_CLIArgs *args) {
     var = chaz_MakeFile_add_var(makefile, "LUCY_OBJS", NULL);
     sfc.var = var;
 
-    chaz_Make_list_files("src",        "c", S_source_file_callback, &sfc);
-    chaz_Make_list_files(core_dir,     "c", S_source_file_callback, &sfc);
-    chaz_Make_list_files(snowstem_dir, "c", S_source_file_callback, &sfc);
-    chaz_Make_list_files(snowstop_dir, "c", S_source_file_callback, &sfc);
-    chaz_Make_list_files(utf8proc_dir, "c", S_source_file_callback, &sfc);
+    chaz_Make_list_files("src",        "c", S_c_file_callback, &sfc);
+    chaz_Make_list_files(core_dir,     "c", S_c_file_callback, &sfc);
+    chaz_Make_list_files(snowstem_dir, "c", S_c_file_callback, &sfc);
+    chaz_Make_list_files(snowstop_dir, "c", S_c_file_callback, &sfc);
+    chaz_Make_list_files(utf8proc_dir, "c", S_c_file_callback, &sfc);
 
     scratch = chaz_Util_join("", json_parser, obj_ext, NULL);
     chaz_MakeVar_append(var, scratch);
@@ -230,6 +246,13 @@ S_write_makefile(struct chaz_CLIArgs *args) {
     chaz_MakeVar_append(var, scratch);
     free(scratch);
 
+    /* Clownfish header files */
+
+    var = chaz_MakeFile_add_var(makefile, "CLOWNFISH_HEADERS", NULL);
+    sfc.var = var;
+
+    chaz_Make_list_files(core_dir, "cfh", S_cfh_file_callback, &sfc);
+
     /* Rules */
 
     lib = chaz_SharedLib_new("lucy", lucy_version, lucy_major_version);
@@ -247,9 +270,14 @@ S_write_makefile(struct chaz_CLIArgs *args) {
     chaz_MakeRule_add_make_command(rule, cfc_dir, NULL);
 
     rule = chaz_MakeFile_add_rule(makefile, "autogen", cfc_exe);
+    chaz_MakeRule_add_prereq(rule, "$(CLOWNFISH_HEADERS)");
     scratch = chaz_Util_join("", cfc_exe, " --source=", core_dir,
                              " --dest=autogen --header=cfc_header", NULL);
     chaz_MakeRule_add_command(rule, scratch);
+    /* TODO: Find a way to touch the autogen directory on Windows. */
+    if (chaz_Make_shell_type() == CHAZ_OS_POSIX) {
+        chaz_MakeRule_add_command(rule, "touch autogen");
+    }
     free(scratch);
 
     /* Needed for parallel builds. */


Mime
View raw message