Use chaz_OS_exe_ext() for executables on the host OS
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/088a359d Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/088a359d Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/088a359d Branch: refs/heads/master Commit: 088a359d3316bf586e8bd0437012ad832eb744bc Parents: e65b995 Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Sat Feb 4 16:12:18 2017 +0100 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Sat Feb 4 18:13:35 2017 +0100 ---------------------------------------------------------------------- compiler/common/charmonizer.c | 23 +++++++++++++++++++---- runtime/common/charmonizer.c | 27 +++++++++++++++++++++------ runtime/common/charmonizer.main | 4 ++-- 3 files changed, 42 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/088a359d/compiler/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/compiler/common/charmonizer.c b/compiler/common/charmonizer.c index d45c84a..ec8083c 100644 --- a/compiler/common/charmonizer.c +++ b/compiler/common/charmonizer.c @@ -983,6 +983,13 @@ chaz_OS_dir_sep(void); int chaz_OS_shell_type(void); +/* Return the file extension for executables on this system. This can be + * a different value than returned by chaz_CC_exe_ext() when + * cross-compiling. + */ +const char* +chaz_OS_exe_ext(void); + /* Initialize the Charmonizer/Core/OperatingSystem module. */ void @@ -4802,8 +4809,6 @@ S_chaz_Make_audition(const char *make) { chaz_MakeFile* chaz_MakeFile_new() { chaz_MakeFile *self = (chaz_MakeFile*)calloc(1, sizeof(chaz_MakeFile)); - const char *exe_ext = chaz_CC_exe_ext(); - const char *obj_ext = chaz_CC_obj_ext(); char *generated; self->vars = (chaz_MakeVar**)calloc(1, sizeof(chaz_MakeVar*)); @@ -4813,8 +4818,9 @@ chaz_MakeFile_new() { self->clean = S_chaz_MakeRule_new("clean", NULL); self->distclean = S_chaz_MakeRule_new("distclean", "clean"); - generated = chaz_Util_join("", "charmonizer", exe_ext, " charmonizer", - obj_ext, " charmony.h Makefile", NULL); + /* MSVC leaves .obj files around when creating executables. */ + generated = chaz_Util_join("", "charmonizer", chaz_OS_exe_ext(), + " charmonizer.obj charmony.h Makefile", NULL); chaz_MakeRule_add_rm_command(self->distclean, generated); free(generated); @@ -5901,6 +5907,15 @@ chaz_OS_shell_type(void) { return chaz_OS.shell_type; } +const char* +chaz_OS_exe_ext(void) { +#ifdef _WIN32 + return ".exe"; +#else + return ""; +#endif +} + int chaz_OS_remove(const char *name) { /* http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/088a359d/runtime/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/runtime/common/charmonizer.c b/runtime/common/charmonizer.c index e989f0a..9df40d7 100644 --- a/runtime/common/charmonizer.c +++ b/runtime/common/charmonizer.c @@ -983,6 +983,13 @@ chaz_OS_dir_sep(void); int chaz_OS_shell_type(void); +/* Return the file extension for executables on this system. This can be + * a different value than returned by chaz_CC_exe_ext() when + * cross-compiling. + */ +const char* +chaz_OS_exe_ext(void); + /* Initialize the Charmonizer/Core/OperatingSystem module. */ void @@ -4802,8 +4809,6 @@ S_chaz_Make_audition(const char *make) { chaz_MakeFile* chaz_MakeFile_new() { chaz_MakeFile *self = (chaz_MakeFile*)calloc(1, sizeof(chaz_MakeFile)); - const char *exe_ext = chaz_CC_exe_ext(); - const char *obj_ext = chaz_CC_obj_ext(); char *generated; self->vars = (chaz_MakeVar**)calloc(1, sizeof(chaz_MakeVar*)); @@ -4813,8 +4818,9 @@ chaz_MakeFile_new() { self->clean = S_chaz_MakeRule_new("clean", NULL); self->distclean = S_chaz_MakeRule_new("distclean", "clean"); - generated = chaz_Util_join("", "charmonizer", exe_ext, " charmonizer", - obj_ext, " charmony.h Makefile", NULL); + /* MSVC leaves .obj files around when creating executables. */ + generated = chaz_Util_join("", "charmonizer", chaz_OS_exe_ext(), + " charmonizer.obj charmony.h Makefile", NULL); chaz_MakeRule_add_rm_command(self->distclean, generated); free(generated); @@ -5901,6 +5907,15 @@ chaz_OS_shell_type(void) { return chaz_OS.shell_type; } +const char* +chaz_OS_exe_ext(void) { +#ifdef _WIN32 + return ".exe"; +#else + return ""; +#endif +} + int chaz_OS_remove(const char *name) { /* @@ -8884,8 +8899,8 @@ cfish_MakeFile_write_c_cfc_rules(cfish_MakeFile *self) { chaz_MakeRule *rule; - const char *dir_sep = chaz_OS_dir_sep(); - const char *exe_ext = chaz_CC_exe_ext(); + const char *dir_sep = chaz_OS_dir_sep(); + const char *exe_ext = chaz_OS_exe_ext(); char *cfc_dir; char *cfc_exe; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/088a359d/runtime/common/charmonizer.main ---------------------------------------------------------------------- diff --git a/runtime/common/charmonizer.main b/runtime/common/charmonizer.main index 22b8f01..c2d2ff5 100644 --- a/runtime/common/charmonizer.main +++ b/runtime/common/charmonizer.main @@ -503,8 +503,8 @@ cfish_MakeFile_write_c_cfc_rules(cfish_MakeFile *self) { chaz_MakeRule *rule; - const char *dir_sep = chaz_OS_dir_sep(); - const char *exe_ext = chaz_CC_exe_ext(); + const char *dir_sep = chaz_OS_dir_sep(); + const char *exe_ext = chaz_OS_exe_ext(); char *cfc_dir; char *cfc_exe;