X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/341287bf49066e5dd84e971bd508ee3919ff4b46..971e47976f53665f5280d5538395cf7ac189a40e:/src/makeg95.env diff --git a/src/makeg95.env b/src/makeg95.env index 9f63cdba4c..f235603377 100644 --- a/src/makeg95.env +++ b/src/makeg95.env @@ -1,71 +1,248 @@ +# # makeg95.env # Common makefile settings for wxWindows programs -# This file is included by all the other makefiles, thus changes +# This file is included by all the other makefiles, thus changes # made here take effect everywhere (except where overriden). +# The settings are for GnuWin32-derived compilers, i.e. Cygwin and Mingw32. +# +# Customize this file to match your own settings. +# +# CVS_ID: $Id$ +# + +# 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. # -# An alternative to editing this file is to create a shell script -# to export specific variables, and call make with the -e switch -# to override makefile variables. See wx/install/install.txt. -# And you can override specific variables on the make command line, e.g. +# 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 . # -# make -f makefile.unix WXDEBUG='' +# With cygwin, there are still some problems compiling wxWindows +# this way; './configure && make' may work better. # -# You may prefer to use the GNU configure script than raw makefiles - -# see contrib/wxshlib. +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, +# 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 +include $(WXDIR)/src/version.mak +WXVERSION=$(wxMAJOR_VERSION)$(wxMINOR_VERSION)$(wxRELEASE_NUMBER_IFUNSTABLE) + +ifndef UNICODE + UNICODE=0 +endif + +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. +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 ################################## -# C++ compiler -# For AIX/CSet++: use CC = xlC -# For IRIX: use CC = CC -# CC = gcc-2.6.2 -CC = 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 +endif -# C compiler for pure C programs -# Typical: CC=g++ , CCC=gcc -# CC=cl386 /Tp, CCC=cl386 +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 # -# (Used only for XView, file sb_scrol.c) +# 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 # -CCC = $(CC) +endif -# Compiler used for LEX generated C -# AIX: use $(CCC) -CCLEX=$(CC) +# Define the C++ and C compiler respectively +ifndef WINE +CXX = $(CROSS)g++ +CC = $(CROSS)gcc +else +CXX = wineg++ +CC = winegcc +endif -MAKE=make +# Compiler used for LEX generated C +# For now at least, it can be the same as the regular C compiler +CCLEX = $(CROSS)$(CC) -# LEX -LEX=flex.exe -t -L +# This shouldn't be needed as make is supposed to define this +# variable itself. Uncomment it if your make complains. +#MAKE=make -# YACC. byacc or bison -# YACC=byacc.exe -YACC=bison.exe +# LEX (currently unused) +# LEX=flex # -t -L -# Resource compiler -RESCOMP=windres.exe +# YACC (currently unused) +# YACC=byacc +# YACC=bison -RESFLAGS=--include-dir $(WXDIR)/include --define __WIN32__ --define __WIN95__ --define __GNUWIN32__ +# Settings for Cyginw/Mingw32 +# Some versions of windres cannot cope with the --preprocessor +# option. Uncomment the RCPREPROCESSOR line below if yours can. +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 "$(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 +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 = $(CROSS)as +DLLTOOL = $(CROSS)dlltool ########################## Compiler flags ############################# -# Miscellaneous compiler options -OPTIONS= # -D__MINGW32__ # -D__EGCS__ +# Unicode defines +ifeq ($(UNICODE),1) + UNICODE_OPT = -D_UNICODE -DUNICODE -DwxUSE_UNICODE=1 +else + UNICODE_OPT = +endif -# Debugging information -# AIX: comment out. -# IRIX: -g3 -DEBUGFLAGS = -ggdb -D__WXDEBUG__ +# Miscellaneous compiler options +OPTIONS = -DSTRICT $(_USE_W32API_HEADER_IF_SUPPORTED) -# Debug/trace mode. 1 or more for memory debugging. -# Unfortunately this doesn't seem to work with GnuWin32 - get warning: -# ../../include/wx/memory.h:58: warning: declaration of `operator delete(void *)' -# throws different exceptions -# :58: warning: previous declaration here -# So setting to 0 for now. +# 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 -WXDEBUG=0 +# Debugging information +ifeq ($(FINAL),0) + DEBUGFLAGS = -g -D__WXDEBUG__ +endif WIN95=1 @@ -74,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=3.50 # 4.0 -# This means 'enable Windows 95 features' (in wxWindows and in VC++ 4.0). -WINVERSION=-DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ +APPVER=4.0 # 3.50 +# 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 @@ -95,45 +273,70 @@ 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 -# Optimization -# OPT = -O -OPT = +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). AROPTIONS = ruv -RANLIB = ranlib +AR = $(CROSS)ar +RANLIB = $(CROSS)ranlib -# Compiler libraries: defaults to GCC libraries -#COMPLIBS=-lg++ -#for win95 -#COMPLIBS=-lgcc +# Extra compiler libraries +COMPLIBS= # Compiler or system-specific include paths COMPPATHS= ########################## Directories ############################### +OLELIBS=-lole32 -loleaut32 -luuid +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 -loldnames \ - -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 +#WINLIBS=-lstdc++ -lgcc \ +# -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) -INC = -I$(WXINC) -I$(WXDIR)/src/png -I$(WXDIR)/include/wx/msw/gnuwin32 -I$(WXDIR)/src/zlib $(EXTRAINC)$(COMPPATHS) -RCLFLAGS=-cpp "cpp -lang-c++ -DWIN32 -D_WIN32 -DRCL_INVOKED -I$(WXWIN)\include" -#LIBS = -lctl3d32 $(WXLIB) $(WINLIBS) $(COMPLIBS) -LIBS = $(WXLIB) $(WINLIBS) $(COMPLIBS) +#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/$(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++ $(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$(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) @@ -141,30 +344,94 @@ XLIB=$(LIBS) LDLIBS = $(LIBS) # Directory for object files (don't change) -OBJDIR = objects$(GUISUFFIX) +# OBJDIR = objects$(GUISUFFIX) +OBJDIR = . -# You shouldn't need to change these... -CPPFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) -DWXDEBUG='$(WXDEBUG)' $(WARN) $(OPT) -CFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) -DWXDEBUG='$(WXDEBUG)' $(WARN) $(OPT) -LDFLAGS = -Wl,--subsystem,windows -mwindows -L$(WXDIR)/lib +ifeq ($(FINAL),1) + DEBEXT= +else + DEBEXT=d +endif + +ifeq ($(UNICODE),1) + UNIEXT=u +else + UNIEXT= +endif -.SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .c +ifeq ($(WXMAKINGDLL)$(WXUSINGDLL),) + INCEXT=$(UNIEXT)$(DEBEXT) +else + INCEXT=dll$(UNIEXT)$(DEBEXT) +endif -# Set these in a batch file instead e.g. install/cygnus.bat -# RCINCLUDE="$(WXDIR)/include/msw;$(WXDIR)/contrib/fafa;$(WXDIR)/contrib/itsybits"; \ -# CPLUS_INCLUDE_PATH=/usr/H-i386-cygwin32/i386-cygwin32/include:/usr/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32/cygnus-2.7.2-961023/include:$(WXDIR)/include/common:$(WXDIR)/include/msw:$(WXDIR)/contrib/fafa:$(WXDIR)/contrib/itsybits; \ -# export CPLUS_INCLUDE_PATH RCINCLUDE; \ +WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(UNIEXT)$(DEBEXT).$(LIBSUFF) -.rc.$(RESSUFF): $< $(WXDIR)/include/msw/wx.rc - $(RC) $(RESFLAGS1) $< $(RESFLAGS2) $*.$(RESSUFF) $(RCLFLAGS) +ifdef WXMAKINGDLL + EXTRADLLFLAGS = -DWXMAKINGDLL=1 -D_DLL=1 -D_WINDLL=1 + WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF) +endif -.$(RESSUFF).$(RSCSUFF): $< - $(CVTRES) $< $*.$(RSCSUFF) +ifdef WXUSINGDLL + EXTRADLLFLAGS = -DWXUSINGDLL=1 + WXLIB=$(WXDIR)/lib/$(LIBPREFIX)wx$(TOOLKIT)$(WXVERSION)$(UNIEXT)$(DEBEXT)$(MIN_SUFFIX).$(LIBSUFF) +endif -.$(SRCSUFF).$(OBJSUFF): - $(CC) -c $(CPPFLAGS) -o $@ $*.$(SRCSUFF) + +ifeq ($(wxUSE_GUI),1) + WINDOWSLDFLAGS=-Wl,--subsystem,windows + WINDOWSLDLIBS=-mwindows +endif + +# 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. + +CFLAGS = -DWIN32_LEAN_AND_MEAN + +WXLIBDIRS = -L$(WXDIR)/lib -L$(WXDIR)/contrib/lib + +# 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 $(CPPFLAGS) -o $@ $*.c + $(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)