1240116Smarcel/* Operating system specific defines to be used when targeting GCC for
2240116Smarcel   hosting on U/WIN (Windows32), using GNU tools and the Windows32 API
3240116Smarcel   Library, as distinct from winnt.h, which is used to build GCC for use
4240116Smarcel   with a windows style library and tool set and uses the Microsoft tools.
5240116Smarcel   Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
6240116Smarcel   Contributed by Mumit Khan  <khan@xraylith.wisc.edu>.
7240116Smarcel
8240116SmarcelThis file is part of GCC.
9240116Smarcel
10240116SmarcelGCC is free software; you can redistribute it and/or modify
11240116Smarcelit under the terms of the GNU General Public License as published by
12240116Smarcelthe Free Software Foundation; either version 2, or (at your option)
13240116Smarcelany later version.
14240116Smarcel
15240116SmarcelGCC is distributed in the hope that it will be useful,
16240116Smarcelbut WITHOUT ANY WARRANTY; without even the implied warranty of
17240116SmarcelMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18240116SmarcelGNU General Public License for more details.
19240116Smarcel
20240116SmarcelYou should have received a copy of the GNU General Public License
21240116Smarcelalong with GCC; see the file COPYING.  If not, write to
22240116Smarcelthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
23240116SmarcelBoston, MA 02110-1301, USA.  */
24240116Smarcel
25240116Smarcel/* Most of this is the same as for Cygwin32, except for changing some
26240116Smarcel   specs.  */
27240116Smarcel
28240116Smarcel#define STANDARD_INCLUDE_COMPONENT "UWIN"
29240116Smarcel#define SYSTEM_INCLUDE_DIR "/usr/gnu/include"
30240116Smarcel#undef MD_STARTFILE_PREFIX
31240116Smarcel#define MD_STARTFILE_PREFIX "/usr/gnu/lib/"
32240116Smarcel
33240116Smarcel#undef MAYBE_UWIN_CPP_BUILTINS
34240116Smarcel#define MAYBE_UWIN_CPP_BUILTINS()			\
35240116Smarcel  do							\
36240116Smarcel    {							\
37240116Smarcel	builtin_define_std ("WINNT");			\
38240116Smarcel	builtin_define ("_WIN32");			\
39240116Smarcel	builtin_define ("__WIN32__");			\
40240116Smarcel	builtin_define ("_UWIN");			\
41240116Smarcel	builtin_define ("__UWIN__");			\
42240116Smarcel	builtin_define ("__MSVCRT__");			\
43240116Smarcel	builtin_define ("_STD_INCLUDE_DIR=mingw32");	\
44240116Smarcel    }							\
45240116Smarcel  while (0)
46240116Smarcel
47240116Smarcel#undef CPP_SPEC
48240116Smarcel#define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE} \
49240116Smarcel  -include /usr/include/astwin32.h \
50240116Smarcel  -idirafter /usr/gnu/include/mingw32"
51240116Smarcel
52240116Smarcel/* For Windows applications, include more libraries, but always include
53240116Smarcel   kernel32.  */
54240116Smarcel#undef LIB_SPEC
55240116Smarcel#define LIB_SPEC \
56240116Smarcel  "%{pg:-lgmon} %{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32 -ladvapi32"
57240116Smarcel
58240116Smarcel/* Include in the mingw32 libraries with libgcc */
59240116Smarcel#undef LIBGCC_SPEC
60240116Smarcel#define LIBGCC_SPEC "-lgnuwin -lposix -lgcc -last -lmoldname -lmsvcrt"
61240116Smarcel
62240116Smarcel/* Specify a different entry point when linking a DLL */
63240116Smarcel#undef LINK_SPEC
64240116Smarcel#define LINK_SPEC \
65240116Smarcel  "%{mwindows:--subsystem windows} %{mdll:--dll -e _DllMainCRTStartup@12} \
66240116Smarcel  %{!mdll:-u _main}"
67240116Smarcel
68240116Smarcel#undef STARTFILE_SPEC
69240116Smarcel#define STARTFILE_SPEC "%{mdll:dllcrt2%O%s} %{!mdll:crt2%O%s} %{pg:gcrt2%O%s}"
70240116Smarcel
71240116Smarcel/* These are PE BFD bug workarounds. Should go away eventually.  */
72240116Smarcel
73240116Smarcel/* Write the extra assembler code needed to declare a function
74240116Smarcel   properly.  If we are generating SDB debugging information, this
75240116Smarcel   will happen automatically, so we only need to handle other cases.  */
76240116Smarcel#undef ASM_DECLARE_FUNCTION_NAME
77240116Smarcel#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
78240116Smarcel  do									\
79240116Smarcel    {									\
80240116Smarcel      if (i386_pe_dllexport_name_p (NAME))				\
81240116Smarcel	i386_pe_record_exported_symbol (NAME, 0);			\
82240116Smarcel      /* UWIN binutils bug workaround.  */				\
83240116Smarcel      if (0 && write_symbols != SDB_DEBUG)				\
84240116Smarcel	i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL));	\
85240116Smarcel      ASM_OUTPUT_LABEL (FILE, NAME);					\
86240116Smarcel    }									\
87240116Smarcel  while (0)
88240116Smarcel
89251108Smarcel#undef ASM_OUTPUT_EXTERNAL
90240116Smarcel#undef ASM_OUTPUT_EXTERNAL_LIBCALL
91240116Smarcel
92240116Smarcel