Rework chaz_MakeFile * Return added rule from chaz_MakeFile_add_* * Add extra_link_flags to chaz_MakeFile_add_exe
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f73652c0 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f73652c0 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f73652c0 Branch: refs/heads/c-bindings-wip2 Commit: f73652c0e471a979455217426b559391f8f74c1d Parents: 90153df Author: Nick Wellnhofer <[email protected]> Authored: Sun Feb 24 19:52:18 2013 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Sun Feb 24 20:33:34 2013 +0100 ---------------------------------------------------------------------- charmonizer/src/Charmonizer/Core/Make.c | 16 +++++++++++----- charmonizer/src/Charmonizer/Core/Make.h | 6 +++--- clownfish/compiler/common/charmonizer.main | 6 +++--- 3 files changed, 17 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/f73652c0/charmonizer/src/Charmonizer/Core/Make.c ---------------------------------------------------------------------- diff --git a/charmonizer/src/Charmonizer/Core/Make.c b/charmonizer/src/Charmonizer/Core/Make.c index 3470af1..6bf6e82 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,18 +241,22 @@ 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"; @@ -280,6 +284,8 @@ chaz_MakeFile_add_shared_obj(chaz_MakeFile *makefile, const char *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/f73652c0/charmonizer/src/Charmonizer/Core/Make.h ---------------------------------------------------------------------- diff --git a/charmonizer/src/Charmonizer/Core/Make.h b/charmonizer/src/Charmonizer/Core/Make.h index 430ae33..dfbc7c6 100644 --- a/charmonizer/src/Charmonizer/Core/Make.h +++ b/charmonizer/src/Charmonizer/Core/Make.h @@ -102,9 +102,9 @@ chaz_MakeFile_add_to_cleanup(chaz_MakeFile *makefile, const char *target); * @param exe The name of the executable. * @param objects The list of object files. */ -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. @@ -113,7 +113,7 @@ chaz_MakeFile_add_exe(chaz_MakeFile *makefile, const char *exe, * @param shared_obj The name of the shared object. * @param objects The list of object files. */ -void +chaz_MakeRule* chaz_MakeFile_add_shared_obj(chaz_MakeFile *makefile, const char *shared_obj, const char *objects); http://git-wip-us.apache.org/repos/asf/lucy/blob/f73652c0/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)");
