summaryrefslogtreecommitdiffstats
path: root/win/makefile.bc
blob: c0c9740a92460bf714cf6325b448e060515a4be2 (plain)
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# SCCS: @(#) makefile.bc 1.82 97/11/20 15:52:39
#
# Borland C++ 4.5 makefile
#

#
# Project directories
#
# ROOT = top of source tree
# TMPDIR = location where .obj files should be stored during build
# TOOLS = location of compiler and other development tools
#

ROOT	= ..
TMPDIR	= .
TOOLS	= c:\bc45

# uncomment the following line to compile with symbols
#DEBUG=1

# uncomment one of the following lines to compile with TCL_MEM_DEBUG,
# TCL_COMPILE_DEBUG, or TCL_COMPILE_STATS
#DEBUGDEFINES   =TCL_MEM_DEBUG 
#DEBUGDEFINES   =TCL_MEM_DEBUG;TCL_COMPILE_DEBUG
#DEBUGDEFINES   =TCL_MEM_DEBUG;TCL_COMPILE_STATS
#DEBUGDEFINES   =TCL_MEM_DEBUG;TCL_COMPILE_DEBUG;TCL_COMPILE_STATS


######################################################################
# Do not modify below this line
######################################################################

STACKSIZE = 1f0001

VERSION = 80

TCLLIB 		= tcl$(VERSION).lib
TCLDLL 		= tcl$(VERSION).dll
TCL16DLL 	= tcl16$(VERSION).dll
TCLSH 		= tclsh$(VERSION).exe
TCLTEST 	= tcltest.exe
DUMPEXTS 	= dumpexts.exe
TCLPIPEDLL 	= tclpip$(VERSION).dll
TCLREGDLL 	= tclreg$(VERSION).dll
CAT16 		= cat16.exe
CAT32 		= cat32.exe

TCLSHOBJS = \
	$(TMPDIR)\tclAppInit.obj

TCLTESTOBJS = \
	$(TMPDIR)\tclTest.obj \
	$(TMPDIR)\tclTestObj.obj \
	$(TMPDIR)\tclWinTest.obj \
	$(TMPDIR)\testMain.obj

TCLOBJS = \
	$(TMPDIR)\panic.obj \
	$(TMPDIR)\regexp.obj \
	$(TMPDIR)\strftime.obj \
	$(TMPDIR)\tclAlloc.obj \
	$(TMPDIR)\tclAsync.obj \
	$(TMPDIR)\tclBasic.obj \
	$(TMPDIR)\tclBinary.obj \
	$(TMPDIR)\tclCkalloc.obj \
	$(TMPDIR)\tclClock.obj \
	$(TMPDIR)\tclCmdAH.obj \
	$(TMPDIR)\tclCmdIL.obj \
	$(TMPDIR)\tclCmdMZ.obj \
	$(TMPDIR)\tclCompExpr.obj \
	$(TMPDIR)\tclCompile.obj \
	$(TMPDIR)\tclDate.obj \
	$(TMPDIR)\tclEnv.obj \
	$(TMPDIR)\tclEvent.obj \
	$(TMPDIR)\tclExecute.obj \
	$(TMPDIR)\tclFCmd.obj \
	$(TMPDIR)\tclFileName.obj \
	$(TMPDIR)\tclGet.obj \
	$(TMPDIR)\tclHash.obj \
	$(TMPDIR)\tclHistory.obj \
	$(TMPDIR)\tclIndexObj.obj \
	$(TMPDIR)\tclInterp.obj \
	$(TMPDIR)\tclIO.obj \
	$(TMPDIR)\tclIOCmd.obj \
	$(TMPDIR)\tclIOSock.obj \
	$(TMPDIR)\tclIOUtil.obj \
	$(TMPDIR)\tclLink.obj \
	$(TMPDIR)\tclListObj.obj \
	$(TMPDIR)\tclLoad.obj \
	$(TMPDIR)\tclMain.obj \
	$(TMPDIR)\tclNamesp.obj \
	$(TMPDIR)\tclNotify.obj \
	$(TMPDIR)\tclObj.obj \
	$(TMPDIR)\tclParse.obj \
	$(TMPDIR)\tclPipe.obj \
	$(TMPDIR)\tclPkg.obj \
	$(TMPDIR)\tclPosixStr.obj \
	$(TMPDIR)\tclPreserve.obj \
	$(TMPDIR)\tclProc.obj \
	$(TMPDIR)\tclStringObj.obj \
	$(TMPDIR)\tclTimer.obj \
	$(TMPDIR)\tclUtil.obj \
	$(TMPDIR)\tclVar.obj \
	$(TMPDIR)\tclWin32Dll.obj \
	$(TMPDIR)\tclWinChan.obj \
	$(TMPDIR)\tclWinError.obj \
	$(TMPDIR)\tclWinFCmd.obj \
	$(TMPDIR)\tclWinFile.obj \
	$(TMPDIR)\tclWinInit.obj \
	$(TMPDIR)\tclWinLoad.obj \
	$(TMPDIR)\tclWinMtherr.obj \
	$(TMPDIR)\tclWinNotify.obj \
	$(TMPDIR)\tclWinPipe.obj \
	$(TMPDIR)\tclWinSock.obj \
	$(TMPDIR)\tclWinTime.obj

