-#LIBS = -lctl3d32 $(WXLIB) $(WINLIBS) $(COMPLIBS)
-LIBS = $(WXLIB) $(WINLIBS) $(COMPLIBS) $(EXTRALIBS)
+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)/src/png -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/xpm -I$(WXDIR)/src/tiff $(EXTRAINC) $(COMPPATHS)
+else
+INC = -I$(WXINC) -I$(WXDIR)/src/png -I$(WXDIR)/src/jpeg -I$(WXDIR)/src/zlib -I$(WXDIR)/src/xpm -I$(WXDIR)/src/tiff $(EXTRAINC) $(COMPPATHS) -I$(WXDIR)/include/wx/msw/gnuwin32
+endif
+
+RCLFLAGS=-cpp "cpp -lang-c++ -DWIN32 -D_WIN32 -DRCL_INVOKED -I$(WXWIN)/include"
+
+ifdef WXUSINGDLL
+ # png, jpeg, etc are exported from wx dll, so skip and save on link time.
+ LIBS = $(WXLIB) $(WINLIBS) $(COMPLIBS) $(EXTRALIBS)
+else
+ LIBS = $(WXLIB) -lpng -ljpeg -lzlib -lxpm -ltiff $(WINLIBS) $(COMPLIBS) $(EXTRALIBS)
+endif