1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
|
######################################################################
#
# Watcom C specific makefile, multiplatform
#
#
# The following macross must be set active when this file is called
# -D parameter, e.g. -DPROJ=fltk
# ROOT = root of project (e.g. FLTK directory)
# PROJ = project name (e.g. fltk)
#
# The following environment variable must be set. If you have multiple
# Watcom versions, use the setvars file in the Watcom directory to set it.
# WATCOM = root of Watcom C
######################################################################
#
# The following options must be set when calling this wmake file
# (case-sensitive):
# D (debug/release mode): d for debug mode,
# r for release mode
# O (target environment): d = DOS 32 bits
# o = OS/2 32 bits
# w = Windows 32 bit
# l = Linux Intel (experimental, no graphics yet (OW 1.3))
#
#
# If not set, debug mode and target=host (that is, no cross-compiling).
# Example: wmake -h -f makefile.wat d=r o=w
#
# Following macros can be used to add/override existing macros in
# this file.
# EXTRA_INCLUDE_DIRS # Non-Watcom (project) include dirs
# ODIR # Output directory if not default
# ROOT # Project root. If not given, .
# PROJ # Project name.
# LIBS # Extra libs to link in
# LIBDIR # Project library directory. Default: PROJ\LIB
# LIBNAMEROOT # Project rootname of output library. Default: PROJ\Lib\Proj
# EXTRA_LIBS # Target specific include libs
!ifndef D
MODE=d # default is debug mode
!else
! ifeq D d
MODE=d
! else ifeq D r
MODE=r
! else
CONFIG_ERROR_MSG=Unrecognized mode: $(D)
! endif
!endif
# If target is specified, check its validity; if not specified, the target is
# the host platform itself.
!ifdef O
! ifeq O d
TARGET=dos
! else ifeq O o
TARGET=os2
! else ifeq O w
TARGET=nt
! else ifeq O l
TARGET=linux
! else
CONFIG_ERROR_MSG=Unrecognized target: $(O)
! endif
!else
! ifdef __DOS__
TARGET=dos
! else ifdef __OS2__
TARGET=os2
! else ifdef __NT__
TARGET=nt
! else ifdef __LINUX__
TARGET=linux
! endif
!endif
#
# Now we know the target. Determine the link target. For fltk, this
# is always GUI for Windows and OS/2. For possible link targets (aliases
# for a set of linker directives) see wlsystem.lnk in Watcom's BINW directory.
#
!ifeq TARGET dos
LINKTARGET=dos32a
!else ifeq TARGET os2
LINKTARGET=os2v2_pm
!else ifeq TARGET nt
LINKTARGET=nt_win
!else
LINKTARGET=linux
!endif
#
# Very important: specify the sequence of extensions. Wmake will try to make a target
# with an extension from the first file of the same name with an extension to the right.
# E.g. it tries to make hello.obj from hello.cxx, or hello.cpp etc, but never from hello.exe
#
.EXTENSIONS :
.EXTENSIONS : .exe .lib .obj .cxx .cpp .c .h .fl
#
# Create output directory name if not already supplied. To allow
# cross-development, must include target name.
#
!ifndef ODIR
ODIR=$(D)_$(TARGET)
!endif
#
# Contruct the libname from the root plus D and O macros, so that
# multiple LIBS can co-exists, e.g. FLTK_DW and FLTK_RW for Win32.
#
!ifndef LIBDIR
LIBDIR=$(ROOT)\lib\
!endif
!ifndef LIBNAMEROOT
LIBNAMEROOT=$(PROJ)
!endif
!ifndef LIBNAME
LIBNAME = $(LIBDIR)$(LIBNAMEROOT)_$(D)$(O).lib
# FLTK has other 'global' libs. Define the names here so that any application
# using FLTK can use them by just including this mif file.
LIBNAMEFL = $(LIBDIR)$(LIBNAMEROOT)_fl_$(D)$(O).lib
LIBNAMEGL = $(LIBDIR)$(LIBNAMEROOT)_gl_$(D)$(O).lib
LIBNAMEIMG = $(LIBDIR)$(LIBNAMEROOT)_img_$(D)$(O).lib
LIBS = $(LIBNAME) $(LIBNAMEFL) $(LIBNAMEGL) $(LIBNAMEIMG)
!endif
# Set target environment options for the project
!ifeqi TARGET nt # WINDOWS 32 bit
SYSDEF= -DWIN32
ASYSDEF=
SYSLIBS=wsock32.lib mpr.lib glu32.lib opengl32.lib
EXEEXT=.exe
!else ifeqi TARGET linux # Linux Intel 32 bit generic
SYSDEF=
ASYSDEF=
EXEEXT=.exe # We need some exe extension else the build won't work
!else ifeqi TARGET os2 # OS/2 32 bit
SYSDEF=
ASYSDEF=
EXEEXT=.exe
!else ifeqi TARGET dos # DOS 32 bit
SYSDEF=
ASYSDEF=
EXEEXT=.exe
!endif
######################################################################
#
# End of compiler- and environment specific options
#
# Note !message will print before any actions ('PRE'processor!), and thus
# will not reflect results of any rules (like set xxx=yyy).
# echo is a rule itself, and will reflect results of preceding rules.
#
######################################################################
.BEFORE :
!ifdef CONFIG_ERROR_MSG
! message
! message Configuration error:
! message $(CONFIG_ERROR_MSG)
! message
%abort
!endif
@if not exist $(ODIR) mkdir $(ODIR) >nul
!ifeqi TARGET dos
@set INCLUDE=$(%WATCOM)\H;$(EXTRA_INCLUDE_DIRS)
!else ifeqi TARGET os2
@set INCLUDE=$(%WATCOM)\H;$(%WATCOM)\H\OS2;$(EXTRA_INCLUDE_DIRS)
!else ifeqi TARGET nt
@set INCLUDE=$(%WATCOM)\H;$(%WATCOM)\H\NT;$(EXTRA_INCLUDE_DIRS)
!else ifeqi TARGET linux
@set INCLUDE=$(%WATCOM)\LH;$(EXTRA_INCLUDE_DIRS)
!endif
# @set LIB=$(LIBPATH)
# @echo Top dir: $(PROJ)
@echo Include dirs: $(%INCLUDE)
# @echo Lib dirs: $(LIBDIRS)
# @echo Libname=$(LIBNAME)
# @echo extra libs: $(LIBS)
# @echo Wmake version $(__VERSION__)
# @echo Wmake parameters: $(__MAKEOPTS__)
# @echo Compiler : $(CC) $(CCOPTS0) $(CCOPTS1) $(CCOPTS2) $(CCOPTS3)
# @echo Librarian: $(LIB)
# @echo Linker : $(LN) $(LNOPTS)
# @echo Project : $(P)
!ifeqi D d
WCADEBUG=-d1 # debug opts for wasm
WCCDEBUG=-d2 -s -ors -wcd=666 -wcd=836 # debug opts for wcc. NOTE: -we is to make errors of all warnings
WCLDEBUG=d all # debug opts for wlink
# WCCTIMING=-et # if added to CC command line will generate timing file after execution
!else
#
# WCADEBUG= # debug opts for wasm
WCCDEBUG= -ors -s -wcd=666 -wcd=836 # release opts for wcc
# WCLDEBUG= # release opts for wlink
!endif
# Conventions Watcom
# Tell default paths based on extension
.fl : .
.h : .
#.lib : .
.c : .
.cpp : .
.cxx : .
.obj : $(ODIR)
.exe : $(ODIR)
#
# Tell wmake to use DLL versions of some commands (much quicker)
#
!loaddll wcc386 wccd386
!loaddll wpp386 wppd386
!loaddll wlink wlink
!loaddll wlib wlibd
CCOPTS0=-6r -zq
CCOPTS1=$(WCCDEBUG) -bt=$(TARGET) -fp6 -fpi87 # 1st part of Watcom opts
CCOPTS2=-mf -wce=130 -wx -zq # -j # 2nd part of Watcom opts
CCOPTS3=-fo$(ODIR)\$^&.obj # 3rd part Watcom opts
COPTS=-zm
CPPOPTS=-zmf -zv -fx
LNOPTS=sys $(LINKTARGET) $(WCLDEBUG) op symf,q,m,el,vfr op st=32k # linker options
LIBOPTS= -b -q -p=512 -c # librarian options
LN=wlink # Watcom linker
AS=wasm # Watcom assembler
cc=wcc386 # Watcom C compiler
cpp=wpp386 # Watcom C++ compiler
LIB=wlib # Watcom librarian
#
# Compilation
#
.c.obj: .AUTODEPEND
$(CC) $(SYSDEF) $(DEBUGDEF) $(CCOPTS0) $(CCOPTS1) $(CCOPTS2) $(CCOPTS3) $(COPTS) $[@
.cpp.obj: .AUTODEPEND
$(CPP) $(SYSDEF) $(DEBUGDEF) $(CCOPTS0) $(CCOPTS1) $(CCOPTS2) $(CCOPTS3) $(CPPOPTS) $[@
.cxx.obj: .AUTODEPEND
$(CPP) $(SYSDEF) $(DEBUGDEF) $(CCOPTS0) $(CCOPTS1) $(CCOPTS2) $(CCOPTS3) $(CPPOPTS) $[@
#
# Librarian stage
#
.obj.lib:
$(LIB) $(LIBOPTS) $@ $<
#
# Linking stage. This implicit rule assumes the .exe is created from an object file with the
# same name, plus other object in macro OBJECTS, a number of .libs in macro LIBS etc.
# If the linking fails for some reason, the .lk1 file is not deleted and it can be
# examined.
#
.obj.exe:
@%create $^*.lk1
@%append $^*.lk1 F $(ODIR)/$^&
@for %i in ($(%OBJS)) do @%append $^*.lk1 F $(ODIR)/%i
@for %i in ($(OBJECTS)) do @%append $^*.lk1 F $(ODIR)/%i
@for %i in ($(LIBS)) do @%append $^*.lk1 L %i
@for %i in ($(EXTRA_LIBS)) do @%append $^*.lk1 L %i
@for %i in ($(SYSLIBS)) do @%append $^*.lk1 L %i
$(LN) $(LNOPTS) name $^@ op map=$^* @$^*.lk1
@del $^*.lk1
|