+# Set to the appropriate remove command (must support forward slashes)
+# You can get a suitable rm.exe from ports/mingw32/extra.zip on the ftp site.
+RM=rm -f
+
+# Set to the appropriate copy command (must support forward slashes)
+# You can get a suitable cp.exe from ports/mingw32/extra.zip on the ftp site.
+COPY=cp
+
+########################## Compiler ##################################
+
+ifneq (,$(findstring $(MINGW32VERSION),2.8))
+# According to Guillermo Rodriguez Garcia <guille@iies.es>, the
+# -fno-pcc-struct-return option is needed to make the standard div()
+# function work - otherwise it returns absolutely incorrect results
+# which breaks the wxImage class. This was fixed on 1998-08-14 for
+# mingw and cygwin. It is preferable not to use this option where it
+# is not required, because it is documented to cause binary API
+# incompatibility.
+ _STRUCT_RETURN_WORKAROUND=-fno-pcc-struct-return
+# Really old versions of cygwin are thought to require extra headers.
+ ifneq ($(MINGW32),1)
+ GNUWIN32EXTRA=-I$(WXDIR)/include/wx/msw/gnuwin32
+ endif
+endif
+
+ifneq (,$(findstring $(MINGW32VERSION),2.8 2.9-early))
+# Earlier versions of this makefile defined the following macros
+# explicitly; mingw versions since at least '2.95-late' define
+# them already.
+ OBSOLETE_DEFINES = -D_X86_=1 -DWIN32 -D_WIN32 -D__WIN32__
+endif
+# But cygwin doesn't define them, at least through its version
+# 2.95.3-4 of gcc.
+ifneq ($(MINGW32),1)
+ OBSOLETE_DEFINES = -D_X86_=1 -DWIN32 -D_WIN32 -D__WIN32__
+endif
+
+ifneq (,$(findstring $(MINGW32VERSION),2.8 2.9-early 2.95-late))
+# Versions prior to 3.0 require -fvtable-thunks for OLE support.
+# All code must be built with this option, even C++ libraries you
+# only link to, including system libraries. This option can cause
+# subtle problems with multiple inheritance.
+ _THUNK_WORKAROUND=-fvtable-thunks
+endif
+
+ifeq (,$(findstring $(MINGW32VERSION),2.8 2.9-early))
+# Versions since 2.95.2-1 support '-shared', which makes linking
+# a dll *much* faster; and the accompanying windres supports
+# '--use-temp-file', which is more robust.
+ LD_SUPPORTS_SHARED=yes
+ _USE_TEMP_FILE_IF_SUPPORTED=--use-temp-file
+# Use the WIN32 wxDirDialog only if we have a recent mingw version
+ RECENT_MINGW=yes
+endif
+
+ifeq (,$(findstring $(MINGW32VERSION),2.8 2.9-early 2.95-late))
+# Versions since 3.0 provide win32api.h . An old comment said to
+# define this 'if you have w32api >= 0.5', but mingw 2.95.2-1
+# has no such header.
+ifndef WINE
+ _USE_W32API_HEADER_IF_SUPPORTED = -DHAVE_W32API_H
+endif
+#
+# Revision 1.70.2.6 of this file suggested '--pipe' for mingw but
+# not for cygwin, and only for version 3.0 or later. Since then,
+# the advice given here
+# http://mail.gnu.org/pipermail/autoconf/2000-July/005479.html
+# is followed, and '--pipe' is not used unless you specify it on
+# the make command line, e.g.
+# make CXXFLAGS=--pipe CFLAGS=--pipe -f makefile.g95
+#
+endif
+
+# Define the C++ and C compiler respectively
+ifndef WINE
+CXX = $(CROSS)g++
+CC = $(CROSS)gcc
+else
+CXX = wineg++
+CC = winegcc
+endif