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/02/12 21:11:51 UTC
[lucy-commits] [7/8] git commit: refs/heads/c-bindings-cfc - Support 'make clean'
under cmd.exe
Support 'make clean' under cmd.exe
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/fbb552d1
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/fbb552d1
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/fbb552d1
Branch: refs/heads/c-bindings-cfc
Commit: fbb552d1bf859096090bda95643fe01f33f4e6c3
Parents: a9dcde3
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Feb 12 21:08:35 2013 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Feb 12 21:10:23 2013 +0100
----------------------------------------------------------------------
charmonizer/src/Charmonizer/Core/Make.c | 37 +++++++++++++++++++++----
1 files changed, 31 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/fbb552d1/charmonizer/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.c b/charmonizer/src/Charmonizer/Core/Make.c
index 6e48370..a005d73 100644
--- a/charmonizer/src/Charmonizer/Core/Make.c
+++ b/charmonizer/src/Charmonizer/Core/Make.c
@@ -283,6 +283,7 @@ chaz_MakeFile_add_shared_obj(chaz_MakeFile *makefile, const char *shared_obj,
void
chaz_MakeFile_write(chaz_MakeFile *makefile) {
+ int shell_type = chaz_OS_shell_type();
FILE *file;
size_t i;
@@ -311,16 +312,40 @@ chaz_MakeFile_write(chaz_MakeFile *makefile) {
}
if (makefile->cleanups[0]) {
- fprintf(file, "clean :\n\trm -f");
- for (i = 0; makefile->cleanups[i]; i++) {
- char *cleanup = makefile->cleanups[i];
- fprintf(file, " \\\n\t %s", cleanup);
+ if (shell_type == CHAZ_OS_POSIX) {
+ fprintf(file, "clean :\n\trm -f");
+ for (i = 0; makefile->cleanups[i]; i++) {
+ const char *cleanup = makefile->cleanups[i];
+ fprintf(file, " \\\n\t %s", cleanup);
+ }
+ fprintf(file, "\n\n");
+ }
+ else if (shell_type == CHAZ_OS_CMD_EXE) {
+ fprintf(file, "clean :\n");
+ for (i = 0; makefile->cleanups[i]; i++) {
+ const char *cleanup = makefile->cleanups[i];
+ fprintf(file, "\tfor %%i in (%s) do if exist %%i del /f %%i\n",
+ cleanup);
+ }
+ fprintf(file, "\n");
+ }
+ else {
+ chaz_Util_die("Unsupported shell type: %d", shell_type);
}
- fprintf(file, "\n\n");
}
fprintf(file, "distclean : clean\n");
- fprintf(file, "\trm -f charmonizer charmony.h Makefile\n\n");
+ if (shell_type == CHAZ_OS_POSIX) {
+ fprintf(file, "\trm -f charmonizer charmony.h Makefile\n\n");
+ }
+ else if (shell_type == CHAZ_OS_CMD_EXE) {
+ fprintf(file,
+ "\tfor %%i in (charmonizer charmony.h Makefile) do"
+ " if exist %%i del /f %%i\n\n");
+ }
+ else {
+ chaz_Util_die("Unsupported shell type: %d", shell_type);
+ }
fclose(file);
}