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, 2002, 2003
4 Free Software Foundation, Inc.
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 /* Most of this is the same as for cygwin, except for changing some
26 /* Mingw GCC, unlike Cygwin's, must be relocatable. This macro must
27 be defined before any other files are included. */
28 #ifndef WIN32_NO_ABSOLUTE_INST_DIRS
29 #define WIN32_NO_ABSOLUTE_INST_DIRS 1
32 #include "i386/cygwin.h"
34 #define TARGET_EXECUTABLE_SUFFIX ".exe"
36 /* See i386/crtdll.h for an altervative definition. */
37 #define EXTRA_OS_CPP_BUILTINS() \
40 builtin_define ("__MSVCRT__"); \
41 builtin_define ("__MINGW32__"); \
45 #undef TARGET_OS_CPP_BUILTINS /* From cygwin.h. */
46 #define TARGET_OS_CPP_BUILTINS() \
49 builtin_define ("_WIN32"); \
50 builtin_define_std ("WIN32"); \
51 builtin_define_std ("WINNT"); \
52 builtin_define ("_X86_=1"); \
53 builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
54 builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
55 builtin_define ("__declspec(x)=__attribute__((x))"); \
58 builtin_define ("_stdcall=__attribute__((__stdcall__))"); \
59 builtin_define ("_cdecl=__attribute__((__cdecl__))"); \
61 EXTRA_OS_CPP_BUILTINS (); \
62 builtin_assert ("system=winnt"); \
66 /* Specific a different directory for the standard include files. */
67 #undef STANDARD_INCLUDE_DIR
68 #define STANDARD_INCLUDE_DIR "/usr/local/mingw32/include"
69 #undef STANDARD_INCLUDE_COMPONENT
70 #define STANDARD_INCLUDE_COMPONENT "MINGW"
73 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}"
75 /* For Windows applications, include more libraries, but always include
78 #define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
79 -luser32 -lkernel32 -ladvapi32 -lshell32"
81 /* Include in the mingw32 libraries with libgcc */
83 #define LINK_SPEC "%{mwindows:--subsystem windows} \
84 %{mconsole:--subsystem console} \
85 %{shared: %{mdll: %eshared and mdll are not compatible}} \
86 %{shared: --shared} %{mdll:--dll} \
87 %{static:-Bstatic} %{!static:-Bdynamic} \
88 %{shared|mdll: -e _DllMainCRTStartup@12}"
90 /* Include in the mingw32 libraries with libgcc */
93 "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt"
96 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
97 %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}"
99 /* MS runtime does not need a separate math library. */
101 #define MATH_LIBRARY ""
103 /* Output STRING, a string representing a filename, to FILE.
104 We canonicalize it to be in Unix format (backslashe are replaced
106 #undef OUTPUT_QUOTED_STRING
107 #define OUTPUT_QUOTED_STRING(FILE, STRING) \
111 putc ('\"', asm_file); \
113 while ((c = *string++) != 0) \
121 putc ('\\', asm_file); \
122 putc (c, asm_file); \
125 fprintf (asm_file, "\\%03o", (unsigned char) c); \
128 putc ('\"', asm_file); \
131 /* Define as short unsigned for compatability with MS runtime. */
133 #define WINT_TYPE "short unsigned int"