1#
2# This file is a Makefile for Tcl.  If it has the name "Makefile.in" then it
3# is a template for a Makefile; to generate the actual Makefile, run
4# "./configure", which is a configuration script generated by the "autoconf"
5# program (constructs like "@foo@" will get replaced in the actual Makefile.
6
7VERSION = @TCL_VERSION@
8
9#--------------------------------------------------------------------------
10# Things you can change to personalize the Makefile for your own site (you can
11# make these changes in either Makefile.in or Makefile, but changes to
12# Makefile will get lost if you re-run the configuration script).
13#--------------------------------------------------------------------------
14
15# Default top-level directories in which to install architecture-specific
16# files (exec_prefix) and machine-independent files such as scripts (prefix).
17# The values specified here may be overridden at configure-time with the
18# --exec-prefix and --prefix options to the "configure" script.
19
20prefix			= @prefix@
21exec_prefix		= @exec_prefix@
22bindir			= @bindir@
23libdir			= @libdir@
24includedir		= @includedir@
25datarootdir		= @datarootdir@
26mandir			= @mandir@
27
28# The following definition can be set to non-null for special systems like AFS
29# with replication. It allows the pathnames used for installation to be
30# different than those used for actually reference files at run-time.
31# INSTALL_ROOT is prepended to $prefix and $exec_prefix when installing files.
32INSTALL_ROOT	=
33
34# Directory from which applications will reference the library of Tcl scripts
35# (note: you can set the TCL_LIBRARY environment variable at run-time to
36# override this value):
37TCL_LIBRARY	= $(prefix)/lib/tcl$(VERSION)
38
39# Path to use at runtime to refer to LIB_INSTALL_DIR:
40LIB_RUNTIME_DIR		= $(libdir)
41
42# Directory in which to install the program tclsh:
43BIN_INSTALL_DIR		= $(INSTALL_ROOT)$(bindir)
44
45# Directory in which to install the .a or .so binary for the Tcl library:
46LIB_INSTALL_DIR		= $(INSTALL_ROOT)$(libdir)
47
48# Path name to use when installing library scripts.
49SCRIPT_INSTALL_DIR	= $(INSTALL_ROOT)$(TCL_LIBRARY)
50
51# Directory in which to install the include file tcl.h:
52INCLUDE_INSTALL_DIR	= $(INSTALL_ROOT)$(includedir)
53
54# Directory in which to (optionally) install the private tcl headers:
55PRIVATE_INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir)
56
57# Top-level directory in which to install manual entries:
58MAN_INSTALL_DIR		= $(INSTALL_ROOT)$(mandir)
59
60# Directory in which to install manual entry for tclsh:
61MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1
62
63# Directory in which to install manual entries for Tcl's C library procedures:
64MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3
65
66# Directory in which to install manual entries for the built-in Tcl commands:
67MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann
68
69# Libraries built with optimization switches have this additional extension
70TCL_DBGX = @TCL_DBGX@
71
72# warning flags
73CFLAGS_WARNING = @CFLAGS_WARNING@
74
75# The default switches for optimization or debugging
76CFLAGS_DEBUG    = @CFLAGS_DEBUG@
77CFLAGS_OPTIMIZE	= @CFLAGS_OPTIMIZE@
78
79# To change the compiler switches, for example to change from optimization to
80# debugging symbols, change the following line:
81#CFLAGS = 		$(CFLAGS_DEBUG)
82#CFLAGS = 		$(CFLAGS_OPTIMIZE)
83#CFLAGS = 		$(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE)
84CFLAGS = 		@CFLAGS@ @CFLAGS_DEFAULT@
85
86# To enable compilation debugging reverse the comment characters on one of the
87# following lines.
88COMPILE_DEBUG_FLAGS =
89#COMPILE_DEBUG_FLAGS = -DTCL_COMPILE_DEBUG
90#COMPILE_DEBUG_FLAGS = -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
91
92# Special compiler flags to use when building man2tcl on Windows.
93MAN2TCLFLAGS =		@MAN2TCLFLAGS@
94
95SRC_DIR			= @srcdir@
96ROOT_DIR		= @srcdir@/..
97GENERIC_DIR		= @srcdir@/../generic
98TOMMATH_DIR		= @srcdir@/../libtommath
99WIN_DIR			= @srcdir@
100COMPAT_DIR		= @srcdir@/../compat
101
102# Converts a POSIX path to a Windows native path.
103CYGPATH			= @CYGPATH@
104
105libdir_native	= $(shell $(CYGPATH) '$(libdir)')
106bindir_native	= $(shell $(CYGPATH) '$(bindir)')
107includedir_native = $(shell $(CYGPATH) '$(includedir)')
108mandir_native = $(shell $(CYGPATH) '$(mandir)')
109TCL_LIBRARY_NATIVE	= $(shell $(CYGPATH) '$(TCL_LIBRARY)')
110GENERIC_DIR_NATIVE	= $(shell $(CYGPATH) '$(GENERIC_DIR)')
111TOMMATH_DIR_NATIVE	= $(shell $(CYGPATH) '$(TOMMATH_DIR)')
112WIN_DIR_NATIVE		= $(shell $(CYGPATH) '$(WIN_DIR)')
113ROOT_DIR_NATIVE		= $(shell $(CYGPATH) '$(ROOT_DIR)')
114#GENERIC_DIR_NATIVE	= $(GENERIC_DIR)
115#TOMMATH_DIR_NATIVE	= $(TOMMATH_DIR)
116#WIN_DIR_NATIVE		= $(WIN_DIR)
117#ROOT_DIR_NATIVE		= $(ROOT_DIR)
118
119# Fully qualify library path so that `make test`
120# does not depend on the current directory.
121LIBRARY_DIR1		= $(shell cd '$(ROOT_DIR_NATIVE)/library' ; pwd)
122LIBRARY_DIR             = $(shell $(CYGPATH) '$(LIBRARY_DIR1)')
123DLLSUFFIX		= @DLLSUFFIX@
124LIBSUFFIX		= @LIBSUFFIX@
125EXESUFFIX		= @EXESUFFIX@
126
127VER			= @TCL_MAJOR_VERSION@@TCL_MINOR_VERSION@
128DOTVER			= @TCL_MAJOR_VERSION@.@TCL_MINOR_VERSION@
129DDEVER			= @TCL_DDE_MAJOR_VERSION@@TCL_DDE_MINOR_VERSION@
130DDEDOTVER		= @TCL_DDE_MAJOR_VERSION@.@TCL_DDE_MINOR_VERSION@
131REGVER			= @TCL_REG_MAJOR_VERSION@@TCL_REG_MINOR_VERSION@
132REGDOTVER		= @TCL_REG_MAJOR_VERSION@.@TCL_REG_MINOR_VERSION@
133
134TCL_STUB_LIB_FILE	= @TCL_STUB_LIB_FILE@
135TCL_DLL_FILE		= @TCL_DLL_FILE@
136TCL_LIB_FILE		= @TCL_LIB_FILE@
137DDE_DLL_FILE		= tcldde$(DDEVER)${DLLSUFFIX}
138DDE_LIB_FILE		= tcldde$(DDEVER)${LIBSUFFIX}
139REG_DLL_FILE		= tclreg$(REGVER)${DLLSUFFIX}
140REG_LIB_FILE		= tclreg$(REGVER)${LIBSUFFIX}
141PIPE_DLL_FILE		= tclpip$(VER)${DLLSUFFIX}
142
143SHARED_LIBRARIES 	= $(TCL_DLL_FILE) $(TCL_STUB_LIB_FILE) \
144			  $(DDE_DLL_FILE) $(REG_DLL_FILE) $(PIPE_DLL_FILE)
145STATIC_LIBRARIES	= $(TCL_LIB_FILE) $(REG_LIB_FILE) $(DDE_LIB_FILE)
146
147# To compile without backward compatibility and deprecated code
148# uncomment the following
149NO_DEPRECATED_FLAGS	=
150#NO_DEPRECATED_FLAGS	= -DTCL_NO_DEPRECATED
151
152# TCL_EXE is the name of a tclsh executable that is available *BEFORE* running
153# make for the first time. Certain build targets (make genstubs) need it to be
154# available on the PATH. This executable should *NOT* be required just to do a
155# normal build although it can be required to run make dist.
156TCL_EXE			= tclsh
157
158TCLSH			= tclsh$(VER)${EXESUFFIX}
159TCLTEST			= tcltest${EXEEXT}
160CAT32			= cat32$(EXEEXT)
161MAN2TCL			= man2tcl$(EXEEXT)
162
163@SET_MAKE@
164
165# Setting the VPATH variable to a list of paths will cause the Makefile to
166# look into these paths when resolving .c to .obj dependencies.
167
168VPATH = $(GENERIC_DIR):$(TOMMATH_DIR):$(WIN_DIR):$(COMPAT_DIR)
169
170AR		= @AR@
171RANLIB		= @RANLIB@
172CC		= @CC@
173RC		= @RC@
174RES		= @RES@
175AC_FLAGS	= @EXTRA_CFLAGS@ @DEFS@
176CPPFLAGS	= @CPPFLAGS@
177LDFLAGS_DEBUG   = @LDFLAGS_DEBUG@
178LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@
179LDFLAGS		= @LDFLAGS@ @LDFLAGS_DEFAULT@
180LDFLAGS_CONSOLE	= @LDFLAGS_CONSOLE@
181LDFLAGS_WINDOW	= @LDFLAGS_WINDOW@
182EXEEXT		= @EXEEXT@
183OBJEXT		= @OBJEXT@
184STLIB_LD	= @STLIB_LD@
185SHLIB_LD	= @SHLIB_LD@
186SHLIB_LD_LIBS	= @SHLIB_LD_LIBS@ $(LIBS)
187SHLIB_CFLAGS	= @SHLIB_CFLAGS@
188SHLIB_SUFFIX	= @SHLIB_SUFFIX@
189LIBS		= @LIBS@
190
191RMDIR		= rm -rf
192MKDIR		= mkdir -p
193SHELL		= @SHELL@
194RM		= rm -f
195COPY		= cp
196
197CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${TCL_SHLIB_CFLAGS} \
198-I"${GENERIC_DIR_NATIVE}" -DTCL_TOMMATH -DMP_PREC=4 -I"${TOMMATH_DIR_NATIVE}" \
199-I"${WIN_DIR_NATIVE}" ${AC_FLAGS} \
200${COMPILE_DEBUG_FLAGS} ${NO_DEPRECATED_FLAGS}
201
202CC_OBJNAME = @CC_OBJNAME@
203CC_EXENAME = @CC_EXENAME@
204
205STUB_CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
206-I"${GENERIC_DIR_NATIVE}" -DTCL_TOMMATH -DMP_PREC=4 -I"${TOMMATH_DIR_NATIVE}" \
207-I"${WIN_DIR_NATIVE}" ${AC_FLAGS} \
208${COMPILE_DEBUG_FLAGS}
209
210TCLTEST_OBJS = \
211	tclTest.$(OBJEXT) \
212	tclTestObj.$(OBJEXT) \
213	tclTestProcBodyObj.$(OBJEXT) \
214	tclThreadTest.$(OBJEXT) \
215	tclWinTest.$(OBJEXT) \
216	testMain.$(OBJEXT)
217
218GENERIC_OBJS = \
219	regcomp.$(OBJEXT) \
220	regexec.$(OBJEXT) \
221	regfree.$(OBJEXT) \
222	regerror.$(OBJEXT) \
223	tclAlloc.$(OBJEXT) \
224	tclAsync.$(OBJEXT) \
225	tclBasic.$(OBJEXT) \
226	tclBinary.$(OBJEXT) \
227	tclCkalloc.$(OBJEXT) \
228	tclClock.$(OBJEXT) \
229	tclCmdAH.$(OBJEXT) \
230	tclCmdIL.$(OBJEXT) \
231	tclCmdMZ.$(OBJEXT) \
232	tclCompCmds.$(OBJEXT) \
233	tclCompExpr.$(OBJEXT) \
234	tclCompile.$(OBJEXT) \
235	tclConfig.$(OBJEXT) \
236	tclDate.$(OBJEXT) \
237	tclDictObj.$(OBJEXT) \
238	tclEncoding.$(OBJEXT) \
239	tclEnv.$(OBJEXT) \
240	tclEvent.$(OBJEXT) \
241	tclExecute.$(OBJEXT) \
242	tclFCmd.$(OBJEXT) \
243	tclFileName.$(OBJEXT) \
244	tclGet.$(OBJEXT) \
245	tclHash.$(OBJEXT) \
246	tclHistory.$(OBJEXT) \
247	tclIndexObj.$(OBJEXT) \
248	tclInterp.$(OBJEXT) \
249	tclIO.$(OBJEXT) \
250	tclIOCmd.$(OBJEXT) \
251	tclIOGT.$(OBJEXT) \
252	tclIORChan.$(OBJEXT) \
253	tclIOSock.$(OBJEXT) \
254	tclIOUtil.$(OBJEXT) \
255	tclLink.$(OBJEXT) \
256	tclLiteral.$(OBJEXT) \
257	tclListObj.$(OBJEXT) \
258	tclLoad.$(OBJEXT) \
259	tclMain.$(OBJEXT) \
260	tclNamesp.$(OBJEXT) \
261	tclNotify.$(OBJEXT) \
262	tclObj.$(OBJEXT) \
263	tclPanic.$(OBJEXT) \
264	tclParse.$(OBJEXT) \
265	tclPathObj.$(OBJEXT) \
266	tclPipe.$(OBJEXT) \
267	tclPkg.$(OBJEXT) \
268	tclPkgConfig.$(OBJEXT) \
269	tclPosixStr.$(OBJEXT) \
270	tclPreserve.$(OBJEXT) \
271	tclProc.$(OBJEXT) \
272	tclRegexp.$(OBJEXT) \
273	tclResolve.$(OBJEXT) \
274	tclResult.$(OBJEXT) \
275	tclScan.$(OBJEXT) \
276	tclStringObj.$(OBJEXT) \
277	tclStrToD.$(OBJEXT) \
278	tclStubInit.$(OBJEXT) \
279	tclStubLib.$(OBJEXT) \
280	tclThread.$(OBJEXT) \
281	tclThreadAlloc.$(OBJEXT) \
282	tclThreadJoin.$(OBJEXT) \
283	tclThreadStorage.$(OBJEXT) \
284	tclTimer.$(OBJEXT) \
285	tclTomMathInterface.$(OBJEXT) \
286	tclTrace.$(OBJEXT) \
287	tclUtf.$(OBJEXT) \
288	tclUtil.$(OBJEXT) \
289	tclVar.$(OBJEXT)
290
291TOMMATH_OBJS = \
292	bncore.${OBJEXT} \
293	bn_reverse.${OBJEXT} \
294	bn_fast_s_mp_mul_digs.${OBJEXT} \
295	bn_fast_s_mp_sqr.${OBJEXT} \
296	bn_mp_add.${OBJEXT} \
297	bn_mp_add_d.${OBJEXT} \
298	bn_mp_and.${OBJEXT} \
299	bn_mp_clamp.${OBJEXT} \
300	bn_mp_clear.${OBJEXT} \
301	bn_mp_clear_multi.${OBJEXT} \
302	bn_mp_cmp.${OBJEXT} \
303	bn_mp_cmp_d.${OBJEXT} \
304	bn_mp_cmp_mag.${OBJEXT} \
305	bn_mp_cnt_lsb.${OBJEXT} \
306	bn_mp_copy.${OBJEXT} \
307	bn_mp_count_bits.${OBJEXT} \
308	bn_mp_div.${OBJEXT} \
309	bn_mp_div_d.${OBJEXT} \
310	bn_mp_div_2.${OBJEXT} \
311	bn_mp_div_2d.${OBJEXT} \
312	bn_mp_div_3.${OBJEXT} \
313	bn_mp_exch.${OBJEXT} \
314	bn_mp_expt_d.${OBJEXT} \
315	bn_mp_grow.${OBJEXT} \
316	bn_mp_init.${OBJEXT} \
317	bn_mp_init_copy.${OBJEXT} \
318	bn_mp_init_multi.${OBJEXT} \
319	bn_mp_init_set.${OBJEXT} \
320	bn_mp_init_set_int.${OBJEXT} \
321	bn_mp_init_size.${OBJEXT} \
322	bn_mp_karatsuba_mul.${OBJEXT} \
323	bn_mp_karatsuba_sqr.$(OBJEXT) \
324	bn_mp_lshd.${OBJEXT} \
325	bn_mp_mod.${OBJEXT} \
326	bn_mp_mod_2d.${OBJEXT} \
327	bn_mp_mul.${OBJEXT} \
328	bn_mp_mul_2.${OBJEXT} \
329	bn_mp_mul_2d.${OBJEXT} \
330	bn_mp_mul_d.${OBJEXT} \
331	bn_mp_neg.${OBJEXT} \
332	bn_mp_or.${OBJEXT} \
333	bn_mp_radix_size.${OBJEXT} \
334	bn_mp_radix_smap.${OBJEXT} \
335	bn_mp_read_radix.${OBJEXT} \
336	bn_mp_rshd.${OBJEXT} \
337	bn_mp_set.${OBJEXT} \
338	bn_mp_set_int.${OBJEXT} \
339	bn_mp_shrink.${OBJEXT} \
340	bn_mp_sqr.${OBJEXT} \
341	bn_mp_sqrt.${OBJEXT} \
342	bn_mp_sub.${OBJEXT} \
343	bn_mp_sub_d.${OBJEXT} \
344	bn_mp_to_unsigned_bin.${OBJEXT} \
345	bn_mp_to_unsigned_bin_n.${OBJEXT} \
346	bn_mp_toom_mul.${OBJEXT} \
347	bn_mp_toom_sqr.${OBJEXT} \
348	bn_mp_toradix_n.${OBJEXT} \
349	bn_mp_unsigned_bin_size.${OBJEXT} \
350	bn_mp_xor.${OBJEXT} \
351	bn_mp_zero.${OBJEXT} \
352	bn_s_mp_add.${OBJEXT} \
353	bn_s_mp_mul_digs.${OBJEXT} \
354	bn_s_mp_sqr.${OBJEXT} \
355	bn_s_mp_sub.${OBJEXT}
356
357
358WIN_OBJS = \
359	tclWin32Dll.$(OBJEXT) \
360	tclWinChan.$(OBJEXT) \
361	tclWinConsole.$(OBJEXT) \
362	tclWinSerial.$(OBJEXT) \
363	tclWinError.$(OBJEXT) \
364	tclWinFCmd.$(OBJEXT) \
365	tclWinFile.$(OBJEXT) \
366	tclWinInit.$(OBJEXT) \
367	tclWinLoad.$(OBJEXT) \
368	tclWinNotify.$(OBJEXT) \
369	tclWinPipe.$(OBJEXT) \
370	tclWinSock.$(OBJEXT) \
371	tclWinThrd.$(OBJEXT) \
372	tclWinTime.$(OBJEXT)
373
374PIPE_OBJS = stub16.$(OBJEXT)
375
376DDE_OBJS = tclWinDde.$(OBJEXT)
377
378REG_OBJS = tclWinReg.$(OBJEXT)
379
380STUB_OBJS = tclStubLib.$(OBJEXT)
381
382TCLSH_OBJS = tclAppInit.$(OBJEXT)
383
384TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS}
385
386TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n]
387
388all: binaries libraries doc
389
390tcltest: $(TCLTEST)
391
392binaries: @LIBRARIES@ $(TCLSH)
393
394libraries:
395
396doc:
397
398winhelp: $(ROOT_DIR)/tools/man2help.tcl $(MAN2TCL)
399	TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \
400	./$(TCLSH) "$(ROOT_DIR_NATIVE)"/tools/man2help.tcl tcl "$(VER)" $(TCL_DOCS)
401	hcw /c /e tcl.hpj
402
403winextensions: ${DDE_DLL_FILE} ${REG_DLL_FILE}
404
405$(MAN2TCL): $(ROOT_DIR)/tools/man2tcl.c
406	$(CC) $(CFLAGS_OPTIMIZE) $(MAN2TCLFLAGS) -o $(MAN2TCL) "$(ROOT_DIR_NATIVE)"/tools/man2tcl.c
407
408$(TCLSH): $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(TCLSH_OBJS) tclsh.$(RES)
409	$(CC) $(CFLAGS) $(TCLSH_OBJS) $(TCL_LIB_FILE) $(LIBS) \
410        tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE)
411	@VC_MANIFEST_EMBED_EXE@
412
413$(TCLTEST): $(TCL_LIB_FILE) $(TCLTEST_OBJS) $(CAT32) tclsh.$(RES)
414	$(CC) $(CFLAGS) $(TCLTEST_OBJS) $(TCL_LIB_FILE) $(LIBS) \
415        tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE)
416	@VC_MANIFEST_EMBED_EXE@
417
418cat32.$(OBJEXT): cat.c
419	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
420
421$(CAT32): cat32.$(OBJEXT)
422	$(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE)
423
424# The following targets are configured by autoconf to generate either a shared
425# library or static library
426
427${TCL_STUB_LIB_FILE}: ${STUB_OBJS}
428	@$(RM) ${TCL_STUB_LIB_FILE}
429	@MAKE_STUB_LIB@ ${STUB_OBJS}
430	@POST_MAKE_LIB@
431
432${TCL_DLL_FILE}: ${TCL_OBJS} tcl.$(RES)
433	@$(RM) ${TCL_DLL_FILE}
434	@MAKE_DLL@ ${TCL_OBJS} tcl.$(RES) $(SHLIB_LD_LIBS)
435	@VC_MANIFEST_EMBED_DLL@
436
437${TCL_LIB_FILE}: ${TCL_OBJS}
438	@$(RM) ${TCL_LIB_FILE}
439	@MAKE_LIB@ ${TCL_OBJS}
440	@POST_MAKE_LIB@
441
442${DDE_DLL_FILE}: ${DDE_OBJS} ${TCL_STUB_LIB_FILE}
443	@$(RM) ${DDE_DLL_FILE}
444	@MAKE_DLL@ ${DDE_OBJS} $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS)
445
446${DDE_LIB_FILE}: ${DDE_OBJS} ${TCL_LIB_FILE}
447	@$(RM) ${DDE_LIB_FILE}
448	@MAKE_LIB@ ${DDE_OBJS} ${TCL_LIB_FILE}
449
450${REG_DLL_FILE}: ${REG_OBJS} ${TCL_STUB_LIB_FILE}
451	@$(RM) ${REG_DLL_FILE}
452	@MAKE_DLL@ ${REG_OBJS} $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS)
453
454${REG_LIB_FILE}: ${REG_OBJS} ${TCL_LIB_FILE}
455	@$(RM) ${REG_LIB_FILE}
456	@MAKE_LIB@ ${REG_OBJS} ${TCL_LIB_FILE}
457
458# PIPE_DLL_FILE is actually an executable, don't build it like a DLL.
459
460${PIPE_DLL_FILE}: ${PIPE_OBJS}
461	@$(RM) ${PIPE_DLL_FILE}
462	@MAKE_EXE@ $(CFLAGS) ${PIPE_OBJS} $(LIBS) $(LDFLAGS_CONSOLE)
463
464# Add the object extension to the implicit rules. By default .obj is not
465# automatically added.
466
467.SUFFIXES: .${OBJEXT}
468.SUFFIXES: .$(RES)
469.SUFFIXES: .rc
470
471# Special case object targets
472
473tclWinInit.${OBJEXT}: tclWinInit.c
474	$(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME)
475
476tclWinPipe.${OBJEXT}: tclWinPipe.c
477	$(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_PIPE_DLL=\"$(PIPE_DLL_FILE)\" \
478	    $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME)
479
480testMain.${OBJEXT}: tclAppInit.c
481	$(CC) -c $(CC_SWITCHES) -DTCL_TEST @DEPARG@ $(CC_OBJNAME)
482
483tclTest.${OBJEXT}: tclTest.c
484	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
485
486tclTestObj.${OBJEXT}: tclTestObj.c
487	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
488
489tclWinTest.${OBJEXT}: tclWinTest.c
490	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
491
492tclAppInit.${OBJEXT} : tclAppInit.c
493	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
494
495# The following objects should be built using the stub interfaces
496
497tclWinReg.${OBJEXT} : tclWinReg.c
498	$(CC) -c $(CC_SWITCHES) -DUSE_TCL_STUBS @DEPARG@ $(CC_OBJNAME)
499
500tclWinDde.${OBJEXT} : tclWinDde.c
501	$(CC) -c $(CC_SWITCHES) -DUSE_TCL_STUBS @DEPARG@ $(CC_OBJNAME)
502
503# TIP #59, embedding of configuration information into the binary library.
504#
505# Part of Tcl's configuration information are the paths where it was installed
506# and where it will look for its libraries (which can be different). We derive
507# this information from the variables which can be overridden by the user. As
508# every path can be configured separately we do not remember one general
509# prefix/exec_prefix but all the different paths individually.
510
511tclPkgConfig.${OBJEXT}: tclPkgConfig.c
512	$(CC)	-c $(CC_SWITCHES)			\
513		-DCFG_INSTALL_LIBDIR=\"$(LIB_INSTALL_DIR_NATIVE)\" \
514		-DCFG_INSTALL_BINDIR=\"$(BIN_INSTALL_DIR_NATIVE)\" \
515		-DCFG_INSTALL_SCRDIR=\"$(SCRIPT_INSTALL_DIR_NATIVE)\" \
516		-DCFG_INSTALL_INCDIR=\"$(INCLUDE_INSTALL_DIR_NATIVE)\" \
517		-DCFG_INSTALL_DOCDIR=\"$(MAN_INSTALL_DIR)\" \
518		\
519		-DCFG_RUNTIME_LIBDIR=\"$(libdir_native)\" \
520		-DCFG_RUNTIME_BINDIR=\"$(bindir_native)\" \
521		-DCFG_RUNTIME_SCRDIR=\"$(TCL_LIBRARY_NATIVE)\" \
522		-DCFG_RUNTIME_INCDIR=\"$(includedir_native)\" \
523		-DCFG_RUNTIME_DOCDIR=\"$(mandir_native)\" \
524		-DBUILD_tcl \
525		@DEPARG@ $(CC_OBJNAME)
526
527# The following objects are part of the stub library and should not be built
528# as DLL objects but none of the symbols should be exported
529
530tclStubLib.${OBJEXT}: tclStubLib.c
531	$(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME)
532
533
534# Implicit rule for all object files that will end up in the Tcl library
535
536%.${OBJEXT}: %.c
537	$(CC) -c $(CC_SWITCHES) -DBUILD_tcl @DEPARG@ $(CC_OBJNAME)
538
539.rc.$(RES):
540	$(RC) @RC_OUT@ $@ @RC_TYPE@ @RC_DEFINES@ @RC_INCLUDE@ "$(GENERIC_DIR_NATIVE)" @RC_INCLUDE@ "$(WIN_DIR_NATIVE)" @DEPARG@
541
542# The following target generates the file generic/tclDate.c from the yacc
543# grammar found in generic/tclGetDate.y. This is only run by hand as yacc is
544# not available in all environments. The name of the .c file is different than
545# the name of the .y file so that make doesn't try to automatically regenerate
546# the .c file.
547
548gendate:
549	bison --output-file=$(GENERIC_DIR)/tclDate.c \
550	--name-prefix=TclDate \
551	--no-lines \
552	$(GENERIC_DIR)/tclGetDate.y
553
554# The following target generates the file generic/tclTomMath.h. It needs to be
555# run (and the results checked) after updating to a new release of libtommath.
556
557gentommath_h:
558	$(TCL_EXE) "$(ROOT_DIR_NATIVE)\tools\fix_tommath_h.tcl" \
559		"$(TOMMATH_DIR_NATIVE)\tommath.h" \
560		> "$(GENERIC_DIR_NATIVE)\tclTomMath.h"
561
562install: all install-binaries install-libraries install-doc
563
564install-binaries: binaries
565	@for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" ; \
566	    do \
567	    if [ ! -d $$i ] ; then \
568		echo "Making directory $$i"; \
569		$(MKDIR) $$i; \
570		chmod 755 $$i; \
571		else true; \
572		fi; \
573	    done;
574	@for i in dde$(DDEDOTVER) reg$(REGDOTVER); \
575	    do \
576	    if [ ! -d $(LIB_INSTALL_DIR)/$$i ] ; then \
577		echo "Making directory $(LIB_INSTALL_DIR)/$$i"; \
578		$(MKDIR) $(LIB_INSTALL_DIR)/$$i; \
579		else true; \
580		fi; \
581	    done;
582	@for i in $(TCL_DLL_FILE) $(TCLSH) $(PIPE_DLL_FILE); \
583	    do \
584	    if [ -f $$i ]; then \
585		echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \
586		$(COPY) $$i "$(BIN_INSTALL_DIR)"; \
587	    fi; \
588	    done
589	@for i in tclConfig.sh $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE); \
590	    do \
591	    if [ -f $$i ]; then \
592		echo "Installing $$i to $(LIB_INSTALL_DIR)/"; \
593		$(COPY) $$i "$(LIB_INSTALL_DIR)"; \
594	    fi; \
595	    done
596	@if [ -f $(DDE_DLL_FILE) ]; then \
597	    echo Installing $(DDE_DLL_FILE); \
598	    $(COPY) $(DDE_DLL_FILE) $(LIB_INSTALL_DIR)/dde$(DDEDOTVER); \
599	    $(COPY) $(ROOT_DIR)/library/dde/pkgIndex.tcl \
600		$(LIB_INSTALL_DIR)/dde$(DDEDOTVER); \
601	    fi
602	@if [ -f $(DDE_LIB_FILE) ]; then \
603	    echo Installing $(DDE_LIB_FILE); \
604	    $(COPY) $(DDE_LIB_FILE) $(LIB_INSTALL_DIR)/dde$(DDEDOTVER); \
605	    fi
606	@if [ -f $(REG_DLL_FILE) ]; then \
607	    echo Installing $(REG_DLL_FILE); \
608	    $(COPY) $(REG_DLL_FILE) $(LIB_INSTALL_DIR)/reg$(REGDOTVER); \
609	    $(COPY) $(ROOT_DIR)/library/reg/pkgIndex.tcl \
610		$(LIB_INSTALL_DIR)/reg$(REGDOTVER); \
611	    fi
612	@if [ -f $(REG_LIB_FILE) ]; then \
613	    echo Installing $(REG_LIB_FILE); \
614	    $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg$(REGDOTVER); \
615	    fi
616
617install-libraries: libraries install-tzdata install-msgs
618	@for i in $(prefix)/lib $(INCLUDE_INSTALL_DIR) \
619		$(SCRIPT_INSTALL_DIR); \
620	    do \
621	    if [ ! -d $$i ] ; then \
622		echo "Making directory $$i"; \
623		$(MKDIR) $$i; \
624		else true; \
625		fi; \
626	    done;
627	@for i in http1.0 opt0.4 encoding ../tcl8 ../tcl8/8.4  ../tcl8/8.4/platform ../tcl8/8.5; \
628	    do \
629	    if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \
630		echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \
631		$(MKDIR) $(SCRIPT_INSTALL_DIR)/$$i; \
632		else true; \
633		fi; \
634	    done;
635	@echo "Installing header files";
636	@for i in "$(GENERIC_DIR)/tcl.h" "$(GENERIC_DIR)/tclDecls.h" \
637		"$(GENERIC_DIR)/tclPlatDecls.h" \
638		"$(GENERIC_DIR)/tclTomMath.h" \
639		"$(GENERIC_DIR)/tclTomMathDecls.h"; \
640	    do \
641	    $(COPY) "$$i" "$(INCLUDE_INSTALL_DIR)"; \
642	    done;
643	@echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
644	@for i in $(ROOT_DIR)/library/*.tcl $(ROOT_DIR)/library/tclIndex; \
645	    do \
646	    $(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)"; \
647	    done;
648	@echo "Installing library http1.0 directory";
649	@for j in $(ROOT_DIR)/library/http1.0/*.tcl; \
650	    do \
651	    $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/http1.0"; \
652	    done;
653	@echo "Installing package http 2.7.13 as a Tcl Module";
654	@$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/http-2.7.13.tm;
655	@echo "Installing library opt0.4 directory";
656	@for j in $(ROOT_DIR)/library/opt/*.tcl; \
657	    do \
658	    $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \
659	    done;
660	@echo "Installing package msgcat 1.5.2 as a Tcl Module";
661	@$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.5.2.tm;
662	@echo "Installing package tcltest 2.3.8 as a Tcl Module";
663	@$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.3.8.tm;
664	@echo "Installing package platform 1.0.14 as a Tcl Module";
665	@$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.14.tm;
666	@echo "Installing package platform::shell 1.1.4 as a Tcl Module";
667	@$(COPY) $(ROOT_DIR)/library/platform/shell.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform/shell-1.1.4.tm;
668	@echo "Installing encodings";
669	@for i in $(ROOT_DIR)/library/encoding/*.enc ; do \
670		$(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)/encoding"; \
671	done;
672
673install-tzdata:
674	@echo "Installing time zone data"
675	@TCL_LIBRARY="${LIBRARY_DIR}"; export TCL_LIBRARY; \
676	./$(TCLSH) "$(ROOT_DIR)/tools/installData.tcl" \
677	    "$(ROOT_DIR)/library/tzdata" "$(SCRIPT_INSTALL_DIR)/tzdata"
678
679install-msgs:
680	@echo "Installing message catalogs"
681	@TCL_LIBRARY="${LIBRARY_DIR}"; export TCL_LIBRARY; \
682	./$(TCLSH) "$(ROOT_DIR)/tools/installData.tcl" \
683	    "$(ROOT_DIR)/library/msgs" "$(SCRIPT_INSTALL_DIR)/msgs"
684
685install-doc: doc
686
687# Optional target to install private headers
688install-private-headers: libraries
689	@for i in $(PRIVATE_INCLUDE_INSTALL_DIR); \
690	    do \
691	    if [ ! -d $$i ] ; then \
692		echo "Making directory $$i"; \
693		$(MKDIR) $$i; \
694		else true; \
695		fi; \
696	    done;
697	@echo "Installing private header files";
698	@for i in "$(GENERIC_DIR)/tclInt.h" "$(GENERIC_DIR)/tclIntDecls.h" \
699		"$(GENERIC_DIR)/tclIntPlatDecls.h" "$(GENERIC_DIR)/tclPort.h" \
700		"$(WIN_DIR)/tclWinPort.h" ; \
701	    do \
702	    $(COPY) "$$i" "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \
703	    done;
704
705# Specifying TESTFLAGS on the command line is the standard way to pass args to
706# tcltest, i.e.:
707#	% make test TESTFLAGS="-verbose bps -file fileName.test"
708
709test: binaries $(TCLTEST)
710	TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \
711	./$(TCLTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" $(TESTFLAGS) \
712	-load "package ifneeded dde 1.3.3 [list load [file normalize ${DDE_DLL_FILE}] dde]; \
713	package ifneeded registry 1.2.2 [list load [file normalize ${REG_DLL_FILE}] registry]" | ./$(CAT32)
714
715# Useful target to launch a built tcltest with the proper path,...
716runtest: binaries $(TCLTEST)
717	@TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \
718	./$(TCLTEST) $(TESTFLAGS) -load "package ifneeded dde 1.3.3 [list load [file normalize ${DDE_DLL_FILE}] dde]; \
719	package ifneeded registry 1.2.2 [list load [file normalize ${REG_DLL_FILE}] registry]" $(SCRIPT)
720
721# This target can be used to run tclsh from the build directory via
722# `make shell SCRIPT=foo.tcl`
723shell: binaries
724	@TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \
725	./$(TCLSH) $(SCRIPT)
726
727# This target can be used to run tclsh inside either gdb or insight
728gdb: binaries
729	@echo "set env TCL_LIBRARY=$(LIBRARY_DIR)" > gdb.run
730	gdb ./$(TCLSH) --command=gdb.run
731	rm gdb.run
732
733depend:
734
735Makefile: $(SRC_DIR)/Makefile.in
736	./config.status
737
738cleanhelp:
739	$(RM) *.hlp *.cnt *.GID *.rtf man2tcl.exe
740
741clean: cleanhelp
742	$(RM) *.lib *.a *.exp *.dll *.$(RES) *.${OBJEXT} *~ \#* TAGS a.out
743	$(RM) $(TCLSH) $(TCLTEST) $(CAT32)
744	$(RM) *.pch *.ilk *.pdb
745
746distclean: clean
747	$(RM) Makefile config.status config.cache config.log tclConfig.sh \
748		tcl.hpj config.status.lineno
749
750#
751# Regenerate the stubs files.
752#
753
754$(GENERIC_DIR)/tclStubInit.c: $(GENERIC_DIR)/tcl.decls \
755		$(GENERIC_DIR)/tclInt.decls
756	@echo "Warning: tclStubInit.c may be out of date."
757	@echo "Developers may want to run \"make genstubs\" to regenerate."
758	@echo "This warning can be safely ignored, do not report as a bug!"
759
760genstubs:
761	$(TCL_EXE) "$(ROOT_DIR_NATIVE)/tools/genStubs.tcl" \
762	    "$(GENERIC_DIR_NATIVE)" \
763	    "$(GENERIC_DIR_NATIVE)/tcl.decls" \
764            "$(GENERIC_DIR_NATIVE)/tclInt.decls" \
765	    "$(GENERIC_DIR_NATIVE)/tclTomMath.decls"
766
767#
768# The list of all the targets that do not correspond to real files. This stops
769# 'make' from getting confused when someone makes an error in a rule.
770#
771
772.PHONY: all tcltest binaries libraries doc gendate gentommath_h install
773.PHONY: install-binaries install-libraries install-tzdata install-msgs
774.PHONY: install-doc install-private-headers test test-tcl runtest shell
775.PHONY: gdb depend cleanhelp clean distclean packages install-packages
776.PHONY: test-packages clean-packages distclean-packages genstubs html
777.PHONY: html-tcl html-tk
778
779# DO NOT DELETE THIS LINE -- make depend depends on it.
780