cc32		= $(TOOLS)\bin\bcc32.exe
link32		= $(TOOLS)\bin\tlink32.exe
rc32		= $(TOOLS)\bin\brcc32.exe
implib		= $(TOOLS)\bin\implib.exe

cc16		= $(TOOLS)\bin\bcc.exe
link16		= $(TOOLS)\bin\tlink.exe
rc16		= $(TOOLS)\bin\brcc32.exe -31

CP		= copy
RM		= del

WINDIR          = $(ROOT)\win
GENERICDIR	= $(ROOT)\generic

INCLUDES	= $(TOOLS)\include;$(WINDIR);$(GENERICDIR)
LIBDIRS		= $(TOOLS)\lib;$(WINDIR)

CON_CFLAGS	= +cfgexe.cfg -WC
TEST_CFLAGS	= +cfgtest.cfg
DLL16_CFLAGS	= $(PROJECTCCFLAGS) -I$(INCLUDES) -D$(DEFINES) -WD -ml -c \
			-3 -d -w
TCL_CFLAGS	= +cfgdll.cfg

CON_LFLAGS	= -Tpe -ap -c $(DEBUGLDFLAGS) $(TOOLS)\lib\c0x32
DLL_LFLAGS	= -Tpd -aa -c $(DEBUGLDFLAGS) $(TOOLS)\lib\c0d32
GUI_LFLAGS	= -Tpe -aa -c $(DEBUGLDFLAGS) $(TOOLS)\lib\c0w32
DLL16_LFLAGS	= -Twd -c -C -A=16 $(DEBUGLDFLAGS16) $(TOOLS)\lib\c0dl

DLL_LIBS	= import32 cw32mti
CON_LIBS	= $(TCLLIB) import32 cw32mti
DLL16_LIBS	= import cwl

!ifndef DEBUG

# these macros cause maximum optimization and no symbols
DEBUGLDFLAGS = 
DEBUGCCFLAGS = -v- -vi- -O2
DEBUGLDFLAGS16 = -Oc -Oi -Oa -Or
!else

# these macros enable debugging
DEBUGLDFLAGS = -v
DEBUGCCFLAGS = -k -Od -v
DEBUGLDFLAGS16 = 

!endif

DEFINES = MT;_RTLDLL;$(DEBUGDEFINES)
PROJECTCCFLAGS = $(DEBUGCCFLAGS) -w-par -w-stu


# 
# Global makefile settings
#

.AUTODEPEND
.CACHEAUTODEPEND

.suffixes:

#.path.c=$(ROOT)\win;$(ROOT)\generic;$(ROOT)\compat
#.path.obj=$(TMPDIR)
#.path.dll=$(ROOT)\win

#
# Targets
#

release:    $(TCLSH) dlls
all:	    $(TCLSH) dlls $(CAT16) $(CAT32) 
tcltest:    $(TCLTEST) dlls $(CAT16) $(CAT32)
dlls:	    $(TCL16DLL) $(TCLPIPEDLL) $(TCLREGDLL)

test:	    tcltest
	$(TCLTEST) &&|
		cd ../tests
		source all
|


$(DUMPEXTS): cfgexe.cfg $(WINDIR)\winDumpExts.c
	$(cc32) $(CON_CFLAGS) $(WINDIR)\winDumpExts.c
	$(link32) $(CON_LFLAGS) \
		$(TMPDIR)\winDumpExts.obj,$@,,import32 cw32mti,,

$(TCLLIB): $(TCLDLL)
	$(implib) -c $@ $(TCLDLL)

$(TCLDLL): cfgdll.cfg $(TCLOBJS) $(TMPDIR)\tcl.def $(TMPDIR)\tcl.res
	$(link32) $(DLL_LFLAGS) @&&|
		$(TCLOBJS)
$@
-x
$(DLL_LIBS)
|, $(TMPDIR)\tcl.def, $(TMPDIR)\tcl.res


$(TCLSH): cfgexe.cfg $(TCLSHOBJS) $(TCLLIB) $(TMPDIR)\tclsh.res
	$(link32) -S:$(STACKSIZE) $(CON_LFLAGS) @&&|
		$(TCLSHOBJS)
$@
-x
$(CON_LIBS)
|, &&|
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
|, $(TMPDIR)\tclsh.res

$(TCLTEST): cfgtest.cfg $(TCLTESTOBJS) $(TCLLIB) $(TMPDIR)\tclsh.res
	$(link32) -S:$(STACKSIZE) $(CON_LFLAGS) @&&|
		$(TCLTESTOBJS)
$@
-x
$(CON_LIBS)
|, &&|
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
|, $(TMPDIR)\tclsh.res


$(TCL16DLL): tcl16.rc $(ROOT)\win\tclWin16.c
	$(cc16) @&&|
$(DLL16_CFLAGS) -n$(TMPDIR) 
| $(ROOT)\win\tclWin16.c
	$(rc16) @&&|
-i$(INCLUDES) -d__WIN32__;$(DEFINES) -fo$(TMPDIR)\tcl16.res
| tcl16.rc
	@copy >nul &&|
LIBRARY $&;dll
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
HEAPSIZE 1024
EXPORTS
	WEP @1 RESIDENTNAME
	UTPROC @2 
| $(TMPDIR)\tclWin16.def
	$(link16) $(DLL16_LFLAGS) @&&|
$(TMPDIR)\tclWin16.obj
$@
nul
$(DLL16_LIBS)
$(TMPDIR)\tclWin16.def
|
	$(TOOLS)\bin\rlink $(TMPDIR)\tcl16.res $@

$(TCLPIPEDLL): cfgexe.cfg stub16.c
	$(cc32) -c -tWC stub16.c
	$(link32) $(CON_LFLAGS) -L$(TOOLS)\lib \
		stub16.obj,$@,,import32 cw32,,

$(TCLREGDLL): extdll.cfg $(TMPDIR)\tclWinReg.obj
	$(link32) $(DLL_LFLAGS) @&&|
		$(TMPDIR)\tclWinReg.obj
$@
-x
$(DLL_LIBS) $(TCLLIB)
|,,

#
# Special test targets
#

$(CAT32): cat.c
	$(cc32) -c -Ox -tWC -ocat32.obj cat.c
	$(link32) $(CON_LFLAGS) -L$(TOOLS)\lib \
		cat32.obj,$@,,import32 cw32,,

$(CAT16): cat.c
	$(cc16) -W- -ml -Ox -c -ocat16.obj cat.c
	$(link16) -Tde -c -L$(TOOLS)\lib $(TOOLS)\lib\c0l.obj cat16.obj,cat16.exe,,cl.lib,,

#######################################################################
# Implicit Targets
#######################################################################


{$(WINDIR)}.c{$(TMPDIR)}.obj:
	@$(cc32) $(TCL_CFLAGS) {$< }

{$(GENERICDIR)}.c{$(TMPDIR)}.obj:
	@$(cc32) $(TCL_CFLAGS) {$< }

{$(ROOT)\compat}.c{$(TMPDIR)}.obj:
	@$(cc32) $(TCL_CFLAGS) {$< }

{$(WINDIR)}.rc{$(TMPDIR)}.res:
	$(rc32) -i$(INCLUDES) -fo$@ @&&|
-d__WIN32__;$(DEFINES) $<
|

#
# Special case object file targets
#

$(TMPDIR)\tclWinReg.obj : extdll.cfg $(ROOT)\win\tclWinReg.c
	$(cc32) +extdll.cfg -o$@ $(ROOT)\win\tclWinReg.c

$(TMPDIR)\tclAppInit.obj : cfgexe.cfg $(ROOT)\win\tclAppInit.c
	$(cc32) $(CON_CFLAGS) -o$@ $(ROOT)\win\tclAppInit.c

$(TMPDIR)\testMain.obj : cfgexe.cfg $(ROOT)\win\tclAppInit.c
	$(cc32) $(TEST_CFLAGS) -o$@ $(ROOT)\win\tclAppInit.c

$(TMPDIR)\tclWin16.obj : $(ROOT)\win\tclWin16.c
	$(cc16) $(DLL16_CFLAGS) -o$@ $(ROOT)\win\tclWin16.c

#
# Configuration file targets - these files are implicitly used by the compiler
#

cfgdll.cfg:
	@$(CP) &&|
		-n$(TMPDIR) -I$(INCLUDES) -c -WM
		-D$(DEFINES) -3 -d -w $(PROJECTCCFLAGS)
| cfgdll.cfg >NUL

extdll.cfg:
	@$(CP) &&|
		-n$(TMPDIR) -I$(INCLUDES) -c -WD
		-D_RTLDLL;$(DEBUGDEFINES) -3 -d -w $(PROJECTCCFLAGS)
| extdll.cfg >NUL

cfgexe.cfg:
	@$(CP) &&|
		-n$(TMPDIR) -I$(INCLUDES) -c -W
		-D$(DEFINES) -3 -d -w $(PROJECTCCFLAGS)
| cfgexe.cfg >NUL

cfgtest.cfg:
	@$(CP) &&|
		-n$(TMPDIR) -I$(INCLUDES) -c -W
		-D$(DEFINES);TCL_TEST -3 -d -w $(PROJECTCCFLAGS)
| cfgtest.cfg >NUL

cfgcln:
	-@$(RM) *.cfg


# The following rule automatically generates a tcl.def file containing
# an export entry for every public symbol in the tcl.dll library.

$(TMPDIR)\tcl.def: $(TCLOBJS) $(DUMPEXTS)
	$(DUMPEXTS) -o $(TMPDIR)\tcl.def $(TCLDLL) @&&|
		$(TCLOBJS)
|


# the following two rules are a hack to get around the fact that the
# 16-bit compiler doesn't handle long file names :-(

$(ROOT)\win\tclWinIn.h: $(ROOT)\win\tclWinInt.h
	$(CP) $(ROOT)\win\tclWinInt.h $(ROOT)\win\tclWinIn.h

$(ROOT)\win\tclWin16.c: $(ROOT)\win\tclWinIn.h

# remove all generated files

clean:
	-@$(RM) *.exe
	-@$(RM) *.lib
	-@$(RM) *.dll
	-@$(RM) $(TMPDIR)\*.res
	-@$(RM) $(TMPDIR)\*.def
	-@$(RM) $(TMPDIR)\*.obj
	-@$(RM) $(TMPDIR)\*.cfg
	-@$(RM) $(ROOT)\win\tclWinIn.h