1 /* Operating system specific defines to be used when targeting GCC for
2 hosting on Windows32, using GNU tools and the Windows32 API Library.
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* Most of this is the same as for cygwin, except for changing some
25 /* Mingw GCC, unlike Cygwin's, must be relocatable. This macro must
26 be defined before any other files are included. */
27 #ifndef WIN32_NO_ABSOLUTE_INST_DIRS
28 #define WIN32_NO_ABSOLUTE_INST_DIRS 1
31 #include "i386/cygwin.h"
33 #define TARGET_EXECUTABLE_SUFFIX ".exe"
35 /* See i386/crtdll.h for an altervative definition. */
36 #define EXTRA_OS_CPP_BUILTINS() \
39 builtin_define ("__MSVCRT__"); \
40 builtin_define ("__MINGW32__"); \
44 #undef TARGET_OS_CPP_BUILTINS /* From cygwin.h. */
45 #define TARGET_OS_CPP_BUILTINS() \
48 builtin_define ("_WIN32"); \
49 builtin_define_std ("WIN32"); \
50 builtin_define_std ("WINNT"); \
51 builtin_define ("_X86_=1"); \
52 builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
53 builtin_define ("__fastcall=__attribute__((__fastcall__))"); \
54 builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
55 builtin_define ("__declspec(x)=__attribute__((x))"); \
58 builtin_define ("_stdcall=__attribute__((__stdcall__))"); \
59 builtin_define ("_fastcall=__attribute__((__fastcall__))"); \
60 builtin_define ("_cdecl=__attribute__((__cdecl__))"); \
62 EXTRA_OS_CPP_BUILTINS (); \
63 builtin_assert ("system=winnt"); \
67 /* Specific a different directory for the standard include files. */
68 #undef STANDARD_INCLUDE_DIR
69 #define STANDARD_INCLUDE_DIR "/usr/local/mingw32/include"
70 #undef STANDARD_INCLUDE_COMPONENT
71 #define STANDARD_INCLUDE_COMPONENT "MINGW"
74 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}"
76 /* For Windows applications, include more libraries, but always include
79 #define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
80 -luser32 -lkernel32 -ladvapi32 -lshell32"
82 /* Include in the mingw32 libraries with libgcc */
84 #define LINK_SPEC "%{mwindows:--subsystem windows} \
85 %{mconsole:--subsystem console} \
86 %{shared: %{mdll: %eshared and mdll are not compatible}} \
87 %{shared: --shared} %{mdll:--dll} \
88 %{static:-Bstatic} %{!static:-Bdynamic} \
89 %{shared|mdll: -e _DllMainCRTStartup@12}"
91 /* Include in the mingw32 libraries with libgcc */
94 "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmsvcrt"
97 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
98 %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}"
100 /* MS runtime does not need a separate math library. */
102 #define MATH_LIBRARY ""
104 /* Output STRING, a string representing a filename, to FILE.
105 We canonicalize it to be in Unix format (backslashe are replaced
107 #undef OUTPUT_QUOTED_STRING
108 #define OUTPUT_QUOTED_STRING(FILE, STRING) \
112 putc ('\"', asm_file); \
114 while ((c = *string++) != 0) \
122 putc ('\\', asm_file); \
123 putc (c, asm_file); \
126 fprintf (asm_file, "\\%03o", (unsigned char) c); \
129 putc ('\"', asm_file); \
132 /* Define as short unsigned for compatability with MS runtime. */
134 #define WINT_TYPE "short unsigned int"