You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/06/29 03:35:06 UTC
[lucy-commits] svn commit: r1140940 -
/incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c
Author: marvin
Date: Wed Jun 29 01:35:06 2011
New Revision: 1140940
URL: http://svn.apache.org/viewvc?rev=1140940&view=rev
Log:
LUCY-169 Clean up after MSVC exe compiles.
Clean up a bunch of junk that MSVC leaves behind when it links an executable.
Modified:
incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c?rev=1140940&r1=1140939&r2=1140940&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Core/Compiler.c Wed Jun 29 01:35:06 2011
@@ -129,6 +129,8 @@ CC_compile_exe(const char *source_path,
const char *exe_ext = OS_exe_ext();
size_t exe_file_buf_size = strlen(exe_name) + strlen(exe_ext) + 1;
char *exe_file = (char*)malloc(exe_file_buf_size);
+ size_t junk_buf_size = exe_file_buf_size + 3;
+ char *junk = (char*)malloc(junk_buf_size);
size_t exe_file_buf_len = sprintf(exe_file, "%s%s", exe_name, exe_ext);
char *inc_dir_string = S_inc_dir_string();
size_t command_max_size = strlen(cc_command)
@@ -157,6 +159,18 @@ CC_compile_exe(const char *source_path,
system(command);
}
+#ifdef _MSC_VER
+ /* Zap MSVC junk. */
+ /* TODO: Key this off the compiler supplied as argument, not the compiler
+ * used to compile Charmonizer. */
+ sprintf(junk, "%s.obj", exe_name);
+ remove(junk);
+ sprintf(junk, "%s.ilk", exe_name);
+ remove(junk);
+ sprintf(junk, "%s.pdb", exe_name);
+ remove(junk);
+#endif
+
/* See if compilation was successful. Remove the source file. */
result = Util_can_open_file(exe_file);
if (!Util_remove_and_verify(source_path)) {
@@ -165,6 +179,7 @@ CC_compile_exe(const char *source_path,
free(command);
free(inc_dir_string);
+ free(junk);
free(exe_file);
return result;
}