#
MINGW32=1
+# set MIN_SUFFIX to nothing if you use only MinGW compiler, set it to
+# something MinGW-specific if you want to build wxWindows with more than one
+# compiler
+ifeq ($(MINGW32),1)
+ MIN_SUFFIX=_min
+else
+ MIN_SUFFIX=_cyg
+endif
+
# Set to your gcc version. Generally 'gcc --version' tells you
# which version you have. But it cannot distinguish between
# 2.95.2-1 and earlier suffix versions of 2.95 . In that case,
# gcc 3.x provides a win32api.h header
MINGW32VERSION=3.0
+# If you want to compile on Wine, simply uncomment this variable
+# If you don't want to edit the file, you can simply define it
+# on the command line like so: make WINE=1 -f makefile.g95
+#WINE=1
+
+# Set this if you are using a cross-compiler, i.e. compiling on one system
+# the program for another one
+# CROSS=i386-mingw32-
+
# If we're using MSYS, or other utilities that use forward slashes,
# you need to set this when invoking the makefile from DOS, or the
# wrong separators will be assumed. However, if you're using MSYS,
# you really ought to invoke the makefile from MSYS--or, even better,
# use the './configure && make' technique that MSYS is designed for.
+ifndef WINE
#OSTYPE=msys
+else
+OSTYPE=msys
+endif
# If building DLL, the version
-WXVERSION=250
+include $(WXDIR)/src/version.mak
+WXVERSION=$(wxMAJOR_VERSION)$(wxMINOR_VERSION)$(wxRELEASE_NUMBER_IFUNSTABLE)
ifndef UNICODE
UNICODE=0
# 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,
#
endif
-# C compiler
-CXX = g++
-
-# C compiler
-CC = gcc
+# Define the C++ and C compiler respectively
+ifndef WINE
+CXX = $(CROSS)g++
+CC = $(CROSS)gcc
+else
+CXX = wineg++
+CC = winegcc
+endif
# Compiler used for LEX generated C
# For now at least, it can be the same as the regular C compiler
-CCLEX = $(CC)
+CCLEX = $(CROSS)$(CC)
# This shouldn't be needed as make is supposed to define this
# variable itself. Uncomment it if your make complains.
# Settings for Cyginw/Mingw32
# Some versions of windres cannot cope with the --preprocessor
# option. Uncomment the RCPREPROCESSOR line below if yours can.
-RESCOMP=windres $(_USE_TEMP_FILE_IF_SUPPORTED)
+ifndef WINE
+RESCOMP=$(CROSS)windres $(_USE_TEMP_FILE_IF_SUPPORTED)
+else
+RESCOMP=wrc
+endif
RCINPUTSWITCH=-i
RCOUTPUTSWITCH=-o
RCINCSWITCH=--include-dir
RESFLAGS=$(RCPREPROCESSOR) $(RCINCSWITCH) $(WXDIR)/include $(RCEXTRAINC) $(RCDEFSWITCH) __WIN32__ $(RCDEFSWITCH) __WIN95__ $(RCDEFSWITCH) __GNUWIN32__
# Needed to build a DLL if your linker does not support --shared option.
-AS = as
-DLLTOOL = dlltool
+AS = $(CROSS)as
+DLLTOOL = $(CROSS)dlltool
########################## Compiler flags #############################
+# Unicode defines
+ifeq ($(UNICODE),1)
+ UNICODE_OPT = -D_UNICODE -DUNICODE -DwxUSE_UNICODE=1
+else
+ UNICODE_OPT =
+endif
+
# Miscellaneous compiler options
OPTIONS = -DSTRICT $(_USE_W32API_HEADER_IF_SUPPORTED)
# Add "-mthreads" if you want to have threads under mingw32
-COMMON_THREADFLAGS =
+# Add "-mno-cygwin" if you want to link with msvcrt.dll in Cywin and Wine
+# Otherwise, you link against the native runtime (cygwin.dll
+# or libc). Having the flag in mingw32 does not hurt as you
+# always link against msvcrt.dll By default it should be on,
+# to minimize dependencies on Cygwin, and have more correct
+# filename behaviour in Wine.
+COMMON_FLAGS = -mno-cygwin # -mthreads
# Debugging information
ifeq ($(FINAL),0)
else
APPVER=4.0 # 3.50
# This means 'enable Windows 95 features' (in wxWindows and in the compiler).
-WINVERSION=-DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__
+WINVERSION=-DWINVER=0x0400 -D__GNUWIN32__
endif
# This is never used and should be expunged.
# build wxbase/wxMSW
ifeq ($(wxUSE_GUI),1)
TOOLKIT=msw
- GUI = -D__WXMSW__ -D__WINDOWS__
+ GUI =
else
TOOLKIT=base
- GUI = -D__WXMSW__ -D__WINDOWS__ -DwxUSE_GUI=0
+ GUI = -DwxUSE_GUI=0
endif
ifeq ($(FINAL),1)
# Options for ar archiver
AROPTIONS = ruv
-AR = ar
-RANLIB = ranlib
+AR = $(CROSS)ar
+RANLIB = $(CROSS)ranlib
# Extra compiler libraries
COMPLIBS=
BASELIBS=-lstdc++ -lgcc -lodbc32 -lwsock32
ifeq ($(wxUSE_GUI),1)
WINLIBS= $(BASELIBS) \
- -lwinspool -lwinmm -lshell32 \
- -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 \
- -lodbc32 -lwsock32 -lopengl32 -lglu32 $(OLELIBS) # -loldnames
+ -lwinspool -lwinmm -lshell32 \
+ -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 \
+ -lodbc32 -lwsock32 -lopengl32 -lglu32 $(OLELIBS) # -loldnames
else
WINLIBS=$(BASELIBS)
endif
#WINLIBS=-lstdc++ -lgcc \
-# -lwinspool -lwinmm -lshell32 \
+# -lwinspool -lwinmm -lshell32 \
# -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 # -loldnames
# Shouldn't need to change these...
# png, jpeg, etc are exported from wx dll, so skip and save on link time.
LIBS = $(EXTRALIBS) $(WXLIB) $(WINLIBS) $(COMPLIBS)
else
- LIBS = $(EXTRALIBS) $(WXLIB) -lregex -lpng -ljpeg -lzlib -ltiff $(WINLIBS) $(COMPLIBS)
+ LIBS = $(EXTRALIBS) $(WXLIB) -lregex$(MIN_SUFFIX) -lpng$(MIN_SUFFIX) -ljpeg$(MIN_SUFFIX) -lzlib$(MIN_SUFFIX) -ltiff$(MIN_SUFFIX) $(WINLIBS) $(COMPLIBS)
endif
WINFLAGS = $(OBSOLETE_DEFINES) $(WINVERSION)
ifdef WXMAKINGDLL
EXTRADLLFLAGS = -DWXMAKINGDLL=1 -D_DLL=1 -D_WINDLL=1
- WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT).$(LIBSUFF)
+ WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF)
endif
ifdef WXUSINGDLL
EXTRADLLFLAGS = -DWXUSINGDLL=1
- WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT).$(LIBSUFF)
+ WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF)
endif
# C and C++ compiler flags for compatibility with old gcc versions
REQUIRED_GCC_FLAGS = $(_STRUCT_RETURN_WORKAROUND) $(_THUNK_WORKAROUND)
# C++ compiler flags
-ALL_CXXFLAGS = $(COMMON_THREADFLAGS) $(REQUIRED_GCC_FLAGS) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CXXFLAGS)
+ALL_CXXFLAGS = $(COMMON_FLAGS) $(REQUIRED_GCC_FLAGS) $(UNICODE_OPT) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CXXFLAGS)
# C compiler flags
-ALL_CFLAGS = $(COMMON_THREADFLAGS) $(REQUIRED_GCC_FLAGS) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CFLAGS)
+ALL_CFLAGS = $(COMMON_FLAGS) $(REQUIRED_GCC_FLAGS) $(UNICODE_OPT) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CFLAGS)
# Linker flags
-ALL_LDFLAGS = $(COMMON_THREADFLAGS) $(WINDOWSLDFLAGS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
+ALL_LDFLAGS = $(COMMON_FLAGS) $(WINDOWSLDFLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
# under Cygwin, Dlls must not be linked with subsystem=windows
-ALL_LDFLAGS_DLL = $(COMMON_THREADFLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
+ALL_LDFLAGS_DLL = $(COMMON_FLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS)
.SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .cxx .cc .c