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 2013/05/05 00:01:44 UTC
[lucy-commits] [2/5] git commit: refs/heads/master - Support GNU make under Windows
Support GNU make under Windows
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f776a04e
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f776a04e
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f776a04e
Branch: refs/heads/master
Commit: f776a04e03ad5a0f00d69fd85522eb300ad141ed
Parents: 598a5ce
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat May 4 22:32:45 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat May 4 23:45:38 2013 +0200
----------------------------------------------------------------------
charmonizer/src/Charmonizer/Core/Make.c | 35 +++++++++++++++++---------
charmonizer/src/Charmonizer/Core/Make.h | 5 +++
common/charmonizer.main | 2 +-
3 files changed, 29 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/f776a04e/charmonizer/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.c b/charmonizer/src/Charmonizer/Core/Make.c
index 5210154..f114a37 100644
--- a/charmonizer/src/Charmonizer/Core/Make.c
+++ b/charmonizer/src/Charmonizer/Core/Make.c
@@ -47,9 +47,10 @@ static struct {
char *make_command;
int is_gnu_make;
int is_nmake;
+ int shell_type;
} chaz_Make = {
NULL,
- 0, 0
+ 0, 0, 0
};
/* Detect make command.
@@ -82,16 +83,24 @@ void
chaz_Make_init(void) {
const char *make;
- chaz_Make_detect("make", "gmake", "nmake", "dmake", NULL);
+ chaz_Make_detect("make", "gmake", "nmake", "dmake", "mingw32-make",
+ "mingw64-make", NULL);
make = chaz_Make.make_command;
if (make) {
- if (strcmp(make, "make") == 0 || strcmp(make, "gmake") == 0) {
+ if (strcmp(make, "make") == 0
+ || strcmp(make, "gmake") == 0
+ || strcmp(make, "mingw32-make") == 0
+ || strcmp(make, "mingw64-make") == 0
+ ) {
/* TODO: Add a feature test for GNU make. */
chaz_Make.is_gnu_make = 1;
+ /* TODO: Feature test which shell GNU make uses on Windows. */
+ chaz_Make.shell_type = CHAZ_OS_POSIX;
}
else if (strcmp(make, "nmake") == 0) {
chaz_Make.is_nmake = 1;
+ chaz_Make.shell_type = CHAZ_OS_CMD_EXE;
}
}
}
@@ -106,6 +115,11 @@ chaz_Make_get_make(void) {
return chaz_Make.make_command;
}
+int
+chaz_Make_shell_type(void) {
+ return chaz_Make.shell_type;
+}
+
static int
chaz_Make_detect(const char *make1, ...) {
va_list args;
@@ -352,7 +366,6 @@ chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *name,
void
chaz_MakeFile_write(chaz_MakeFile *makefile) {
- int shell_type = chaz_OS_shell_type();
FILE *out;
size_t i;
@@ -497,18 +510,17 @@ chaz_MakeRule_add_command(chaz_MakeRule *rule, const char *command) {
void
chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
- int shell_type = chaz_OS_shell_type();
char *command;
- if (shell_type == CHAZ_OS_POSIX) {
+ if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
command = chaz_Util_join(" ", "rm -f", files, NULL);
}
- else if (shell_type == CHAZ_OS_CMD_EXE) {
+ else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
command = chaz_Util_join("", "for %i in (", files,
") do @if exist %i del /f %i", NULL);
}
else {
- chaz_Util_die("Unsupported shell type: %d", shell_type);
+ chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
}
chaz_MakeRule_add_command(rule, command);
@@ -517,18 +529,17 @@ chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
void
chaz_MakeRule_add_recursive_rm_command(chaz_MakeRule *rule, const char *dirs) {
- int shell_type = chaz_OS_shell_type();
char *command;
- if (shell_type == CHAZ_OS_POSIX) {
+ if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
command = chaz_Util_join(" ", "rm -rf", dirs, NULL);
}
- else if (shell_type == CHAZ_OS_CMD_EXE) {
+ else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
command = chaz_Util_join("", "for %i in (", dirs,
") do @if exist %i rmdir /s /q %i", NULL);
}
else {
- chaz_Util_die("Unsupported shell type: %d", shell_type);
+ chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
}
chaz_MakeRule_add_command(rule, command);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f776a04e/charmonizer/src/Charmonizer/Core/Make.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.h b/charmonizer/src/Charmonizer/Core/Make.h
index 97cae84..8df49f6 100644
--- a/charmonizer/src/Charmonizer/Core/Make.h
+++ b/charmonizer/src/Charmonizer/Core/Make.h
@@ -47,6 +47,11 @@ chaz_Make_clean_up(void);
const char*
chaz_Make_get_make(void);
+/** Return the type of shell used by the detected 'make' executable.
+ */
+int
+chaz_Make_shell_type(void);
+
/** Recursively list files in a directory. For every file a callback is called
* with the filename and a context variable.
*
http://git-wip-us.apache.org/repos/asf/lucy/blob/f776a04e/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 6ce26e3..eeebf89 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -376,7 +376,7 @@ S_write_makefile(struct chaz_CLIArgs *args) {
clean_rule = chaz_MakeFile_clean_rule(makefile);
- if (chaz_OS_shell_type() == CHAZ_OS_CMD_EXE) {
+ if (chaz_Make_shell_type() == CHAZ_OS_CMD_EXE) {
/*
* The length of the command would exceed the limit of 8191
* characters. As a work-around, delete all .obj files in BASE_DIR