1/* Operating system specific defines to be used when targeting GCC for
2   hosting on U/WIN (Windows32), using GNU tools and the Windows32 API
3   Library, as distinct from winnt.h, which is used to build GCC for use
4   with a windows style library and tool set and uses the Microsoft tools.
5   Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
6   Contributed by Mumit Khan  <khan@xraylith.wisc.edu>.
7
8This file is part of GCC.
9
10GCC is free software; you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 2, or (at your option)
13any later version.
14
15GCC is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with GCC; see the file COPYING.  If not, write to
22the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23Boston, MA 02110-1301, USA.  */
24
25/* Most of this is the same as for Cygwin32, except for changing some
26   specs.  */
27
28#define STANDARD_INCLUDE_COMPONENT "UWIN"
29#define SYSTEM_INCLUDE_DIR "/usr/gnu/include"
30#undef MD_STARTFILE_PREFIX
31#define MD_STARTFILE_PREFIX "/usr/gnu/lib/"
32
33#undef MAYBE_UWIN_CPP_BUILTINS
34#define MAYBE_UWIN_CPP_BUILTINS()			\
35  do							\
36    {							\
37	builtin_define_std ("WINNT");			\
38	builtin_define ("_WIN32");			\
39	builtin_define ("__WIN32__");			\
40	builtin_define ("_UWIN");			\
41	builtin_define ("__UWIN__");			\
42	builtin_define ("__MSVCRT__");			\
43	builtin_define ("_STD_INCLUDE_DIR=mingw32");	\
44    }							\
45  while (0)
46
47#undef CPP_SPEC
48#define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE} \
49  -include /usr/include/astwin32.h \
50  -idirafter /usr/gnu/include/mingw32"
51
52/* For Windows applications, include more libraries, but always include
53   kernel32.  */
54#undef LIB_SPEC
55#define LIB_SPEC \
56  "%{pg:-lgmon} %{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32 -ladvapi32"
57
58/* Include in the mingw32 libraries with libgcc */
59#undef LIBGCC_SPEC
60#define LIBGCC_SPEC "-lgnuwin -lposix -lgcc -last -lmoldname -lmsvcrt"
61
62/* Specify a different entry point when linking a DLL */
63#undef LINK_SPEC
64#define LINK_SPEC \
65  "%{mwindows:--subsystem windows} %{mdll:--dll -e _DllMainCRTStartup@12} \
66  %{!mdll:-u _main}"
67
68#undef STARTFILE_SPEC
69#define STARTFILE_SPEC "%{mdll:dllcrt2%O%s} %{!mdll:crt2%O%s} %{pg:gcrt2%O%s}"
70
71/* These are PE BFD bug workarounds. Should go away eventually.  */
72
73/* Write the extra assembler code needed to declare a function
74   properly.  If we are generating SDB debugging information, this
75   will happen automatically, so we only need to handle other cases.  */
76#undef ASM_DECLARE_FUNCTION_NAME
77#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
78  do									\
79    {									\
80      if (i386_pe_dllexport_name_p (NAME))				\
81	i386_pe_record_exported_symbol (NAME, 0);			\
82      /* UWIN binutils bug workaround.  */				\
83      if (0 && write_symbols != SDB_DEBUG)				\
84	i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL));	\
85      ASM_OUTPUT_LABEL (FILE, NAME);					\
86    }									\
87  while (0)
88
89#undef ASM_OUTPUT_EXTERNAL
90#undef ASM_OUTPUT_EXTERNAL_LIBCALL
91
92