Commit 3e037992 authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

Forward all arguments to gcc when we have no input files.

Kill the -V option, as it's not compatible with gcc. Fix silly bug when we are not given an output name.
parent 80e34dbb
...@@ -193,10 +193,6 @@ int main(int argc, char **argv) ...@@ -193,10 +193,6 @@ int main(int argc, char **argv)
case 'v': /* verbose */ case 'v': /* verbose */
if (argv[i][2] == 0) verbose = 1; if (argv[i][2] == 0) verbose = 1;
break; break;
case 'V':
printf("winegcc v0.3\n");
exit(0);
break;
case 'W': case 'W':
if (strncmp("-Wl,", argv[i], 4) == 0) if (strncmp("-Wl,", argv[i], 4) == 0)
{ {
...@@ -220,6 +216,12 @@ int main(int argc, char **argv) ...@@ -220,6 +216,12 @@ int main(int argc, char **argv)
if (linking) if (linking)
{ {
int has_output_name = 0; int has_output_name = 0;
int has_input_files = 0;
char **temp_argv;
/* we need this to erase some of the parameters as we go along */
temp_argv = malloc(sizeof(char*) * argc);
memcpy(temp_argv, argv, sizeof(char*) * argc);
gcc_argv[i++] = "winewrap"; gcc_argv[i++] = "winewrap";
if (gui_app) gcc_argv[i++] = "-mgui"; if (gui_app) gcc_argv[i++] = "-mgui";
...@@ -234,17 +236,17 @@ int main(int argc, char **argv) ...@@ -234,17 +236,17 @@ int main(int argc, char **argv)
case 'L': case 'L':
case 'o': case 'o':
gcc_argv[i++] = argv[j]; gcc_argv[i++] = argv[j];
argv[j] = 0; temp_argv[j] = 0;
if (!gcc_argv[i-1][2] && j + 1 < argc) if (!gcc_argv[i-1][2] && j + 1 < argc)
{ {
gcc_argv[i++] = argv[++j]; gcc_argv[i++] = argv[++j];
argv[j] = 0; temp_argv[j] = 0;
} }
has_output_name = 1; has_output_name = 1;
break; break;
case 'l': case 'l':
gcc_argv[i++] = strcmp(argv[j], "-luuid") ? argv[j] : "-lwine_uuid"; gcc_argv[i++] = strcmp(argv[j], "-luuid") ? argv[j] : "-lwine_uuid";
argv[j] = 0; temp_argv[j] = 0;
break; break;
default: default:
; /* ignore the rest */ ; /* ignore the rest */
...@@ -252,21 +254,32 @@ int main(int argc, char **argv) ...@@ -252,21 +254,32 @@ int main(int argc, char **argv)
} }
else else
{ {
gcc_argv[i++] = get_obj_file(argv, j); gcc_argv[i++] = get_obj_file(temp_argv, j);
argv[j] = 0; temp_argv[j] = 0;
has_input_files = 1;
} }
}
if (has_input_files)
{
/* Support the a.out default name, to appease configure */ /* Support the a.out default name, to appease configure */
if (!has_output_name) if (!has_output_name)
{ {
gcc_argv[i++] = "-o"; gcc_argv[i++] = "-o";
gcc_argv[i++] = "a.out"; gcc_argv[i++] = "a.out";
} }
if (use_stdlib && use_msvcrt) gcc_argv[i++] = "-lmsvcrt";
if (gui_app) gcc_argv[i++] = "-lcomdlg32";
gcc_argv[i++] = "-ladvapi32";
gcc_argv[i++] = "-lshell32";
}
else
{
/* if we have nothing to process, just forward stuff to gcc */
memcpy(gcc_argv, argv, sizeof(char*) * argc);
gcc_argv[0] = cpp ? "g++" : "gcc";
i = argc;
} }
if (use_stdlib && use_msvcrt) gcc_argv[i++] = "-lmsvcrt";
if (gui_app) gcc_argv[i++] = "-lcomdlg32";
gcc_argv[i++] = "-ladvapi32";
gcc_argv[i++] = "-lshell32";
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment