1
######################################################################
3
# Watcom C specific makefile, multiplatform
6
# The following macross must be set active when this file is called
7
# -D parameter, e.g. -DPROJ=fltk
8
# ROOT = root of project (e.g. FLTK directory)
9
# PROJ = project name (e.g. fltk)
11
# The following environment variable must be set. If you have multiple
12
# Watcom versions, use the setvars file in the Watcom directory to set it.
13
# WATCOM = root of Watcom C
14
######################################################################
17
# The following options must be set when calling this wmake file
19
# D (debug/release mode): d for debug mode,
21
# O (target environment): d = DOS 32 bits
24
# l = Linux Intel (experimental, no graphics yet (OW 1.3))
27
# If not set, debug mode and target=host (that is, no cross-compiling).
28
# Example: wmake -h -f makefile.wat d=r o=w
30
# Following macros can be used to add/override existing macros in
32
# EXTRA_INCLUDE_DIRS # Non-Watcom (project) include dirs
33
# ODIR # Output directory if not default
34
# ROOT # Project root. If not given, .
35
# PROJ # Project name.
36
# LIBS # Extra libs to link in
37
# LIBDIR # Project library directory. Default: PROJ\LIB
38
# LIBNAMEROOT # Project rootname of output library. Default: PROJ\Lib\Proj
39
# EXTRA_LIBS # Target specific include libs
42
MODE=d # default is debug mode
49
CONFIG_ERROR_MSG=Unrecognized mode: $(D)
53
# If target is specified, check its validity; if not specified, the target is
54
# the host platform itself.
66
CONFIG_ERROR_MSG=Unrecognized target: $(O)
75
! else ifdef __LINUX__
81
# Now we know the target. Determine the link target. For fltk, this
82
# is always GUI for Windows and OS/2. For possible link targets (aliases
83
# for a set of linker directives) see wlsystem.lnk in Watcom's BINW directory.
96
# Very important: specify the sequence of extensions. Wmake will try to make a target
97
# with an extension from the first file of the same name with an extension to the right.
98
# E.g. it tries to make hello.obj from hello.cxx, or hello.cpp etc, but never from hello.exe
101
.EXTENSIONS : .exe .lib .obj .cxx .cpp .c .h .fl
104
# Create output directory name if not already supplied. To allow
105
# cross-development, must include target name.
112
# Contruct the libname from the root plus D and O macros, so that
113
# multiple LIBS can co-exists, e.g. FLTK_DW and FLTK_RW for Win32.
122
LIBNAME = $(LIBDIR)$(LIBNAMEROOT)_$(D)$(O).lib
123
# FLTK has other 'global' libs. Define the names here so that any application
124
# using FLTK can use them by just including this mif file.
125
LIBNAMEFL = $(LIBDIR)$(LIBNAMEROOT)_fl_$(D)$(O).lib
126
LIBNAMEGL = $(LIBDIR)$(LIBNAMEROOT)_gl_$(D)$(O).lib
127
LIBNAMEIMG = $(LIBDIR)$(LIBNAMEROOT)_img_$(D)$(O).lib
128
LIBS = $(LIBNAME) $(LIBNAMEFL) $(LIBNAMEGL) $(LIBNAMEIMG)
131
# Set target environment options for the project
133
!ifeqi TARGET nt # WINDOWS 32 bit
136
SYSLIBS=wsock32.lib mpr.lib glu32.lib opengl32.lib
139
!else ifeqi TARGET linux # Linux Intel 32 bit generic
142
EXEEXT=.exe # We need some exe extension else the build won't work
144
!else ifeqi TARGET os2 # OS/2 32 bit
149
!else ifeqi TARGET dos # DOS 32 bit
157
######################################################################
159
# End of compiler- and environment specific options
161
# Note !message will print before any actions ('PRE'processor!), and thus
162
# will not reflect results of any rules (like set xxx=yyy).
163
# echo is a rule itself, and will reflect results of preceding rules.
165
######################################################################
168
!ifdef CONFIG_ERROR_MSG
170
! message Configuration error:
171
! message $(CONFIG_ERROR_MSG)
175
@if not exist $(ODIR) mkdir $(ODIR) >nul
177
@set INCLUDE=$(%WATCOM)\H;$(EXTRA_INCLUDE_DIRS)
178
!else ifeqi TARGET os2
179
@set INCLUDE=$(%WATCOM)\H;$(%WATCOM)\H\OS2;$(EXTRA_INCLUDE_DIRS)
180
!else ifeqi TARGET nt
181
@set INCLUDE=$(%WATCOM)\H;$(%WATCOM)\H\NT;$(EXTRA_INCLUDE_DIRS)
182
!else ifeqi TARGET linux
183
@set INCLUDE=$(%WATCOM)\LH;$(EXTRA_INCLUDE_DIRS)
186
# @set LIB=$(LIBPATH)
187
# @echo Top dir: $(PROJ)
188
@echo Include dirs: $(%INCLUDE)
189
# @echo Lib dirs: $(LIBDIRS)
190
# @echo Libname=$(LIBNAME)
191
# @echo extra libs: $(LIBS)
192
# @echo Wmake version $(__VERSION__)
193
# @echo Wmake parameters: $(__MAKEOPTS__)
194
# @echo Compiler : $(CC) $(CCOPTS0) $(CCOPTS1) $(CCOPTS2) $(CCOPTS3)
195
# @echo Librarian: $(LIB)
196
# @echo Linker : $(LN) $(LNOPTS)
197
# @echo Project : $(P)
200
WCADEBUG=-d1 # debug opts for wasm
201
WCCDEBUG=-d2 -s -ors # debug opts for wcc. NOTE: -we is to make errors of all warnings
202
WCLDEBUG=d all # debug opts for wlink
203
# WCCTIMING=-et # if added to CC command line will generate timing file after execution
206
# WCADEBUG= # debug opts for wasm
207
WCCDEBUG= -ors -s # release opts for wcc
208
# WCLDEBUG= # release opts for wlink
213
# Tell default paths based on extension
224
# Tell wmake to use DLL versions of some commands (much quicker)
226
!loaddll wcc386 wccd386
227
!loaddll wpp386 wppd386
232
CCOPTS1=$(WCCDEBUG) -bt=$(TARGET) -fp6 -fpi87 # 1st part of Watcom opts
233
CCOPTS2=-mf -wce=130 -wx -zq # -j # 2nd part of Watcom opts
234
CCOPTS3=-fo$(ODIR)\$^&.obj # 3rd part Watcom opts
238
LNOPTS=sys $(LINKTARGET) $(WCLDEBUG) op symf,q,m,el,vfr op st=32k # linker options
239
LIBOPTS= -b -q -p=512 -c # librarian options
240
LN=wlink # Watcom linker
241
AS=wasm # Watcom assembler
242
cc=wcc386 # Watcom C compiler
243
cpp=wpp386 # Watcom C++ compiler
244
LIB=wlib # Watcom librarian
250
$(CC) $(SYSDEF) $(DEBUGDEF) $(CCOPTS0) $(CCOPTS1) $(CCOPTS2) $(CCOPTS3) $(COPTS) $[@
252
.cpp.obj: .AUTODEPEND
253
$(CPP) $(SYSDEF) $(DEBUGDEF) $(CCOPTS0) $(CCOPTS1) $(CCOPTS2) $(CCOPTS3) $(CPPOPTS) $[@
255
.cxx.obj: .AUTODEPEND
256
$(CPP) $(SYSDEF) $(DEBUGDEF) $(CCOPTS0) $(CCOPTS1) $(CCOPTS2) $(CCOPTS3) $(CPPOPTS) $[@
262
$(LIB) $(LIBOPTS) $@ $<
265
# Linking stage. This implicit rule assumes the .exe is created from an object file with the
266
# same name, plus other object in macro OBJECTS, a number of .libs in macro LIBS etc.
267
# If the linking fails for some reason, the .lk1 file is not deleted and it can be
272
@%append $^*.lk1 F $(ODIR)/$^&
273
@for %i in ($(%OBJS)) do @%append $^*.lk1 F $(ODIR)/%i
274
@for %i in ($(OBJECTS)) do @%append $^*.lk1 F $(ODIR)/%i
275
@for %i in ($(LIBS)) do @%append $^*.lk1 L %i
276
@for %i in ($(EXTRA_LIBS)) do @%append $^*.lk1 L %i
277
@for %i in ($(SYSLIBS)) do @%append $^*.lk1 L %i
278
$(LN) $(LNOPTS) name $^@ op map=$^* @$^*.lk1