uwin.h revision 52284
152284Sobrien/* Operating system specific defines to be used when targeting GCC for
252284Sobrien   hosting on U/WIN (Windows32), using GNU tools and the Windows32 API
352284Sobrien   Library, as distinct from winnt.h, which is used to build GCC for use
452284Sobrien   with a windows style library and tool set and uses the Microsoft tools.
552284Sobrien   Copyright (C) 1999 Free Software Foundation, Inc.
652284Sobrien   Contributed by Mumit Khan  <khan@xraylith.wisc.edu>.
752284Sobrien
852284SobrienThis file is part of GNU CC.
952284Sobrien
1052284SobrienGNU CC is free software; you can redistribute it and/or modify
1152284Sobrienit under the terms of the GNU General Public License as published by
1252284Sobrienthe Free Software Foundation; either version 2, or (at your option)
1352284Sobrienany later version.
1452284Sobrien
1552284SobrienGNU CC is distributed in the hope that it will be useful,
1652284Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1752284SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1852284SobrienGNU General Public License for more details.
1952284Sobrien
2052284SobrienYou should have received a copy of the GNU General Public License
2152284Sobrienalong with GNU CC; see the file COPYING.  If not, write to
2252284Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330,
2352284SobrienBoston, MA 02111-1307, USA. */
2452284Sobrien
2552284Sobrien/* Most of this is the same as for Cygwin32, except for changing some
2652284Sobrien   specs.  */
2752284Sobrien
2852284Sobrien#include "i386/cygwin.h"
2952284Sobrien
3052284Sobrien#define STANDARD_INCLUDE_COMPONENT "UWIN"
3152284Sobrien#define SYSTEM_INCLUDE_DIR "/usr/gnu/include"
3252284Sobrien
3352284Sobrien#undef CPP_PREDEFINES
3452284Sobrien#define CPP_PREDEFINES "-D__i386__ -D_WIN32 -D__WIN32__ \
3552284Sobrien  -D_UWIN -DWINNT  -D_X86_=1 -D__STDC__=1 \
3652284Sobrien  -D__UWIN__ -D__MSVCRT__ \
3752284Sobrien  -D_STD_INCLUDE_DIR=mingw32 \
3852284Sobrien  -D__stdcall=__attribute__((__stdcall__)) \
3952284Sobrien  _D_stdcall=__attribute__((__stdcall__)) \
4052284Sobrien  -D__cdecl=__attribute__((__cdecl__)) \
4152284Sobrien  -D__declspec(x)=__attribute__((x)) \
4252284Sobrien  -Asystem(winnt) -Acpu(i386) -Amachine(i386)"
4352284Sobrien
4452284Sobrien#undef CPP_SPEC
4552284Sobrien#define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
4652284Sobrien  -include /usr/include/astwin32.h \
4752284Sobrien  -idirafter /usr/gnu/include/mingw32"
4852284Sobrien
4952284Sobrien/* For Windows applications, include more libraries, but always include
5052284Sobrien   kernel32.  */
5152284Sobrien#undef LIB_SPEC
5252284Sobrien#define LIB_SPEC \
5352284Sobrien  "%{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32 -ladvapi32"
5452284Sobrien
5552284Sobrien/* This is needed in g77spec.c for now. Will be removed in the future. */
5652284Sobrien#define WIN32_UWIN_TARGET 1
5752284Sobrien
5852284Sobrien/* Include in the mingw32 libraries with libgcc */
5952284Sobrien#undef LIBGCC_SPEC
6052284Sobrien#define LIBGCC_SPEC "-lgnuwin -lposix -lgcc -last -lmoldname -lmsvcrt"
6152284Sobrien
6252284Sobrien/* Specify a different entry point when linking a DLL */
6352284Sobrien#undef LINK_SPEC
6452284Sobrien#define LINK_SPEC \
6552284Sobrien  "%{mwindows:--subsystem windows} %{mdll:--dll -e _DllMainCRTStartup@12}"
6652284Sobrien
6752284Sobrien#undef STARTFILE_SPEC
6852284Sobrien#define STARTFILE_SPEC "%{mdll:dllcrt2%O%s} %{!mdll:crt2%O%s}"
6952284Sobrien
7052284Sobrien/* These are PE BFD bug workarounds. Should go away eventually. */
7152284Sobrien
7252284Sobrien#undef ASM_DECLARE_FUNCTION_NAME
7352284Sobrien#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
7452284Sobrien  do									\
7552284Sobrien    {									\
7652284Sobrien      if (i386_pe_dllexport_name_p (NAME))				\
7752284Sobrien	{								\
7852284Sobrien	  drectve_section ();						\
7952284Sobrien	  fprintf ((FILE), "\t.ascii \" -export:%s\"\n", 		\
8052284Sobrien		   I386_PE_STRIP_ENCODING (NAME));			\
8152284Sobrien	  function_section (DECL);					\
8252284Sobrien	}								\
8352284Sobrien      /* disable i386_pe_declare_function_type for UWIN */		\
8452284Sobrien      if (0 && write_symbols != SDB_DEBUG)				\
8552284Sobrien	i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL));	\
8652284Sobrien      ASM_OUTPUT_LABEL (FILE, NAME);					\
8752284Sobrien    }									\
8852284Sobrien  while (0)
8952284Sobrien
9052284Sobrien#undef ASM_OUTPUT_EXTERNAL
9152284Sobrien#undef ASM_OUTPUT_EXTERNAL_LIBCALL
9252284Sobrien#undef ASM_FILE_END
9352284Sobrien
94