X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/53fdeb16a862d0fbba3e3829e9c8f56e402b03ce..f5766910b6731eb03e82371416e9778203396ce7:/src/makeg95.env diff --git a/src/makeg95.env b/src/makeg95.env index 6a6788ae21..f235603377 100644 --- a/src/makeg95.env +++ b/src/makeg95.env @@ -10,25 +10,92 @@ # CVS_ID: $Id$ # -# If using Cygwin beta, set this to 0. -# If using Mingw32 or Cygwin 1.0 or later, set this to 1. +# The MINGW32 and MINGW32VERSION variables are preconfigured for +# MinGW gcc version 3.x and must both be changed for any version +# earlier than 3.0 or for cygwin. Editing this file is one way to +# change them. An easier way, at least with GNU make, is to override +# them on the command line, e.g. +# make MINGW32=0 MINGW32VERSION=2.8 -f makefile.g95 + +# If using Mingw32 (any version), set this to 1. +# If using Cygwin (any version), set this to 0. +# +# This agrees with the instructions given in docs/msw/install.txt . +# Earlier versions of this makefile suggested setting MINGW32=1 for +# recent versions of cygwin, but that would give the wrong dll entry +# point in src/msw/makefile.g95 . +# +# With cygwin, there are still some problems compiling wxWindows +# this way; './configure && make' may work better. +# MINGW32=1 -# Set to the version you have -MINGW32VERSION=2.95 +# 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, +# inspect the dates of bin/gcc.exe and bin/ld.exe ; if they +# are at least +# 2000-01-21 for gcc.exe and +# 2000-02-04 for ld.exe +# then use '2.95-late'. +# +# gcc 2.8.x and earlier require struct-return workaround +#MINGW32VERSION=2.8 +# +# gcc 2.95.2 and earlier requires special thunk option +#MINGW32VERSION=2.9-early +# +# mingw gcc-2.95.2-1 supports '-shared' +# windres provided with gcc-2.95.2-1 supports temp file option +#MINGW32VERSION=2.95-late +# +# 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=232 +include $(WXDIR)/src/version.mak +WXVERSION=$(wxMAJOR_VERSION)$(wxMINOR_VERSION)$(wxRELEASE_NUMBER_IFUNSTABLE) ifndef UNICODE - UNICODE=0 + UNICODE=0 endif -# Say yes if you have a "modern" linker that supports --shared option. -# Note that you're probably going to wait forever for dlltool/gcc/etc -# to build the DLL, so you should really use a newer linker that -# supports --shared. -LD_SUPPORTS_SHARED=yes +ifndef FINAL + FINAL=0 +endif + +ifndef wxUSE_GUI + wxUSE_GUI=1 +endif # 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. @@ -38,56 +105,113 @@ RM=rm -f # You can get a suitable cp.exe from ports/mingw32/extra.zip on the ftp site. COPY=cp -# Cross compiling? Provide the target prefix (eg., i386-mingw32-) -# CROSS=i386-mingw32- - ########################## Compiler ################################## -# C++ compiler -# Put a comment before --pipe for Cygwin, remove comment for Mingw32 2.95 - -ifeq ($(MINGW32),1) - ifneq "$(findstring 2.95, $(MINGW32VERSION))" "" - CC = $(CROSS)gcc --pipe -fvtable-thunks - else - CC = $(CROSS)gcc +ifneq (,$(findstring $(MINGW32VERSION),2.8)) +# According to Guillermo Rodriguez Garcia , 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 -else - CC = $(CROSS)gcc endif -# C compiler for pure C programs -CCC = $(CC) +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 # Compiler used for LEX generated C -CCLEX=$(CROSS)gcc +# For now at least, it can be the same as the regular C compiler +CCLEX = $(CROSS)$(CC) # This shouldn't be needed as make is supposed to define this # variable itself. Uncomment it if your make complains. #MAKE=make # LEX (currently unused) -LEX=flex # -t -L +# LEX=flex # -t -L # YACC (currently unused) -YACC=byacc -#YACC=bison +# YACC=byacc +# YACC=bison # Settings for Cyginw/Mingw32 # Some versions of windres cannot cope with the --preprocessor # option. Uncomment the RCPREPROCESSOR line below if yours can. -RESCOMP=$(CROSS)windres +ifndef WINE +RESCOMP=$(CROSS)windres $(_USE_TEMP_FILE_IF_SUPPORTED) +else +RESCOMP=wrc +endif RCINPUTSWITCH=-i RCOUTPUTSWITCH=-o RCINCSWITCH=--include-dir RCDEFSWITCH=--define # Note that this can cause windres to fail (Win95/98 problem?) # but commenting out RCPREPROCESSOR then does the trick. -#RCPREPROCESSOR=--preprocessor "$(CC) -c -E -xc-header -DRC_INVOKED" +#RCPREPROCESSOR=--preprocessor "$(CXX) -c -E -xc-header -DRC_INVOKED" # Don't make this too long (e.g. by adding contrib/include/wx) because it will # truncate the command line -# Note: --use-temp-file removed since Mingw32 2.95.2 doesn't recognise it 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. @@ -96,13 +220,29 @@ 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 -# GRG: the __MINGW32__ option is not needed anymore -# add "-DHAVE_W32API_H" if you have w32api >= 0.5 -OPTIONS = -DSTRICT # -D__MINGW32__ +OPTIONS = -DSTRICT $(_USE_W32API_HEADER_IF_SUPPORTED) + +# Add "-mthreads" if you want to have threads under mingw32 +# 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 -DEBUGFLAGS = -D__WXDEBUG__ +ifeq ($(FINAL),0) + DEBUGFLAGS = -g -D__WXDEBUG__ +endif WIN95=1 @@ -111,14 +251,15 @@ ifeq ($(WIN95),0) # With 4.0, you'll have to follow Win95 procedures for icons or you'll get the # default Windows icon. APPVER=3.50 -WINVERSION=-DWINVER=0x0350 -D__GNUWIN32__ -D__WIN32__ # Generic WIN32 +WINVERSION=-DWINVER=0x0350 -D__GNUWIN32__ # Generic WIN32 else APPVER=4.0 # 3.50 -# This means 'enable Windows 95 features' (in wxWindows and in VC++ 4.0). -WINVERSION=-DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ +# This means 'enable Windows 95 features' (in wxWindows and in the compiler). +WINVERSION=-DWINVER=0x0400 -D__GNUWIN32__ endif -CPU=i386 +# This is never used and should be expunged. +# CPU=i386 # Suffixes OBJSUFF=o @@ -132,20 +273,24 @@ RSCSUFF=rsc # Warnings WARN = -Wall -# Which GUI, -Dwx_xview or -Dwx_motif (don't change this) -GUI = -D__WXMSW__ -D__WINDOWS__ +# build wxbase/wxMSW +ifeq ($(wxUSE_GUI),1) + TOOLKIT=msw + GUI = +else + TOOLKIT=base + GUI = -DwxUSE_GUI=0 +endif -# According to Guillermo Rodriguez Garcia , 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 is true at least for -# mingw32-gcc2.8.1, don't know about others. -OPT = -fno-pcc-struct-return -O2 -fno-rtti -fno-exceptions +ifeq ($(FINAL),1) + OPT = -O2 -fno-rtti -fno-exceptions +else + OPT = -fno-rtti -fno-exceptions +endif # Options for ar archiver -# AROPTIONS = crs # For IRIX and Solaris (both SYSVR4). -AR = $(CROSS)ar AROPTIONS = ruv +AR = $(CROSS)ar RANLIB = $(CROSS)ranlib # Extra compiler libraries @@ -157,45 +302,41 @@ COMPPATHS= ########################## Directories ############################### OLELIBS=-lole32 -loleaut32 -luuid -WINLIBS=-lstdc++ -lgcc \ - -lwinspool -lwinmm -lshell32 \ - -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 \ - -lodbc32 -lwsock32 -lopengl32 -lglu32 $(OLELIBS) # -loldnames +BASELIBS=-lstdc++ -lgcc -lodbc32 -lwsock32 +ifeq ($(wxUSE_GUI),1) + WINLIBS= $(BASELIBS) \ + -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... WXSRC=$(WXDIR)/src/msw WXINC=$(WXDIR)/include WXBASESRC=$(WXDIR)/src/common -WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx.$(LIBSUFF) - -GNUWIN32EXTRA=-I$(WXDIR)/include/wx/msw/gnuwin32 - -ifeq ($(MINGW32),1) - ifneq "$(findstring 2.95, $(MINGW32VERSION))" "" - GNUWIN32EXTRA= - endif -endif #ifeq ($(MINGW32),1) #INC = -I$(WXINC) -I$(WXDIR)/contrib/include -I$(WXDIR)/src/png -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/tiff $(EXTRAINC) $(COMPPATHS) #else -INC = -I$(WXDIR)/lib/msw$(INCEXT) -I$(WXINC) -I$(WXDIR)/contrib/include -I$(WXDIR)/src/regex -I$(WXDIR)/src/png -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/tiff $(EXTRAINC) $(COMPPATHS) -I$(WXDIR)/include/wx/msw/gnuwin32 +INC = -I$(WXDIR)/lib/$(TOOLKIT)$(INCEXT) -I$(WXINC) -I$(WXDIR)/contrib/include -I$(WXDIR)/src/regex -I$(WXDIR)/src/png -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/tiff $(EXTRAINC) $(COMPPATHS) $(GNUWIN32EXTRA) #endif -RCLFLAGS=-cpp "cpp -lang-c++ -DWIN32 -D_WIN32 -DRCL_INVOKED -I$(WXWIN)/include" +RCLFLAGS=-cpp "cpp -lang-c++ $(OBSOLETE_DEFINES) -DRCL_INVOKED -I$(WXWIN)/include" ifdef WXUSINGDLL # 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=-D_X86_=1 -DWIN32 -D_WIN32 $(WINVERSION) +WINFLAGS = $(OBSOLETE_DEFINES) $(WINVERSION) #for windows 95 XINCLUDE=$(WINFLAGS) @@ -206,6 +347,12 @@ LDLIBS = $(LIBS) # OBJDIR = objects$(GUISUFFIX) OBJDIR = . +ifeq ($(FINAL),1) + DEBEXT= +else + DEBEXT=d +endif + ifeq ($(UNICODE),1) UNIEXT=u else @@ -213,38 +360,78 @@ else endif ifeq ($(WXMAKINGDLL)$(WXUSINGDLL),) - INCEXT=$(UNIEXT) + INCEXT=$(UNIEXT)$(DEBEXT) else - INCEXT=dll$(UNIEXT) + INCEXT=dll$(UNIEXT)$(DEBEXT) endif +WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(UNIEXT)$(DEBEXT).$(LIBSUFF) + ifdef WXMAKINGDLL EXTRADLLFLAGS = -DWXMAKINGDLL=1 -D_DLL=1 -D_WINDLL=1 - WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wxmsw$(WXVERSION)$(UNIEXT).$(LIBSUFF) + WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF) endif ifdef WXUSINGDLL EXTRADLLFLAGS = -DWXUSINGDLL=1 - WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wxmsw$(WXVERSION)$(UNIEXT).$(LIBSUFF) + WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF) endif -# You shouldn't need to change these... -CPPFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRACPPFLAGS) $(EXTRADLLFLAGS) -CFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRACFLAGS) -DWIN32_LEAN_AND_MEAN -WINDOWSLDFLAGS=-Wl,--subsystem,windows -mwindows -LDFLAGS = $(WINDOWSLDFLAGS) -L$(WXDIR)/lib -L$(WXDIR)/contrib/lib $(EXTRALDFLAGS) +ifeq ($(wxUSE_GUI),1) + WINDOWSLDFLAGS=-Wl,--subsystem,windows + WINDOWSLDLIBS=-mwindows +endif -.SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .cxx .c +# Note: WIN32_LEAN_AND_MEAN is defined only for C and not for C++ compiles. +# Defining this macro means that a great deal of less commonly used stuff +# is ignored in the windows headers, resulting in faster compiles. It can't +# be used with some C++ source files. It just so happens that it can be +# used with all C source files. -.c.o: - $(CC) -c $(CFLAGS) -o $@ $*.c +CFLAGS = -DWIN32_LEAN_AND_MEAN -.cxx.o: - $(CC) -c $(CPPFLAGS) -o $@ $*.cxx +WXLIBDIRS = -L$(WXDIR)/lib -L$(WXDIR)/contrib/lib -.$(SRCSUFF).$(OBJSUFF): - $(CC) -c $(CPPFLAGS) -o $@ $*.$(SRCSUFF) +# You shouldn't need to change these flags, which are merely composed of +# the options selected above. You can add more flags by specifying them on +# the make command line, e.g. +# make CXXFLAGS='-O3 -march=i686' -f makefile.g95 +# The gnu make manual says +# 'Users expect to be able to specify CFLAGS freely themselves' +# That was unsafe with older versions of this makefile, but now it works. +# +# C preprocessor flags +# Some makefiles pass extra flags in $(EXTRACPPFLAGS); although earlier +# versions of this file used CPPFLAGS as C++ compiler flags (instead of +# as C preprocessor flags), it is OK to add them to the preprocessor +# flags, which are always used for C++ compiles. Because other makefiles +# use this method to override these flags, they are added after $(CPPFLAGS), +# which would normally come last. +ALL_CPPFLAGS = $(XINCLUDE) $(INC) $(CPPFLAGS) $(EXTRACPPFLAGS) +# 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_FLAGS) $(REQUIRED_GCC_FLAGS) $(UNICODE_OPT) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CXXFLAGS) +# C compiler flags +ALL_CFLAGS = $(COMMON_FLAGS) $(REQUIRED_GCC_FLAGS) $(UNICODE_OPT) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CFLAGS) +# Linker flags +ALL_LDFLAGS = $(COMMON_FLAGS) $(WINDOWSLDFLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS) +# under Cygwin, Dlls must not be linked with subsystem=windows +ALL_LDFLAGS_DLL = $(COMMON_FLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS) + +.SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .cxx .cc .c +.c.o: + $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c + +.cc.o: + $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.cc +.cxx.o: + $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.cxx +# This '.cpp.o' rule is apparently written this way because +# the 'tmake' file g95.t expects it. +.$(SRCSUFF).$(OBJSUFF): + $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.$(SRCSUFF)