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