From 78e376b56fe2716067010e355cbc5b49cab82002 Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Fri, 27 Dec 2002 21:58:36 +0000 Subject: [PATCH] Applied patch [ 652491 ] Update makefiles for mingw from Greg Chicares, with some small modifications. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18435 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/tmake/g95.t | 32 +++-- samples/makefile.g95 | 4 +- src/makeg95.env | 251 ++++++++++++++++++++++++++-------------- src/makeprog.g95 | 7 +- src/msw/makefile.g95 | 32 +++-- 5 files changed, 198 insertions(+), 128 deletions(-) diff --git a/distrib/msw/tmake/g95.t b/distrib/msw/tmake/g95.t index f1c494ef52..c4fc4bda3a 100644 --- a/distrib/msw/tmake/g95.t +++ b/distrib/msw/tmake/g95.t @@ -110,7 +110,7 @@ DLL_BASE_LDLIBS = $(DLL_EXTRA_LIBS) -lstdc++ -lwsock32 ifeq ($(wxUSE_GUI),0) DLL_LDLIBS = $(DLL_BASE_LDLIBS) else - DLL_LDLIBS = -mwindows -lcomctl32 -lctl3d32 -lole32 -loleaut32 \ + DLL_LDLIBS = -lcomctl32 -lctl3d32 -lole32 -loleaut32 \ -luuid -lrpcrt4 -lodbc32 -lwinmm -lopengl32 \ $(DLL_BASE_LDLIBS) endif @@ -141,15 +141,12 @@ DOCDIR = $(WXDIR)/docs # Only use the WIN32 wxDirDialog if we have a recent # version of Mingw32 -ifeq ($(MINGW32),1) - ifneq "$(_GCC295)$(_GCC3)" "" +ifeq "$(strip $(RECENT_MINGW))" "yes" DIRDLGOBJ = $(MSWDIR)/dirdlg.$(OBJSUFF) - else - DIRDLGOBJ = $(GENDIR)/dirdlgg.$(OBJSUFF) - endif else DIRDLGOBJ = $(GENDIR)/dirdlgg.$(OBJSUFF) endif + ifeq ($(wxUSE_GUI),0) DIRDLGOBJ = endif @@ -305,12 +302,8 @@ TIFFOBJS = $(TIFFDIR)/tif_aux.o \ $(TIFFDIR)/tif_write.o \ $(TIFFDIR)/tif_zip.o -ifeq ($(MINGW32),1) - ifneq "$(_GCC295)$(_GCC3)" "" - OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(DIRDLGOBJ) $(ADVANCEDOBJS) - else - OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(DIRDLGOBJ) - endif +ifeq "$(strip $(RECENT_MINGW))" "yes" + OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(DIRDLGOBJ) $(ADVANCEDOBJS) else OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(DIRDLGOBJ) endif @@ -345,7 +338,7 @@ $(ARCHINCDIR)/wx: # Copy ALWAYS uses forward slashes now. -$(SETUP_H): $(ARCHINCDIR)/wx +$(SETUP_H): $(ARCHINCDIR)/wx $(WXDIR)/include/wx/msw/setup.h $(COPY) $(WXDIR)/include/wx/msw/setup.h $(subst $(BACKSLASH),/,$@) # $(COPY) $(WXDIR)/include/wx/msw/setup.h $@ @@ -364,11 +357,12 @@ else ifeq "$(strip $(LD_SUPPORTS_SHARED))" "yes" $(WXDLL): $(OBJECTS) $(EXTRAOBJS) - $(CC) -shared -o $@ \ + $(CXX) -shared -o $@ \ -Wl,--output-def,$(WXDEF) \ -Wl,--out-implib,$(WXLIB) \ $(OBJECTS) $(EXTRAOBJS) \ - $(DLL_LDFLAGS) $(DLL_LDLIBS) + $(DLL_LDFLAGS) $(DLL_LDLIBS) \ + $(ALL_LDFLAGS_DLL) else ifeq ($(MINGW32),1) @@ -389,11 +383,11 @@ $(WXDEF) $(WXLIB): $(OBJECTS) $(EXTRAOBJS) $(OBJECTS) $(EXTRAOBJS) $(DLL_EXTRA_LIBS) $(WXDLL): $(OBJECTS) $(EXTRAOBJS) $(WXDEF) - $(CC) -mdll -Wl,--base-file,wx.base -s -o $@ $(LD_STUFF) + $(CC) -mdll -Wl,--base-file,wx.base -s -o $@ $(LD_STUFF) $(ALL_LDFLAGS_DLL) $(DLLTOOL) $(DLL_STUFF) - $(CC) -mdll -Wl,--base-file,wx.base wx.exp -s -o $@ $(LD_STUFF) + $(CC) -mdll -Wl,--base-file,wx.base wx.exp -s -o $@ $(LD_STUFF) $(ALL_LDFLAGS_DLL) $(DLLTOOL) $(DLL_STUFF) - $(CC) -mdll wx.exp -o $@ $(LD_STUFF) + $(CC) -mdll wx.exp -o $@ $(LD_STUFF) $(ALL_LDFLAGS_DLL) -$(RM) wx.base -$(RM) wx.exp @@ -424,7 +418,7 @@ $(REGEXLIB): $(OBJECTS): $(WXINC)/wx/defs.h $(WXINC)/wx/object.h $(ARCHINCDIR)/wx/setup.h $(COMMDIR)/y_tab.$(OBJSUFF): $(COMMDIR)/y_tab.c $(COMMDIR)/lex_yy.c - $(CCLEX) -c $(CPPFLAGS) -DUSE_DEFINE -DYY_USE_PROTOS -o $@ $(COMMDIR)/y_tab.c + $(CCLEX) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -DUSE_DEFINE -DYY_USE_PROTOS -o $@ $(COMMDIR)/y_tab.c $(COMMDIR)/y_tab.c: $(COMMDIR)/dosyacc.c $(COPY) ../common/dosyacc.c ../common/y_tab.c diff --git a/samples/makefile.g95 b/samples/makefile.g95 index 8bd8c65b77..8258547895 100644 --- a/samples/makefile.g95 +++ b/samples/makefile.g95 @@ -15,9 +15,7 @@ WXDIR = .. THISDIR=$(WXDIR)/samples -MAKEFILE=makefile.g95 -MAKEFLAGS=WXUSINGDLL=$(WXUSINGDLL) UNICODE=$(UNICODE) -CMDLINE=-f $(MAKEFILE) $(MAKEFLAGS) +CMDLINE=-fmakefile.g95 WXUSINGDLL='$(WXUSINGDLL)' UNICODE='$(UNICODE)' # Mingw make may not have a shell to use, so can't use a loop here. Sigh. # Please add new sample directories alphabetically to make it easier to diff --git a/src/makeg95.env b/src/makeg95.env index 9ce31061f7..e65e4b23dc 100644 --- a/src/makeg95.env +++ b/src/makeg95.env @@ -10,18 +10,53 @@ # 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 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 we're using MSYS, or other utilities that -# use forward slashes, we need to set this when -# invoking the makefile from DOS, or the wrong separators -# will be assumed. +# 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. #OSTYPE=msys # If building DLL, the version @@ -39,12 +74,6 @@ ifndef wxUSE_GUI wxUSE_GUI=1 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 - # 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 @@ -55,65 +84,102 @@ COPY=cp ########################## Compiler ################################## -# C++ compiler -# Put a comment before --pipe for Cygwin, remove comment for Mingw32 2.95 +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 -# _GCC295 means GCC is GCC 2.95 -# _GCC3 mans GCC is 3.x or better (can actually just be 3.1 or better -# for Cygwin/MinGW) -ifneq (,$(findstring 2.95, $(MINGW32VERSION))) - _GCC295=1 +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 -ifneq (,$(findstring 3., $(MINGW32VERSION))) - _GCC3=1 +# 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 -ifeq ($(MINGW32),1) - ifneq "$(_GCC295)$(_GCC3)" "" - ifeq ($(_GCC3),1) - CC = gcc --pipe - else - CC = gcc --pipe -fvtable-thunks - endif - else - CC = gcc - endif -else - CC = gcc +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 -# C compiler for pure C programs -CCC = $(CC) +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. + _USE_W32API_HEADER_IF_SUPPORTED = -DHAVE_W32API_H +# +# 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 + +# C compiler +CXX = g++ + +# C compiler +CC = gcc # Compiler used for LEX generated C -CCLEX=gcc +# For now at least, it can be the same as the regular C compiler +CCLEX = $(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=windres +RESCOMP=windres $(_USE_TEMP_FILE_IF_SUPPORTED) 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. @@ -123,9 +189,7 @@ DLLTOOL = dlltool ########################## Compiler flags ############################# # 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 COMMON_THREADFLAGS = @@ -142,14 +206,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__WIN95__ -D__GNUWIN32__ endif -CPU=i386 +# This is never used and should be expunged. +# CPU=i386 # Suffixes OBJSUFF=o @@ -172,22 +237,15 @@ else GUI = -D__WXMSW__ -D__WINDOWS__ -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. ifeq ($(FINAL),1) - OPT = -fno-pcc-struct-return -O2 -fno-rtti -fno-exceptions + OPT = -O2 -fno-rtti -fno-exceptions else - OPT = -fno-pcc-struct-return -fno-rtti -fno-exceptions + OPT = -fno-rtti -fno-exceptions endif # Options for ar archiver -# AROPTIONS = crs # For IRIX and Solaris (both SYSVR4). -AR = ar AROPTIONS = ruv +AR = ar RANLIB = ranlib # Extra compiler libraries @@ -218,21 +276,13 @@ WXSRC=$(WXDIR)/src/msw WXINC=$(WXDIR)/include WXBASESRC=$(WXDIR)/src/common -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/$(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) -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. @@ -241,7 +291,7 @@ else LIBS = $(EXTRALIBS) $(WXLIB) -lregex -lpng -ljpeg -lzlib -ltiff $(WINLIBS) $(COMPLIBS) endif -WINFLAGS=-D_X86_=1 -DWIN32 -D_WIN32 $(WINVERSION) +WINFLAGS = $(OBSOLETE_DEFINES) $(WINVERSION) #for windows 95 XINCLUDE=$(WINFLAGS) @@ -283,27 +333,60 @@ ifdef WXUSINGDLL endif -# You shouldn't need to change these... -CPPFLAGS = $(XINCLUDE) $(INC) $(COMMON_THREADFLAGS) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRACPPFLAGS) $(EXTRADLLFLAGS) -CFLAGS = $(XINCLUDE) $(INC) $(COMMON_THREADFLAGS) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRACFLAGS) $(EXTRADLLFLAGS) -DWIN32_LEAN_AND_MEAN ifeq ($(wxUSE_GUI),1) - WINDOWSLDFLAGS=-Wl,--subsystem,windows -mwindows + WINDOWSLDFLAGS=-Wl,--subsystem,windows + WINDOWSLDLIBS=-mwindows endif -LDFLAGS = $(WINDOWSLDFLAGS) $(COMMON_THREADFLAGS) -L$(WXDIR)/lib -L$(WXDIR)/contrib/lib $(EXTRALDFLAGS) +# 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_THREADFLAGS) $(REQUIRED_GCC_FLAGS) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CXXFLAGS) +# C compiler flags +ALL_CFLAGS = $(COMMON_THREADFLAGS) $(REQUIRED_GCC_FLAGS) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) $(EXTRADLLFLAGS) $(CFLAGS) +# Linker flags +ALL_LDFLAGS = $(COMMON_THREADFLAGS) $(WINDOWSLDFLAGS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS) +# under Cygwin, Dlls must not be linked with subsystem=windows +ALL_LDFLAGS_DLL = $(COMMON_THREADFLAGS) $(WINDOWSLDLIBS) $(WXLIBDIRS) $(EXTRALDFLAGS) $(LDFLAGS) + .SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .cxx .cc .c .c.o: - $(CC) -c $(CFLAGS) -o $@ $*.c + $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c .cc.o: - $(CC) -c $(CPPFLAGS) -o $@ $*.cc + $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.cc .cxx.o: - $(CC) -c $(CPPFLAGS) -o $@ $*.cxx + $(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): - $(CC) -c $(CPPFLAGS) -o $@ $*.$(SRCSUFF) - - - + $(CXX) -c $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -o $@ $*.$(SRCSUFF) diff --git a/src/makeprog.g95 b/src/makeprog.g95 index 98287d1450..adc0ab2928 100644 --- a/src/makeprog.g95 +++ b/src/makeprog.g95 @@ -14,7 +14,7 @@ include $(WXDIR)/src/makeg95.env all: $(TARGET)$(GUISUFFIX)$(EXESUFF) $(TARGET)_resources.$(OBJSUFF) $(EXTRATARGETS) $(TARGET)$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(TARGET)_resources.$(OBJSUFF) $(WXLIB) - $(CC) $(LDFLAGS) -o $(TARGET)$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(TARGET)_resources.$(OBJSUFF) $(LDLIBS) + $(CXX) $(ALL_LDFLAGS) -o $(TARGET)$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(TARGET)_resources.$(OBJSUFF) $(LDLIBS) $(TARGET)_resources.o: $(TARGET).rc $(RESCOMP) $(RCINPUTSWITCH) $(TARGET).rc $(RCOUTPUTSWITCH) $(TARGET)_resources.o $(RESFLAGS) @@ -22,10 +22,11 @@ $(TARGET)_resources.o: $(TARGET).rc clean: -$(RM) *.o -$(RM) $(TARGET)_resources.o - -$(RM) core + -$(RM) core -$(RM) *.rsc -$(RM) *.res -$(RM) *.exe cleanall: clean - -$(RM) $(TARGET).exe + -$(RM) $(TARGET).exe + diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95 index 381a3c760f..d269f6c5a2 100644 --- a/src/msw/makefile.g95 +++ b/src/msw/makefile.g95 @@ -31,7 +31,7 @@ DLL_BASE_LDLIBS = $(DLL_EXTRA_LIBS) -lstdc++ -lwsock32 ifeq ($(wxUSE_GUI),0) DLL_LDLIBS = $(DLL_BASE_LDLIBS) else - DLL_LDLIBS = -mwindows -lcomctl32 -lctl3d32 -lole32 -loleaut32 \ + DLL_LDLIBS = -lcomctl32 -lctl3d32 -lole32 -loleaut32 \ -luuid -lrpcrt4 -lodbc32 -lwinmm -lopengl32 \ $(DLL_BASE_LDLIBS) endif @@ -62,15 +62,12 @@ DOCDIR = $(WXDIR)/docs # Only use the WIN32 wxDirDialog if we have a recent # version of Mingw32 -ifeq ($(MINGW32),1) - ifneq "$(_GCC295)$(_GCC3)" "" +ifeq "$(strip $(RECENT_MINGW))" "yes" DIRDLGOBJ = $(MSWDIR)/dirdlg.$(OBJSUFF) - else - DIRDLGOBJ = $(GENDIR)/dirdlgg.$(OBJSUFF) - endif else DIRDLGOBJ = $(GENDIR)/dirdlgg.$(OBJSUFF) endif + ifeq ($(wxUSE_GUI),0) DIRDLGOBJ = endif @@ -507,12 +504,8 @@ TIFFOBJS = $(TIFFDIR)/tif_aux.o \ $(TIFFDIR)/tif_write.o \ $(TIFFDIR)/tif_zip.o -ifeq ($(MINGW32),1) - ifneq "$(_GCC295)$(_GCC3)" "" - OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(DIRDLGOBJ) $(ADVANCEDOBJS) - else - OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(DIRDLGOBJ) - endif +ifeq "$(strip $(RECENT_MINGW))" "yes" + OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(DIRDLGOBJ) $(ADVANCEDOBJS) else OBJECTS = $(MSWOBJS) $(COMMONOBJS) $(GENERICOBJS) $(HTMLOBJS) $(DIRDLGOBJ) endif @@ -547,7 +540,7 @@ $(ARCHINCDIR)/wx: # Copy ALWAYS uses forward slashes now. -$(SETUP_H): $(ARCHINCDIR)/wx +$(SETUP_H): $(ARCHINCDIR)/wx $(WXDIR)/include/wx/msw/setup.h $(COPY) $(WXDIR)/include/wx/msw/setup.h $(subst $(BACKSLASH),/,$@) # $(COPY) $(WXDIR)/include/wx/msw/setup.h $@ @@ -566,11 +559,12 @@ else ifeq "$(strip $(LD_SUPPORTS_SHARED))" "yes" $(WXDLL): $(OBJECTS) $(EXTRAOBJS) - $(CC) -shared -o $@ \ + $(CXX) -shared -o $@ \ -Wl,--output-def,$(WXDEF) \ -Wl,--out-implib,$(WXLIB) \ $(OBJECTS) $(EXTRAOBJS) \ - $(DLL_LDFLAGS) $(DLL_LDLIBS) + $(DLL_LDFLAGS) $(DLL_LDLIBS) \ + $(ALL_LDFLAGS_DLL) else ifeq ($(MINGW32),1) @@ -591,11 +585,11 @@ $(WXDEF) $(WXLIB): $(OBJECTS) $(EXTRAOBJS) $(OBJECTS) $(EXTRAOBJS) $(DLL_EXTRA_LIBS) $(WXDLL): $(OBJECTS) $(EXTRAOBJS) $(WXDEF) - $(CC) -mdll -Wl,--base-file,wx.base -s -o $@ $(LD_STUFF) + $(CC) -mdll -Wl,--base-file,wx.base -s -o $@ $(LD_STUFF) $(ALL_LDFLAGS_DLL) $(DLLTOOL) $(DLL_STUFF) - $(CC) -mdll -Wl,--base-file,wx.base wx.exp -s -o $@ $(LD_STUFF) + $(CC) -mdll -Wl,--base-file,wx.base wx.exp -s -o $@ $(LD_STUFF) $(ALL_LDFLAGS_DLL) $(DLLTOOL) $(DLL_STUFF) - $(CC) -mdll wx.exp -o $@ $(LD_STUFF) + $(CC) -mdll wx.exp -o $@ $(LD_STUFF) $(ALL_LDFLAGS_DLL) -$(RM) wx.base -$(RM) wx.exp @@ -626,7 +620,7 @@ $(REGEXLIB): $(OBJECTS): $(WXINC)/wx/defs.h $(WXINC)/wx/object.h $(ARCHINCDIR)/wx/setup.h $(COMMDIR)/y_tab.$(OBJSUFF): $(COMMDIR)/y_tab.c $(COMMDIR)/lex_yy.c - $(CCLEX) -c $(CPPFLAGS) -DUSE_DEFINE -DYY_USE_PROTOS -o $@ $(COMMDIR)/y_tab.c + $(CCLEX) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -DUSE_DEFINE -DYY_USE_PROTOS -o $@ $(COMMDIR)/y_tab.c $(COMMDIR)/y_tab.c: $(COMMDIR)/dosyacc.c $(COPY) ../common/dosyacc.c ../common/y_tab.c -- 2.45.2