mirror of
https://github.com/git-for-windows/git.git
synced 2026-05-31 21:40:27 -05:00
clink.pl: move default linker options for MSVC=1 builds
Move the default `-ENTRY` and `-SUBSYSTEM` arguments for MSVC=1 builds from `config.mak.uname` into `clink.pl`. These args are constant for console-mode executables. Add support to `clink.pl` for generating a Win32 GUI application using the `-mwindows` argument (to match how GCC does it). This changes the `-ENTRY` and `-SUBSYSTEM` arguments accordingly. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
This commit is contained in:
committed by
Johannes Schindelin
parent
b442bcd8de
commit
bfd7b0fce4
@@ -15,6 +15,7 @@ my @cflags = ();
|
|||||||
my @lflags = ();
|
my @lflags = ();
|
||||||
my $is_linking = 0;
|
my $is_linking = 0;
|
||||||
my $is_debug = 0;
|
my $is_debug = 0;
|
||||||
|
my $is_gui = 0;
|
||||||
while (@ARGV) {
|
while (@ARGV) {
|
||||||
my $arg = shift @ARGV;
|
my $arg = shift @ARGV;
|
||||||
if ("$arg" eq "-DDEBUG") {
|
if ("$arg" eq "-DDEBUG") {
|
||||||
@@ -124,11 +125,21 @@ while (@ARGV) {
|
|||||||
# let's ignore those
|
# let's ignore those
|
||||||
} elsif ("$arg" eq "-fno-stack-protector") {
|
} elsif ("$arg" eq "-fno-stack-protector") {
|
||||||
# eat this
|
# eat this
|
||||||
|
} elsif ("$arg" eq "-mwindows") {
|
||||||
|
$is_gui = 1;
|
||||||
} else {
|
} else {
|
||||||
push(@args, $arg);
|
push(@args, $arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($is_linking) {
|
if ($is_linking) {
|
||||||
|
if ($is_gui) {
|
||||||
|
push(@args, "-ENTRY:wWinMainCRTStartup");
|
||||||
|
push(@args, "-SUBSYSTEM:WINDOWS");
|
||||||
|
} else {
|
||||||
|
push(@args, "-ENTRY:wmainCRTStartup");
|
||||||
|
push(@args, "-SUBSYSTEM:CONSOLE");
|
||||||
|
}
|
||||||
|
|
||||||
push(@args, @lflags);
|
push(@args, @lflags);
|
||||||
unshift(@args, "link.exe");
|
unshift(@args, "link.exe");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -502,7 +502,7 @@ endif
|
|||||||
compat/win32/trace2_win32_process_info.o \
|
compat/win32/trace2_win32_process_info.o \
|
||||||
compat/win32/dirent.o
|
compat/win32/dirent.o
|
||||||
COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DENSURE_MSYSTEM_IS_SET -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
|
COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DENSURE_MSYSTEM_IS_SET -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
|
||||||
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
|
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO
|
||||||
# invalidcontinue.obj allows Git's source code to close the same file
|
# invalidcontinue.obj allows Git's source code to close the same file
|
||||||
# handle twice, or to access the osfhandle of an already-closed stdout
|
# handle twice, or to access the osfhandle of an already-closed stdout
|
||||||
# See https://msdn.microsoft.com/en-us/library/ms235330.aspx
|
# See https://msdn.microsoft.com/en-us/library/ms235330.aspx
|
||||||
|
|||||||
Reference in New Issue
Block a user