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 ("__cdecl=__attribute__((__cdecl__))"); \
54 builtin_define ("__declspec(x)=__attribute__((x))"); \
57 builtin_define ("_stdcall=__attribute__((__stdcall__))"); \
58 builtin_define ("_cdecl=__attribute__((__cdecl__))"); \
60 EXTRA_OS_CPP_BUILTINS (); \
61 builtin_assert ("system=winnt"); \
65 /* Specific a different directory for the standard include files. */
66 #undef STANDARD_INCLUDE_DIR
67 #define STANDARD_INCLUDE_DIR "/usr/local/mingw32/include"
68 #undef STANDARD_INCLUDE_COMPONENT
69 #define STANDARD_INCLUDE_COMPONENT "MINGW"
72 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}"
74 /* For Windows applications, include more libraries, but always include
77 #define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \
78 -luser32 -lkernel32 -ladvapi32 -lshell32"
80 /* Include in the mingw32 libraries with libgcc */
82 #define LINK_SPEC "%{mwindows:--subsystem windows} \
83 %{mconsole:--subsystem console} \
84 %{shared: %{mdll: %eshared and mdll are not compatible}} \
85 %{shared: --shared} %{mdll:--dll} \
86 %{static:-Bstatic} %{!static:-Bdynamic} \
87 %{shared|mdll: -e _DllMainCRTStartup@12}"
89 /* Include in the mingw32 libraries with libgcc */
92 "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname -lmsvcrt"
95 #define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
96 %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}"
98 /* MS runtime does not need a separate math library. */
100 #define MATH_LIBRARY ""
102 /* Output STRING, a string representing a filename, to FILE.
103 We canonicalize it to be in Unix format (backslashe are replaced
105 #undef OUTPUT_QUOTED_STRING
106 #define OUTPUT_QUOTED_STRING(FILE, STRING) \
110 putc ('\"', asm_file); \
112 while ((c = *string++) != 0) \
120 putc ('\\', asm_file); \
121 putc (c, asm_file); \
124 fprintf (asm_file, "\\%03o", (unsigned char) c); \
127 putc ('\"', asm_file); \
130 /* Override Cygwin's definition. This is necessary now due to the way
131 Cygwin profiling code is written. Once "fixed", we can remove this. */
132 #undef SUBTARGET_PROLOGUE
134 /* Define as short unsigned for compatability with MS runtime. */
136 #define WINT_TYPE "short unsigned int"