-# File: makewat.env
+###############################################################################
+# File: src/makewat.env
# Purpose: Watcom environments for wxWindows makefiles.
# Author: Julian Smart and others
-#
-# The main things to change are:
+# Version: $Id$
+# Changelist: 2003-02-25 - Juergen Ulbts - update from wxWindows 2.5.x/HEAD branch
+###############################################################################
+
+# The following environment variables must be set:
#
# WATCOM: set to where the compiler is installed
-# WXDIR: set to where the wxWindows is installed
-# MODE: set to windows [16 bit windows], nt [win32s], or win386 [32-bit non-WIN32]
+# WXWIN: set to where the wxWindows is installed
+# PATH: set correctly, i.e. contains all Watcom directories
+# LIB: same as PATH
+# INCLUDE: same as PATH
+
+# set wxUSE_GUI=0 to build wxBase instead of (default) wxMSW
+!ifndef wxUSE_GUI
+wxUSE_GUI=1
+!endif
+# set FINAL=1 to disable debug and enable optimizations
+!ifndef FINAL
FINAL=0
-WATCOMDIR=$(%WATCOM)
-#.EXTENSIONS: .exe .obj .c .cc .cpp .res .rc .def
-
-# Set this to win386 if compiling under WIN386 mode, or
-# to windows for normal 16-bit Windows, nt if compiling for WIN32s/NT
-MODE= nt # windows
-
-WXDIR = c:\wx
-WXINC = $(WXDIR)\include\msw
-WXBASEINC = $(WXDIR)\include\base
+!endif
-# Suffixes
-OBJSUFF=obj
-SRCSUFF=cpp
+# set WATCOM_SUFFIX to nothing if you use only Watcom compiler, set it to
+# something Watcom-specific if you want to build wxWindows with more than one
+# compiler
+WATCOM_SUFFIX=_w
-WXDEBUG=0
+# change/remove this if you want to create programs for older Windows versions,
+# increase the version to be able to use more Win2K+-only features
+WINVERFLAGS = /dWINVER=0x400 /d_WIN32_IE=0x0300
-!ifneq NOPRECOMP 1
-PRECOMP = /fh=$(WXDIR)\src\msw\watcom.pch
+# optimize for space/time: /os or /ot
+!ifeq FINAL 1
+OPTFLAGS=/oails /5r
+!else
+OPTFLAGS=/od
!endif
-RC = wrc
-
-!ifeq MODE win386
-##### WIN386 OPTIONS
+###############################################################################
+# You shouldn't have to modify anything after this point
+###############################################################################
-# Set LEVEL to 386 if using 32-bit compilation
-LEVEL = 386
-CCC = wpp$(LEVEL)
-CC = wcc$(LEVEL)
-OS_TARGET = win386
-MODEL =
-LINKOPTION = win386
-BINDCOMMAND = wbind
-WATLIBDIR = $(WATCOMDIR)\lib386\win
-MINDATA = option mindata=100K
-MAXDATA = option maxdata=100K
-STACK = option stack=64k
-EXTRALIBS = $(WXDIR)\contrib\ctl3d\ctl3d32.obj
-IFLAGS = -i=$(WXINC) -i=$(WXBASEINC) -i=$(WXDIR)\contrib\fafa -i=$(%watcom)\h;$(%watcom)\h\win
-RESFLAGS1 = -r -bt=windows /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa
-RESFLAGS2 = -R $(name) /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa
-DEBUGINFO = debug all
+.EXTENSIONS:
+.EXTENSIONS: .exe .obj .c .cc .cpp .res .rc .def
-#CPPFLAGS = /zw /w1 /zq /d2 /d__WIN386__ /zt4 $(MODEL) /d__WXMSW__
-CPPFLAGS = /zw /w1 /zq /d1 /d__WIN386__ $(MODEL) $(PRECOMP) /d__WXMSW__ $(EXTRACPPFLAGS)
+!ifndef %WATCOM
+!error WATCOM environment variable must be set!
+!endif
+WATCOMDIR=$(%WATCOM)
+!ifndef %WXWIN
+!error WXWIN environment variable must be set!
!endif
-#### END WIN386 MODE
+WXDIR = $(%WXWIN)
-!ifeq MODE windows
+# Suffixes
+OBJSUFF=obj
+SRCSUFF=cpp
-##### 16-BIT WINDOWS OPTIONS
+!ifeq FINAL 1
+WXDEBUG=0
+!else
+WXDEBUG=1
+!endif
-# Set LEVEL to 386 if using 32-bit compilation
-LEVEL =
-CCC = wpp$(LEVEL)
-CC = wcc$(LEVEL)
-OS_TARGET = windows
-MODEL =/ml
-LINKOPTION = windows
-BINDCOMMAND = echo
-WATLIBDIR = $(WATCOMDIR)\lib286\win
-MINDATA =
-MAXDATA =
-STACK =
-EXTRALIBS=$(WATLIBDIR)\shell.lib $(WATLIBDIR)\ddeml.lib $(WATLIBDIR)\ctl3d.lib $(WATLIBDIR)\commdlg.lib $(WATLIBDIR)\mmsystem.lib
-IFLAGS = -i=$(WXINC) -i=$(WXBASEINC) -i=$(WXDIR)\contrib\fafa
-RESFLAGS1 = -r -bt=windows -i=$(WXINC) -i=$(WXDIR)\contrib\fafa
-RESFLAGS2 = -R
+!ifeq WXDEBUG 1
+DEBUGFLAGS = /D__WXDEBUG__
+DEBUGCFLAGS = $(DEBUGFLAGS) /d2
+DEBUGCXXFLAGS = $(DEBUGFLAGS) /d2i
DEBUGINFO = debug all
+DEBUGSUFFIX = d
+!else
+DEBUGCFLAGS =
+DEBUGCXXFLAGS =
+DEBUGINFO =
+DEBUGSUFFIX =
+!endif
-#-i=$(WXDIR)\contrib\itsybits
+# TOOLKIT is used as the name of lib subdir containing wx/setup.h
+# BASEDIRPREFIX is used to construct OUTPUTDIR
+!ifeq wxUSE_GUI 0
+TOOLKIT = base
+BASEDIRPREFIX = Base
+LINKSYSTEM = nt
+!else
+TOOLKIT = msw
+LINKSYSTEM = nt_win
+BASEDIRPREFIX =
+!endif
-# Note: I've added the data threshold (/zt4) for 16-bit operation,
-# or we get link failure (TEXT segment overflow). Is this OK for
-# 32-bit mode also? -- JACS
-# An alternative might be /zc (put string literals in code segment).
-#CPPFLAGS = /zw /w1 /zq /d1 /zt4 $(MODEL) /d__WXMSW__
-CPPFLAGS = /zw /w2 /zq /d1 $(MODEL) $(PRECOMP) /d__WXMSW__ $(EXTRACPPFLAGS)
+ARCHINCDIR=$(WXDIR)\lib\$(TOOLKIT)$(DEBUGSUFFIX)
+# set the things which depend on debug/release
+#
+# note that the values for LIBPAGESIZE are minimal possible, the library
+# doesn't link (Error! Library too large) with values smaller than given
+!ifeq FINAL 1
+CONFIGURATION=Release
+LIBPAGESIZE=/p=1024
+!else
+CONFIGURATION=Debug
+LIBPAGESIZE=/p=2048
!endif
-#### END WINDOWS MODE
-!ifeq MODE nt
+# set OUTPUTDIR to the directory to be used for the .obj files created during
+# the build (under $WXWIN)
+!ifndef OUTPUTDIR
+OUTPUTDIR=$(WXDIR)\$(BASEDIRPREFIX)$(CONFIGURATION)Watcom
+# no trailing slash for win98
+!endif
-##### NT OPTIONS
+!ifneq NOPRECOMP 1
+PRECOMP = /fh=$(OUTPUTDIR)\watcom.pch
+!endif
+# the basename of the library
+LIBNAME=wx$(TOOLKIT)$(DEBUGSUFFIX)$(WATCOM_SUFFIX)
+
+# only LEVEL=386 is currently supported, 16 bit compilation is probably broken
LEVEL = 386
-CCC = wpp$(LEVEL)
-CC = wcc$(LEVEL)
-OS_TARGET = nt_win
-MODEL =
-# If you use win95, assumptions will be made about Win95 icon format etc.
-# so nt_win is probably better for simultaneous Win32s/Win95/NT operation.
-LINKOPTION = nt_win # win95
+CXX = wpp$(LEVEL)
+CC = wcc$(LEVEL)
+LIB = wlib /q
+RC = wrc
BINDCOMMAND = wrc
WATLIBDIR = $(WATCOMDIR)\lib386\nt
-MINDATA =
-MAXDATA =
STACK = option stack=64k
-EXTRALIBS = $(WATLIBDIR)\ctl3d32.lib $(WATLIBDIR)\odbc32.lib
-IFLAGS = -i=$(WXINC) -i=$(WXBASEINC) -i=$(WXDIR)\contrib\fafa -i=$(%watcom)\h;$(%watcom)\h\nt
-RESFLAGS1 = -r -bt=nt /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa
-RESFLAGS2 = -R $(name) /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa
-DEBUGINFO = debug all # Linking: comment out if operating in a non-debuggable environment
-
-#-i=$(WXDIR)\contrib\itsybits
-
-# Here are some possible optimization flags:
-# /5r Pentium timings
-# /fp5 /fpi87 Inline 80x87 instructions optimized for Pentium: coprocessor must be present
-# /ox Standard optimizations
-# /or Reordering for Pentium timings (included in /ox)
-# The Watcom-recommended flags for optimum Pentium speed are:
-# /oneatx /zp4 /5 /fpi87 /fp5
-
-OPTFLAGS=/ox /5r # /DWXDEBUG=1
-
-# /d1 for line numbers only: anything else produces an enormous wx32.lib
-CPPFLAGS = /bt=nt /w1 /D__WIN32__ /zq $(OPTFLAGS) $(MODEL) $(PRECOMP) /d1 /d__WXMSW__ $(EXTRACPPFLAGS)
-
+LIBS = $(WXDIR)\lib\$(LIBNAME).lib &
+ $(WXDIR)\lib\regex$(WATCOM_SUFFIX).lib &
+ $(WXDIR)\lib\zlib$(WATCOM_SUFFIX).lib &
+!ifneq wxUSE_GUI 0
+ $(WXDIR)\lib\png$(WATCOM_SUFFIX).lib &
+ $(WXDIR)\lib\tiff$(WATCOM_SUFFIX).lib &
+ $(WXDIR)\lib\jpeg$(WATCOM_SUFFIX).lib &
+!endif
+ $(WATLIBDIR)\comctl32.lib &
+ $(WATLIBDIR)\comdlg32.lib &
+ $(WATLIBDIR)\wsock32.lib &
+ $(WATLIBDIR)\odbc32.lib &
+ $(WATLIBDIR)\ole32.lib &
+ $(WATLIBDIR)\oleaut32.lib &
+ $(WATLIBDIR)\opengl32.lib &
+ $(WATLIBDIR)\uuid.lib
+IFLAGS = -i=$(ARCHINCDIR);$(WXDIR)\include &
+ -i=$(%watcom)\h;$(%watcom)\h\nt &
+ -i=$(WXDIR)\src\regex;$(WXDIR)\src\png;$(WXDIR)\src\zlib;$(WXDIR)\src\jpeg;$(WXDIR)\src\tiff &
+ -i=$(WXDIR)\include\wx\msw\gnuwin32
+RESFLAGS = -q -r -bt=nt /i$(WXDIR)\include /i$(WXDIR)\contrib\include $(WINVERFLAGS)
+
+# NB: /bm switch is needed for thread-safe runtime, if you don't use
+# wxThread you may remove it
+CPPFLAGS = /dWIN32 /bm /fo=$(OUTPUTDIR)\ /fr /zq $(IFLAGS) $(OPTFLAGS) $(WINVERFLAGS) $(EXTRACPPFLAGS)
+!ifeq wxUSE_GUI 0
+CPPFLAGS += /dwxUSE_GUI=0
!endif
-#### END NT MODE
-.cpp.obj: # $< # .AUTODEPEND
- *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
+# zm and zv as well as the liker options below are used to make the resulting
+# .exe smaller
+CFLAGS = $(CPPFLAGS) $(DEBUGCFLAGS) $(EXTRACFLAGS) /zm
+CXXFLAGS = $(CPPFLAGS) $(DEBUGCXXFLAGS) $(PRECOMP) /zm /zv /w=8 $(EXTRACXXFLAGS)
+LDFLAGS = option eliminate, vfremoval
-# %create tmp.lbc
-# @%append tmp.lbc $(CPPFLAGS) $(IFLAGS) $<
-# echo $<
-# $(CCC) @tmp.lbc
+.cpp.obj: # $< # .AUTODEPEND
+ *$(CXX) $(CXXFLAGS) $<
.c.obj: # $< # .AUTODEPEND
- *$(CC) $(CPPFLAGS) $(IFLAGS) $<
+ *$(CC) $(CFLAGS) $<
-# This doesn't work for wcc
-# %create tmp.lbc
-# @%append tmp.lbc $(CPPFLAGS) $(IFLAGS) $<
-# echo $<
-# $(CC) @tmp.lbc
-
-dummy: .SYMBOLIC
- @echo Please give a target for wxWin makefiles: the usual one is 'all'.
+defaulttarget: all .SYMBOLIC
erasepch: .SYMBOLIC
- -erase $(WXDIR)\src\msw\watcom.pch
+ -erase $(OUTPUTDIR)\watcom.pch
+