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 2017/02/04 17:37:27 UTC
[8/9] lucy-charmonizer git commit: Add chaz_OS_exe_ext() function
Add chaz_OS_exe_ext() function
The executable extension can differ on host and target OS when
cross-compiling.
Project: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/commit/4e29a77d
Tree: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/tree/4e29a77d
Diff: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/diff/4e29a77d
Branch: refs/heads/master
Commit: 4e29a77d0b25255ad4b807eda608bf7e4a65e758
Parents: 34d27fa
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Feb 4 16:07:29 2017 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Feb 4 18:10:18 2017 +0100
----------------------------------------------------------------------
src/Charmonizer/Core/Make.c | 7 +++----
src/Charmonizer/Core/OperatingSystem.c | 9 +++++++++
src/Charmonizer/Core/OperatingSystem.h | 7 +++++++
3 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/4e29a77d/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/src/Charmonizer/Core/Make.c b/src/Charmonizer/Core/Make.c
index 2ea2c7c..2bd286c 100644
--- a/src/Charmonizer/Core/Make.c
+++ b/src/Charmonizer/Core/Make.c
@@ -273,8 +273,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*));
@@ -284,8 +282,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);
http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/4e29a77d/src/Charmonizer/Core/OperatingSystem.c
----------------------------------------------------------------------
diff --git a/src/Charmonizer/Core/OperatingSystem.c b/src/Charmonizer/Core/OperatingSystem.c
index 446872b..9721b82 100644
--- a/src/Charmonizer/Core/OperatingSystem.c
+++ b/src/Charmonizer/Core/OperatingSystem.c
@@ -127,6 +127,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-charmonizer/blob/4e29a77d/src/Charmonizer/Core/OperatingSystem.h
----------------------------------------------------------------------
diff --git a/src/Charmonizer/Core/OperatingSystem.h b/src/Charmonizer/Core/OperatingSystem.h
index eda3890..cf13068 100644
--- a/src/Charmonizer/Core/OperatingSystem.h
+++ b/src/Charmonizer/Core/OperatingSystem.h
@@ -83,6 +83,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