Regen charmonizer for CFC static lib.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/dc2b8d4c Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/dc2b8d4c Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/dc2b8d4c Branch: refs/heads/master Commit: dc2b8d4c77b949100a1214e12c21325cce2c58f7 Parents: 827a528 Author: Marvin Humphrey <[email protected]> Authored: Sat Nov 29 14:07:12 2014 -0800 Committer: Marvin Humphrey <[email protected]> Committed: Sun Mar 15 18:05:43 2015 -0700 ---------------------------------------------------------------------- compiler/common/charmonizer.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/dc2b8d4c/compiler/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/compiler/common/charmonizer.c b/compiler/common/charmonizer.c index 47563a6..217e318 100644 --- a/compiler/common/charmonizer.c +++ b/compiler/common/charmonizer.c @@ -7769,8 +7769,12 @@ chaz_VariadicMacros_run(void) { typedef struct SourceFileContext { chaz_MakeVar *common_objs; chaz_MakeVar *test_cfc_objs; + chaz_MakeVar *common_test_objs; } SourceFileContext; +static const char cfc_version[] = "0.4.0"; +static const char cfc_major_version[] = "0.4"; + static void S_add_compiler_flags(struct chaz_CLI *cli); @@ -7875,6 +7879,17 @@ S_add_compiler_flags(struct chaz_CLI *cli) { } static void +S_add_staticlib_makefile_target(chaz_MakeFile *makefile) { + chaz_Lib *static_lib = chaz_Lib_new("cfc", chaz_Lib_STATIC, cfc_version, + cfc_major_version); + char *static_lib_filename = chaz_Lib_filename(static_lib); + chaz_MakeFile_add_rule(makefile, "static", static_lib_filename); + chaz_MakeFile_add_static_lib(makefile, static_lib, "$(COMMON_OBJS)"); + free(static_lib_filename); + chaz_Lib_destroy(static_lib); +} + +static void S_write_makefile(struct chaz_CLI *cli) { SourceFileContext sfc; @@ -7941,6 +7956,7 @@ S_write_makefile(struct chaz_CLI *cli) { sfc.common_objs = chaz_MakeFile_add_var(makefile, "COMMON_OBJS", NULL); sfc.test_cfc_objs = chaz_MakeFile_add_var(makefile, "TEST_CFC_OBJS", NULL); + sfc.common_test_objs = chaz_MakeFile_add_var(makefile, "COMMON_TEST_OBJS", NULL); chaz_Make_list_files(src_dir, "c", S_source_file_callback, &sfc); chaz_Make_list_files(cmark_dir, "c", S_source_file_callback, &sfc); @@ -7960,6 +7976,7 @@ S_write_makefile(struct chaz_CLI *cli) { /* Rules */ chaz_MakeFile_add_rule(makefile, "all", cfc_exe); + S_add_staticlib_makefile_target(makefile); chaz_MakeFile_add_lemon_exe(makefile, lemon_dir); chaz_MakeFile_add_lemon_grammar(makefile, parse_header); @@ -7979,10 +7996,13 @@ S_write_makefile(struct chaz_CLI *cli) { if (chaz_CLI_defined(cli, "enable-coverage")) { chaz_CFlags_enable_code_coverage(link_flags); } - chaz_MakeFile_add_exe(makefile, cfc_exe, "$(COMMON_OBJS) $(CFC_OBJS)", - link_flags); - chaz_MakeFile_add_exe(makefile, test_cfc_exe, - "$(COMMON_OBJS) $(TEST_CFC_OBJS)", link_flags); + if (strcmp(chaz_CLI_strval(cli, "host"), "c") == 0) { + chaz_MakeFile_add_exe(makefile, cfc_exe, "$(COMMON_OBJS) $(CFC_OBJS)", + link_flags); + chaz_MakeFile_add_exe(makefile, test_cfc_exe, + "$(COMMON_OBJS) $(COMMON_TEST_OBJS) $(TEST_CFC_OBJS)", + link_flags); + } chaz_CFlags_destroy(link_flags); rule = chaz_MakeFile_add_rule(makefile, "test", test_cfc_exe); @@ -8012,6 +8032,7 @@ S_write_makefile(struct chaz_CLI *cli) { clean_rule = chaz_MakeFile_clean_rule(makefile); chaz_MakeRule_add_rm_command(clean_rule, "$(COMMON_OBJS)"); + chaz_MakeRule_add_rm_command(clean_rule, "$(COMMON_TEST_OBJS)"); chaz_MakeRule_add_rm_command(clean_rule, "$(CFC_OBJS)"); chaz_MakeRule_add_rm_command(clean_rule, "$(TEST_CFC_OBJS)"); @@ -8054,7 +8075,7 @@ S_source_file_callback(const char *dir, char *file, void *context) { 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); + chaz_MakeVar_append(sfc->common_test_objs, obj_file); } else { chaz_MakeVar_append(sfc->common_objs, obj_file);
