1#
2# This file is a Makefile for Tk.  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
7TCLVERSION		= @TCL_VERSION@
8TCLPATCHL		= @TCL_PATCH_LEVEL@
9VERSION			= @TK_VERSION@
10PATCH_LEVEL		= @TK_PATCH_LEVEL@
11
12#--------------------------------------------------------------------------
13# Things you can change to personalize the Makefile for your own site (you can
14# make these changes in either Makefile.in or Makefile, but changes to
15# Makefile will get lost if you re-run the configuration script).
16#--------------------------------------------------------------------------
17
18# Default top-level directories in which to install architecture-specific
19# files (exec_prefix) and machine-independent files such as scripts (prefix).
20# The values specified here may be overridden at configure-time with the
21# --exec-prefix and --prefix options to the "configure" script.
22
23prefix			= @prefix@
24exec_prefix		= @exec_prefix@
25bindir			= @bindir@
26libdir			= @libdir@
27includedir		= @includedir@
28datarootdir		= @datarootdir@
29runstatedir		= @runstatedir@
30mandir			= @mandir@
31
32# The following definition can be set to non-null for special systems like AFS
33# with replication. It allows the pathnames used for installation to be
34# different than those used for actually reference files at run-time.
35# INSTALL_ROOT is prepended to $prefix and $exec_prefix when installing files.
36INSTALL_ROOT	=
37
38# Directory from which applications will reference the library of Tk scripts
39# (note: you can set the TK_LIBRARY environment variable at run-time to
40# override this value):
41TK_LIBRARY	= $(prefix)/lib/tk$(VERSION)
42
43# Path to use at runtime to refer to LIB_INSTALL_DIR:
44LIB_RUNTIME_DIR		= $(libdir)
45
46# Directory in which to install the program wish:
47BIN_INSTALL_DIR		= $(INSTALL_ROOT)$(bindir)
48
49# Directory in which to install the .a or .so binary for the Tk library:
50LIB_INSTALL_DIR		= $(INSTALL_ROOT)$(libdir)
51
52# Path name to use when installing library scripts:
53SCRIPT_INSTALL_DIR	= $(INSTALL_ROOT)$(TK_LIBRARY)
54
55# Directory in which to install the include file tk.h:
56INCLUDE_INSTALL_DIR	= $(INSTALL_ROOT)$(includedir)
57
58# Directory in which to (optionally) install the private tk headers:
59PRIVATE_INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir)
60
61# Top-level directory in which to install manual entries:
62MAN_INSTALL_DIR		= $(INSTALL_ROOT)$(mandir)
63
64# Directory in which to install manual entry for wish:
65MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1
66
67# Directory in which to install manual entries for Tk's C library
68# procedures:
69MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3
70
71# Directory in which to install manual entries for the built-in Tk commands:
72MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann
73
74# Directory in which to install the pkgIndex.tcl file for loadable Tk
75PKG_INSTALL_DIR		= $(LIB_INSTALL_DIR)/tk$(VERSION)
76
77# Package index file for loadable Tk
78PKG_INDEX		= $(PKG_INSTALL_DIR)/pkgIndex.tcl
79
80# The directory containing the Tcl source and header files.
81TCL_SRC_DIR		= @TCL_SRC_DIR@
82
83# The directory containing the Tcl library archive file appropriate
84# for this version of Tk:
85TCL_BIN_DIR		= @TCL_BIN_DIR@
86
87# The directory containing the Tcl sources and headers appropriate
88# for this version of Tk ("srcdir" will be replaced or has already
89# been replaced by the configure script):
90TCL_GENERIC_DIR		= @TCL_SRC_DIR@/generic
91
92# The directory containing the platform specific Tcl sources and headers
93# appropriate for this version of Tk:
94TCL_PLATFORM_DIR	= @TCL_SRC_DIR@/win
95
96TCL_TOOL_DIR		= @TCL_SRC_DIR@/tools
97
98SRC_DIR			= @srcdir@
99ROOT_DIR		= @srcdir@/..
100TOP_DIR			= $(shell cd @srcdir@/..; pwd -W 2>/dev/null || pwd -P)
101WIN_DIR			= $(TOP_DIR)/win
102UNIX_DIR		= $(TOP_DIR)/unix
103GENERIC_DIR		= $(TOP_DIR)/generic
104TTK_DIR			= $(GENERIC_DIR)/ttk
105BITMAP_DIR		= $(TOP_DIR)/bitmaps
106XLIB_DIR		= $(TOP_DIR)/xlib
107RC_DIR			= $(WIN_DIR)/rc
108
109# Converts a POSIX path to a Windows native path.
110CYGPATH			= @CYGPATH@
111
112# The name of the Tcl library.
113TCL_LIB_FILE	  = "$(shell $(CYGPATH) '@TCL_BIN_DIR@/@TCL_LIB_FILE@')"
114TCL_STUB_LIB_FILE = "$(shell $(CYGPATH) '@TCL_BIN_DIR@/@TCL_STUB_LIB_FILE@')"
115
116ROOT_DIR_NATIVE		= $(shell $(CYGPATH) '$(ROOT_DIR)')
117WIN_DIR_NATIVE		= $(shell $(CYGPATH) '$(WIN_DIR)')
118GENERIC_DIR_NATIVE	= $(shell $(CYGPATH) '$(GENERIC_DIR)')
119BITMAP_DIR_NATIVE	= $(shell $(CYGPATH) '$(ROOT_DIR)/bitmaps')
120XLIB_DIR_NATIVE	= $(shell $(CYGPATH) '$(ROOT_DIR)/xlib')
121RC_DIR_NATIVE	= $(shell $(CYGPATH) '$(ROOT_DIR)/rc')
122TCL_GENERIC_NATIVE		= $(shell $(CYGPATH) '$(TCL_GENERIC_DIR)')
123TCL_PLATFORM_NATIVE		= $(shell $(CYGPATH) '$(TCL_PLATFORM_DIR)')
124TCL_SRC_DIR_NATIVE		= $(shell $(CYGPATH) '$(TCL_SRC_DIR)')
125
126DLLSUFFIX		= @DLLSUFFIX@
127LIBSUFFIX		= @LIBSUFFIX@
128EXESUFFIX		= @EXESUFFIX@
129TCLVER			= @TCL_MAJOR_VERSION@@TCL_MINOR_VERSION@
130VER			= @TK_MAJOR_VERSION@@TK_MINOR_VERSION@
131DOTVER			= @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@
132
133TK_ZIP_FILE		= @TK_ZIP_FILE@
134TK_VFS_PATH		= libtk.vfs/tk_library
135TK_VFS_ROOT		= libtk.vfs
136
137TK_STUB_LIB_FILE	= @TK_STUB_LIB_FILE@
138TK_LIB_FILE		= @TK_LIB_FILE@
139TK_DLL_FILE		= @TK_DLL_FILE@
140TK_DLL_FILE_TCL8	= @TK_DLL_FILE_TCL8@
141TK_DLL_FILE_TCL9	= @TK_DLL_FILE_TCL9@
142TEST_DLL_FILE		= tktest$(VER)${DLLSUFFIX}
143TEST_LIB_FILE		= @LIBPREFIX@tktest$(VER)${DLLSUFFIX}${LIBSUFFIX}
144
145SHARED_LIBRARIES 	= $(TK_DLL_FILE) $(TK_STUB_LIB_FILE)
146STATIC_LIBRARIES	= $(TK_LIB_FILE)
147
148WISH			= wish$(VER)${EXESUFFIX}
149TKTEST			= tktest${EXESUFFIX}
150CAT32			= cat32${EXESUFFIX}
151MAN2TCL			= man2tcl${EXESUFFIX}
152
153@SET_MAKE@
154
155# Setting the VPATH variable to a list of paths will cause the
156# makefile to look into these paths when resolving .c to .obj
157# dependencies.
158
159VPATH = $(GENERIC_DIR):$(TTK_DIR):$(WIN_DIR):$(XLIB_DIR):$(RC_DIR)
160
161# warning flags
162CFLAGS_WARNING	= @CFLAGS_WARNING@
163
164# The default switches for optimization or debugging
165CFLAGS_DEBUG    = @CFLAGS_DEBUG@
166CFLAGS_OPTIMIZE	= @CFLAGS_OPTIMIZE@
167
168# The default switches for optimization or debugging
169LDFLAGS_DEBUG    = @LDFLAGS_DEBUG@
170LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@
171
172# To change the compiler switches, for example to change from optimization to
173# debugging symbols, change the following line:
174#CFLAGS		= $(CFLAGS_DEBUG)
175#CFLAGS		= $(CFLAGS_OPTIMIZE)
176#CFLAGS		= $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE)
177CFLAGS		= @CFLAGS@ @CFLAGS_DEFAULT@ -D_ATL_XP_TARGETING=1 -D__USE_MINGW_ANSI_STDIO=0
178
179# Special compiler flags to use when building man2tcl on Windows.
180MAN2TCLFLAGS	= @MAN2TCLFLAGS@
181
182AR		= @AR@
183RANLIB		= @RANLIB@
184CC		= @CC@
185RC		= @RC@
186RES		= @RES@
187TK_RES		= @TK_RES@
188AC_FLAGS	= @EXTRA_CFLAGS@ @DEFS@
189CPPFLAGS	= @CPPFLAGS@
190LDFLAGS		= @LDFLAGS@ @LDFLAGS_DEFAULT@
191LDFLAGS_CONSOLE	= @LDFLAGS_CONSOLE@
192LDFLAGS_WINDOW	= @LDFLAGS_WINDOW@
193OBJEXT		= @OBJEXT@
194STLIB_LD	= @STLIB_LD@
195SHLIB_LD	= @SHLIB_LD@
196SHLIB_LD_LIBS	= @SHLIB_LD_LIBS@
197SHLIB_CFLAGS	= @SHLIB_CFLAGS@
198SHLIB_SUFFIX	= @SHLIB_SUFFIX@
199LIBS		= $(TCL_STUB_LIB_FILE) @LIBS@ @LIBS_GUI@
200RMDIR		= rm -rf
201MKDIR		= mkdir -p
202SHELL		= @SHELL@
203RM		= rm -f
204COPY		= cp
205LN		= ln
206
207# Tk does not used deprecated Tcl constructs so it should
208# compile fine with -DTCL_NO_DEPRECATED. To remove its own
209# set of deprecated code uncomment the second line.
210NO_DEPRECATED_FLAGS	= -DTCL_NO_DEPRECATED
211#NO_DEPRECATED_FLAGS	= -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED
212
213# TCL_EXE is the name of a tclsh executable that is available *BEFORE*
214# running make for the first time. Certain build targets (make genstubs)
215# need it to be available on the PATH. This executable should *NOT* be
216# required just to do a normal build although it can be required to run
217# make dist.
218TCL_EXE			= @TCLSH_PROG@
219WINE    		= @WINE@
220
221###
222# Tip 430 - ZipFS Modifications
223###
224
225TK_ZIP_FILE		= @TK_ZIP_FILE@
226TK_VFS_PATH		= libtk.vfs/tk_library
227TK_VFS_ROOT		= libtk.vfs
228
229HOST_CC		        = @CC_FOR_BUILD@
230HOST_EXEEXT             = @EXEEXT_FOR_BUILD@
231HOST_OBJEXT             = @OBJEXT_FOR_BUILD@
232ZIPFS_BUILD	        = @ZIPFS_BUILD@
233NATIVE_ZIP		= @ZIP_PROG@
234ZIP_PROG_OPTIONS		= @ZIP_PROG_OPTIONS@
235ZIP_PROG_VFSSEARCH  = @ZIP_PROG_VFSSEARCH@
236SHARED_BUILD		= @SHARED_BUILD@
237INSTALL_MSGS            = @INSTALL_MSGS@
238INSTALL_LIBRARIES       = @INSTALL_LIBRARIES@
239
240# Minizip
241MINIZIP_OBJS = \
242        adler32.$(HOST_OBJEXT) \
243        compress.$(HOST_OBJEXT) \
244        crc32.$(HOST_OBJEXT) \
245        deflate.$(HOST_OBJEXT) \
246        infback.$(HOST_OBJEXT) \
247        inffast.$(HOST_OBJEXT) \
248        inflate.$(HOST_OBJEXT) \
249        inftrees.$(HOST_OBJEXT) \
250        ioapi.$(HOST_OBJEXT) \
251        iowin32.$(HOST_OBJEXT)  \
252        trees.$(HOST_OBJEXT) \
253        uncompr.$(HOST_OBJEXT) \
254        zip.$(HOST_OBJEXT) \
255        zutil.$(HOST_OBJEXT) \
256        minizip.$(HOST_OBJEXT)
257
258ZIP_INSTALL_OBJS =  @ZIP_INSTALL_OBJS@
259
260CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
261-I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \
262-I"${XLIB_DIR_NATIVE}" -I"${BITMAP_DIR_NATIVE}" \
263-I"${TCL_GENERIC_NATIVE}" -I"${TCL_PLATFORM_NATIVE}" \
264${AC_FLAGS} $(NO_DEPRECATED_FLAGS) -DUSE_TCL_STUBS
265
266CC_OBJNAME = @CC_OBJNAME@
267CC_EXENAME = @CC_EXENAME@
268
269# Tk used to let the configure script choose which program to use
270# for installing, but there are just too many different versions of
271# "install" around;  better to use the install-sh script that comes
272# with the distribution, which is slower but guaranteed to work.
273
274INSTALL		= cp
275INSTALL_PROGRAM = ${INSTALL}
276INSTALL_DATA	= ${INSTALL}
277
278WISH_OBJS = \
279	winMain.$(OBJEXT)
280
281TKTEST_OBJS = \
282	tkSquare.$(OBJEXT) \
283	tkTest.$(OBJEXT) \
284	tkOldTest.$(OBJEXT) \
285	tkWinTest.$(OBJEXT)
286
287XLIB_OBJS = \
288	xcolors.$(OBJEXT) \
289	xdraw.$(OBJEXT) \
290	xgc.$(OBJEXT) \
291	ximage.$(OBJEXT) \
292	xutil.$(OBJEXT)
293
294TK_OBJS = \
295	tkConsole.$(OBJEXT) \
296	tkUnixMenubu.$(OBJEXT) \
297	tkUnixScale.$(OBJEXT) \
298	$(XLIB_OBJS) \
299	tkWin3d.$(OBJEXT) \
300	tkWin32Dll.$(OBJEXT) \
301	tkWinButton.$(OBJEXT) \
302	tkWinClipboard.$(OBJEXT) \
303	tkWinColor.$(OBJEXT) \
304	tkWinConfig.$(OBJEXT) \
305	tkWinCursor.$(OBJEXT) \
306	tkWinDialog.$(OBJEXT) \
307	tkWinDraw.$(OBJEXT) \
308	tkWinEmbed.$(OBJEXT) \
309	tkWinFont.$(OBJEXT) \
310	tkWinIco.$(OBJEXT) \
311	tkWinImage.$(OBJEXT) \
312	tkWinInit.$(OBJEXT) \
313	tkWinKey.$(OBJEXT) \
314	tkWinMenu.$(OBJEXT) \
315	tkWinPixmap.$(OBJEXT) \
316	tkWinPointer.$(OBJEXT) \
317	tkWinRegion.$(OBJEXT) \
318	tkWinScrlbr.$(OBJEXT) \
319	tkWinSend.$(OBJEXT) \
320	tkWinSendCom.$(OBJEXT) \
321	tkWinSysTray.$(OBJEXT) \
322	tkWinWindow.$(OBJEXT) \
323	tkWinWm.$(OBJEXT) \
324	tkWinX.$(OBJEXT) \
325	stubs.$(OBJEXT) \
326	tk3d.$(OBJEXT) \
327	tkArgv.$(OBJEXT) \
328	tkAtom.$(OBJEXT) \
329	tkBind.$(OBJEXT) \
330	tkBitmap.$(OBJEXT) \
331	tkBusy.$(OBJEXT) \
332	tkButton.$(OBJEXT) \
333	tkCanvArc.$(OBJEXT) \
334	tkCanvBmap.$(OBJEXT) \
335	tkCanvImg.$(OBJEXT) \
336	tkCanvLine.$(OBJEXT) \
337	tkCanvPoly.$(OBJEXT) \
338	tkCanvPs.$(OBJEXT) \
339	tkCanvText.$(OBJEXT) \
340	tkCanvUtil.$(OBJEXT) \
341	tkCanvWind.$(OBJEXT) \
342	tkCanvas.$(OBJEXT) \
343	tkClipboard.$(OBJEXT) \
344	tkCmds.$(OBJEXT) \
345	tkColor.$(OBJEXT) \
346	tkConfig.$(OBJEXT) \
347	tkCursor.$(OBJEXT) \
348	tkEntry.$(OBJEXT) \
349	tkError.$(OBJEXT) \
350	tkEvent.$(OBJEXT) \
351	tkFileFilter.$(OBJEXT) \
352	tkFocus.$(OBJEXT) \
353	tkFont.$(OBJEXT) \
354	tkFrame.$(OBJEXT) \
355	tkGC.$(OBJEXT) \
356	tkGeometry.$(OBJEXT) \
357	tkGet.$(OBJEXT) \
358	tkGrab.$(OBJEXT) \
359	tkGrid.$(OBJEXT) \
360	tkImage.$(OBJEXT) \
361	tkImgBmap.$(OBJEXT) \
362	tkImgListFormat.$(OBJEXT) \
363	tkImgGIF.$(OBJEXT) \
364	tkImgPNG.$(OBJEXT) \
365	tkImgPPM.$(OBJEXT) \
366	tkImgSVGnano.$(OBJEXT) \
367	tkImgPhoto.$(OBJEXT) \
368	tkImgPhInstance.$(OBJEXT) \
369	tkImgUtil.$(OBJEXT) \
370	tkListbox.$(OBJEXT) \
371	tkMacWinMenu.$(OBJEXT) \
372	tkMain.$(OBJEXT) \
373	tkMain2.$(OBJEXT) \
374	tkMenu.$(OBJEXT) \
375	tkMenubutton.$(OBJEXT) \
376	tkMenuDraw.$(OBJEXT) \
377	tkMessage.$(OBJEXT) \
378	tkPanedWindow.$(OBJEXT) \
379	tkObj.$(OBJEXT) \
380	tkOldConfig.$(OBJEXT) \
381	tkOption.$(OBJEXT) \
382	tkPack.$(OBJEXT) \
383	tkPkgConfig.$(OBJEXT) \
384	tkPlace.$(OBJEXT) \
385	tkPointer.$(OBJEXT) \
386	tkRectOval.$(OBJEXT) \
387	tkScale.$(OBJEXT) \
388	tkScrollbar.$(OBJEXT) \
389	tkSelect.$(OBJEXT) \
390	tkStyle.$(OBJEXT) \
391	tkText.$(OBJEXT) \
392	tkTextBTree.$(OBJEXT) \
393	tkTextDisp.$(OBJEXT) \
394	tkTextImage.$(OBJEXT) \
395	tkTextIndex.$(OBJEXT) \
396	tkTextMark.$(OBJEXT) \
397	tkTextTag.$(OBJEXT) \
398	tkTextWind.$(OBJEXT) \
399	tkTrig.$(OBJEXT) \
400	tkUndo.$(OBJEXT) \
401	tkUtil.$(OBJEXT) \
402	tkVisual.$(OBJEXT) \
403	tkStubInit.$(OBJEXT) \
404	tkWindow.$(OBJEXT) \
405	$(TTK_OBJS)
406
407TTK_OBJS = \
408	ttkWinMonitor.$(OBJEXT) \
409	ttkWinTheme.$(OBJEXT) \
410	ttkWinXPTheme.$(OBJEXT) \
411	ttkBlink.$(OBJEXT) \
412	ttkButton.$(OBJEXT) \
413	ttkCache.$(OBJEXT) \
414	ttkClamTheme.$(OBJEXT) \
415	ttkClassicTheme.$(OBJEXT) \
416	ttkDefaultTheme.$(OBJEXT) \
417	ttkElements.$(OBJEXT) \
418	ttkEntry.$(OBJEXT) \
419	ttkFrame.$(OBJEXT) \
420	ttkImage.$(OBJEXT) \
421	ttkInit.$(OBJEXT) \
422	ttkLabel.$(OBJEXT) \
423	ttkLayout.$(OBJEXT) \
424	ttkManager.$(OBJEXT) \
425	ttkNotebook.$(OBJEXT) \
426	ttkPanedwindow.$(OBJEXT) \
427	ttkProgress.$(OBJEXT) \
428	ttkScale.$(OBJEXT) \
429	ttkScrollbar.$(OBJEXT) \
430	ttkScroll.$(OBJEXT) \
431	ttkSeparator.$(OBJEXT) \
432	ttkSquare.$(OBJEXT) \
433	ttkState.$(OBJEXT) \
434	ttkTagSet.$(OBJEXT) \
435	ttkTheme.$(OBJEXT) \
436	ttkTrace.$(OBJEXT) \
437	ttkTrack.$(OBJEXT) \
438	ttkTreeview.$(OBJEXT) \
439	ttkWidget.$(OBJEXT) \
440	ttkStubInit.$(OBJEXT)
441
442STUB_OBJS = \
443	tkStubLib.$(OBJEXT) \
444	ttkStubLib.$(OBJEXT)
445
446TCL_DOCS = "$(TCL_SRC_DIR_NATIVE)/doc/*.[13n]"
447TK_DOCS = "$(ROOT_DIR_NATIVE)/doc/*.[13n]"
448CORE_DOCS = $(TCL_DOCS) $(TK_DOCS)
449
450DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget
451
452SHELL_ENV = \
453	@TCL_LIBRARY="$(TCL_SRC_DIR_NATIVE)/library"; export TCL_LIBRARY; \
454	TK_LIBRARY="$(ROOT_DIR_NATIVE)/library"; export TK_LIBRARY; \
455	PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH;
456
457# Main targets.  The default target -- all -- builds the binaries,
458# performs any post processing on libraries or documents.
459
460all: binaries libraries doc
461
462binaries: @LIBRARIES@ $(WISH)
463
464libraries:
465
466$(ROOT_DIR)/doc/man.macros:
467	$(INSTALL_DATA) "$(TCL_SRC_DIR)/doc/man.macros" "$(ROOT_DIR)/doc/man.macros"
468
469doc: $(ROOT_DIR)/doc/man.macros
470
471winhelp: $(TCL_SRC_DIR)/tools/man2help.tcl $(MAN2TCL)
472	$(TCL_EXE) "$(TCL_SRC_DIR_NATIVE)/tools/man2help.tcl" tcl "$(VER)" $(CORE_DOCS)
473	$(COPY) "$(TCL_BIN_DIR)/tcl.hpj" ./
474	hcw /c /e tcl.hpj
475	$(COPY) ./tcl$(VER).cnt ./TCL$(VER).HLP "$(TCL_SRC_DIR_NATIVE)/tools/"
476
477$(MAN2TCL): $(TCL_SRC_DIR)/tools/man2tcl.c
478	$(CC) $(CFLAGS_OPTIMIZE) $(MAN2TCLFLAGS) -o $(MAN2TCL) "$(TCL_SRC_DIR_NATIVE)/tools/man2tcl.c"
479
480# Specifying TESTFLAGS on the command line is the standard way to pass
481# args to tcltest, ie:
482#	% make test TESTFLAGS="-verbose bps -file fileName.test"
483
484test: test-classic test-ttk
485
486test-classic: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32)
487	$(SHELL_ENV) $(WINE) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" \
488	$(TESTFLAGS) | $(WINE) ./$(CAT32)
489
490test-ttk: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32)
491	$(SHELL_ENV) $(WINE) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/ttk/all.tcl" \
492	$(TESTFLAGS) | $(WINE) ./$(CAT32)
493
494runtest: binaries $(TKTEST) $(TEST_DLL_FILE)
495	$(SHELL_ENV) $(WINE) ./$(TKTEST) $(TESTFLAGS) $(SCRIPT)
496
497# This target can be used to run wish from the build directory
498# via `make shell` or `make shell SCRIPT=foo.tcl`
499shell: binaries
500	$(SHELL_ENV) $(WINE) ./$(WISH) $(SCRIPT)
501
502demo: $(WISH)
503	$(SHELL_ENV) $(WINE) ./$(WISH) $(ROOT_DIR)/library/demos/widget
504
505# This target can be used to run wish inside either gdb or insight
506gdb: binaries
507	@echo "set env TCL_LIBRARY=$(TCL_SRC_DIR_NATIVE)/library" > gdb.run
508	@echo "set env TK_LIBRARY=$(ROOT_DIR_NATIVE)/library" >> gdb.run
509	PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH; \
510	gdb ./$(WISH) --command=gdb.run
511	@$(RM) gdb.run
512
513install: all install-binaries install-libraries install-doc install-demos
514
515install-binaries: binaries
516	@for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) $(PKG_INSTALL_DIR); \
517	    do \
518	    if [ ! -d $$i ] ; then \
519		echo "Making directory $$i"; \
520		$(MKDIR) $$i; \
521		chmod 755 $$i; \
522		else true; \
523		fi; \
524	    done;
525	@for i in $(TK_DLL_FILE) $(WISH); \
526	    do \
527	    if [ -f $$i ]; then \
528		echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \
529		$(COPY) $$i "$(BIN_INSTALL_DIR)"; \
530	    fi; \
531	    done
532	@echo "Creating package index $(PKG_INDEX)";
533	@$(RM) $(PKG_INDEX);
534	@(\
535	echo "if {![package vsatisfies [package provide Tcl] 8.6-]} return";\
536	echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\
537	echo "	|| ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\
538	echo "    if {[package vsatisfies [package provide Tcl] 9.0]} {";\
539	echo "	package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtcl9tk$(VERSION).dll]]]";\
540	echo "    } else {";\
541	echo "	package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]]]";\
542	echo "    }";\
543	echo "} else {";\
544	echo "    if {[package vsatisfies [package provide Tcl] 9.0]} {";\
545	echo "	package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE_TCL9)]]]";\
546	echo "    } else {";\
547	echo "	package ifneeded tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE_TCL8)]]]";\
548	echo "    }";\
549	echo "}";\
550	echo "package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list package require -exact tk $(VERSION)$(PATCH_LEVEL)]";\
551	) > $(PKG_INDEX);
552	@for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \
553	    do \
554	    if [ -f $$i ]; then \
555		echo "Installing $$i to $(LIB_INSTALL_DIR)/"; \
556		$(COPY) $$i "$(LIB_INSTALL_DIR)"; \
557	    fi; \
558	    done
559
560install-libraries: libraries
561	@for i in "$$($(CYGPATH) $(prefix)/lib)" \
562		"$(INCLUDE_INSTALL_DIR)" "$(INCLUDE_INSTALL_DIR)/X11" \
563		"$(SCRIPT_INSTALL_DIR)" "$(SCRIPT_INSTALL_DIR)/images" \
564		"$(SCRIPT_INSTALL_DIR)/msgs" "$(SCRIPT_INSTALL_DIR)/ttk"; \
565	    do \
566	    if [ ! -d $$i ] ; then \
567		echo "Making directory $$i"; \
568		$(MKDIR) $$i; \
569		chmod 755 $$i; \
570		else true; \
571		fi; \
572	    done;
573	@echo "Installing header files to $(INCLUDE_INSTALL_DIR)/";
574	@for i in "$(GENERIC_DIR)/tk.h" "$(GENERIC_DIR)/tkPlatDecls.h" \
575		"$(GENERIC_DIR)/tkIntXlibDecls.h" "$(GENERIC_DIR)/tkDecls.h" ; \
576	    do \
577	    $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR); \
578	    done;
579	@for i in $(XLIB_DIR)/X11/*.h; \
580	    do \
581	    $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR)/X11; \
582	    done;
583	@echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
584	@for i in $(ROOT_DIR)/library/*.tcl $(ROOT_DIR)/library/tclIndex \
585		$(UNIX_DIR)/tkAppInit.c; \
586	    do \
587	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
588	    done;
589	@echo "Installing library ttk directory";
590	@for i in $(ROOT_DIR)/library/ttk/*.tcl; \
591	    do \
592	    if [ -f $$i ] ; then \
593		$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/ttk; \
594	    fi; \
595	    done;
596	@echo "Installing library images directory";
597	@for i in $(ROOT_DIR)/library/images/*; \
598	    do \
599	    if [ -f $$i ] ; then \
600		$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/images; \
601	    fi; \
602	    done;
603	@echo "Installing translation directory";
604	@for i in $(ROOT_DIR)/library/msgs/*.msg; \
605	    do \
606	    if [ -f $$i ] ; then \
607		$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/msgs; \
608	    fi; \
609	    done;
610
611install-demos:
612	@for i in $(INSTALL_ROOT)$(prefix)/lib $(SCRIPT_INSTALL_DIR) \
613		$(SCRIPT_INSTALL_DIR)/demos \
614		$(SCRIPT_INSTALL_DIR)/demos/images ; \
615	    do \
616	    if [ ! -d $$i ] ; then \
617		echo "Making directory $$i"; \
618		$(MKDIR) $$i; \
619		chmod 755 $$i; \
620		else true; \
621		fi; \
622	    done;
623	@echo "Installing demos to $(SCRIPT_INSTALL_DIR)/demos/";
624	@for i in $(ROOT_DIR)/library/demos/*; \
625	    do \
626	    if [ -f $$i ] ; then \
627		sed -e '3 s|exec wish|exec wish$(VER)|' \
628			$$i > $(SCRIPT_INSTALL_DIR)/demos/`basename $$i`; \
629	    fi; \
630	    done;
631	@for i in $(DEMOPROGS); \
632	    do \
633	    if test $$i = "square"; then \
634	    rm -f  $(SCRIPT_INSTALL_DIR)/demos/$$i; \
635	    else \
636	    chmod 755 $(SCRIPT_INSTALL_DIR)/demos/$$i; \
637	    fi; \
638	    done;
639	@echo "Installing demo images";
640	@for i in $(ROOT_DIR)/library/demos/images/*; \
641	    do \
642	    if [ -f $$i ] ; then \
643		$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/images; \
644		fi; \
645	    done;
646
647install-doc: doc
648
649# Optional target to install private headers
650install-private-headers: libraries
651	@for i in $(PRIVATE_INCLUDE_INSTALL_DIR); \
652	    do \
653	    if [ ! -d $$i ] ; then \
654		echo "Making directory $$i"; \
655		$(MKDIR) $$i; \
656		chmod 755 $$i; \
657		else true; \
658		fi; \
659	    done;
660	@echo "Installing private header files to $(PRIVATE_INCLUDE_INSTALL_DIR)/";
661	@for i in "$(GENERIC_DIR)/tkInt.h" "$(GENERIC_DIR)/tkIntDecls.h" \
662		"$(GENERIC_DIR)/tkIntPlatDecls.h" "$(GENERIC_DIR)/tkPort.h" \
663		"$(WIN_DIR)/tkWinPort.h" "$(WIN_DIR)/tkWinInt.h" "$(WIN_DIR)/tkWin.h"; \
664	    do \
665	    $(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \
666	    done;
667
668$(WISH): $(WISH_OBJS) @LIBRARIES@ $(TK_STUB_LIB_FILE) wish.$(RES) ${TK_ZIP_FILE}
669	$(CC) $(CFLAGS) $(WISH_OBJS) $(TK_LIB_FILE) \
670	$(TK_STUB_LIB_FILE) $(TCL_LIB_FILE) $(LIBS) \
671	wish.$(RES) $(CC_EXENAME) $(LDFLAGS_WINDOW)
672	@VC_MANIFEST_EMBED_EXE@
673	@if test "${ZIPFS_BUILD}" = "2" ; then \
674		cat ${TK_ZIP_FILE} >> ${WISH}; \
675		${NATIVE_ZIP} -A ${WISH} \
676		  || echo 'ignore zip-error by adjust sfx process (not executable?)'; \
677	fi
678
679tktest: $(TKTEST)
680
681$(TKTEST): testMain.$(OBJEXT) $(TEST_DLL_FILE) @LIBRARIES@ $(TK_STUB_LIB_FILE) wish.$(RES)
682	$(CC) $(CFLAGS) testMain.$(OBJEXT) $(TEST_LIB_FILE) $(TK_LIB_FILE) \
683	$(TK_STUB_LIB_FILE) $(TCL_LIB_FILE) $(LIBS) \
684	wish.$(RES) $(CC_EXENAME) $(LDFLAGS_WINDOW)
685	@VC_MANIFEST_EMBED_EXE@
686
687${TEST_DLL_FILE}: ${TKTEST_OBJS} ${TK_STUB_LIB_FILE}
688	@MAKE_DLL@ ${TKTEST_OBJS} $(TK_STUB_LIB_FILE) $(SHLIB_LD_LIBS)
689
690# Msys make requires this next rule for some reason.
691$(TCL_SRC_DIR)/win/cat.c:
692
693cat32.${OBJEXT}: $(TCL_SRC_DIR)/win/cat.c
694	$(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE "$(TCL_SRC_DIR)/win/cat.c" $(CC_OBJNAME)
695
696$(CAT32): cat32.${OBJEXT}
697	$(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE)
698
699tkzipfile: ${TK_ZIP_FILE}
700
701${TK_ZIP_FILE}:  ${ZIP_INSTALL_OBJS}
702	@$(RMDIR) ${TK_VFS_ROOT}
703	@mkdir -p ${TK_VFS_PATH}
704	@echo "creating ${TK_VFS_PATH} (prepare compression)"
705	@( \
706	  $(COPY) -a $(TOP_DIR)/library/* ${TK_VFS_PATH}; \
707	)
708	@$(RMDIR) $(TK_VFS_PATH)/demos
709	-@if test "${ZIPFS_BUILD}" = "2" ; then \
710	    cp ${TCL_BIN_DIR}/tclsh${TCLVER}s.exe ${TK_VFS_ROOT}/../${TK_ZIP_FILE} || cp ${TCL_BIN_DIR}/../bin/tclsh${TCLVER}s.exe ${TK_VFS_ROOT}/../${TK_ZIP_FILE}; \
711	    (zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \
712		(echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \
713		cd ${TK_VFS_ROOT} && $$zip -J ../${TK_ZIP_FILE}) \
714	fi
715	(zip=`(realpath '${NATIVE_ZIP}' || readlink -m '${NATIVE_ZIP}') 2>/dev/null || \
716	  (echo '${NATIVE_ZIP}' | sed "s?^\./?$$(pwd)/?")`; \
717	  cd ${TK_VFS_ROOT} && \
718	  $$zip ${ZIP_PROG_OPTIONS} ../${TK_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} >/dev/null && \
719	  echo "${TK_ZIP_FILE} successful created with $$zip" && \
720	  cd ..)
721
722
723# The following targets are configured by autoconf to generate either
724# a shared library or static library
725
726${TK_STUB_LIB_FILE}: ${STUB_OBJS}
727	@$(RM) ${TK_STUB_LIB_FILE}
728	@MAKE_STUB_LIB@ ${STUB_OBJS}
729	@POST_MAKE_LIB@
730
731${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES) ${TK_ZIP_FILE}
732	@$(RM) ${TK_DLL_FILE}
733	@MAKE_DLL@ ${TK_OBJS} $(TK_RES) $(SHLIB_LD_LIBS)
734	@VC_MANIFEST_EMBED_DLL@
735	@if test "${ZIPFS_BUILD}" = "1" ; then \
736		cat ${TK_ZIP_FILE} >> ${TK_DLL_FILE}; \
737		${NATIVE_ZIP} -A ${TK_DLL_FILE} \
738		  || echo 'ignore zip-error by adjust sfx process (not executable?)'; \
739	fi
740
741${TK_LIB_FILE}: ${TK_OBJS}
742	@$(RM) ${TK_LIB_FILE}
743	@MAKE_LIB@ ${TK_OBJS}
744	@POST_MAKE_LIB@
745
746# Special case object file targets
747
748winMain.$(OBJEXT): winMain.c
749	$(CC) -c $(CC_SWITCHES) -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME)
750
751testMain.$(OBJEXT): winMain.c
752	$(CC) -c $(CC_SWITCHES) -DTK_TEST -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME)
753
754tkTest.$(OBJEXT): tkTest.c
755	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
756
757tkOldTest.$(OBJEXT): tkOldTest.c
758	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
759
760tkWinTest.$(OBJEXT): tkWinTest.c
761	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
762
763tkSquare.$(OBJEXT): tkSquare.c
764	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
765
766tkStubLib.$(OBJEXT): tkStubLib.c
767	$(CC) -c $(CC_SWITCHES) @CFLAGS_NOLTO@ @DEPARG@ $(CC_OBJNAME)
768
769ttkStubLib.$(OBJEXT): ${TTK_DIR}/ttkStubLib.c
770	$(CC) -c $(CC_SWITCHES) @CFLAGS_NOLTO@ @DEPARG@ $(CC_OBJNAME)
771
772tkMain2.$(OBJEXT): tkMain.c
773	$(CC) -c $(CC_SWITCHES) -DBUILD_tk -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME)
774
775tkUnixMenubu.$(OBJEXT): ${UNIX_DIR}/tkUnixMenubu.c
776	$(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME)
777
778tkUnixScale.$(OBJEXT): ${UNIX_DIR}/tkUnixScale.c
779	$(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME)
780
781tkPkgConfig.$(OBJEXT): $(GENERIC_DIR)/tkPkgConfig.c
782	$(CC) -c $(CC_SWITCHES)	 -DBUILD_tk -DBUILD_ttk		\
783		-DCFG_RUNTIME_DLLFILE="\"$(TK_DLL_FILE)\"" \
784		@DEPARG@ $(CC_OBJNAME)
785
786
787# Extra dependency info
788tkConsole.$(OBJEXT): configure Makefile
789tkMain.$(OBJEXT): configure Makefile
790tkMain2.$(OBJEXT): configure Makefile
791tkWindow.$(OBJEXT): configure Makefile
792
793# Add the object extension to the implicit rules.  By default .obj is not
794# automatically added.
795
796.SUFFIXES: .${OBJEXT}
797.SUFFIXES: .$(RES)
798.SUFFIXES: .rc
799
800# Implicit rule for all object files that will end up in the Tk library
801
802%.$(OBJEXT): %.c
803	$(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME)
804
805.rc.$(RES):
806	$(RC) @RC_OUT@ $@ @RC_TYPE@ @RC_DEFINES@ @RC_INCLUDE@ "$(GENERIC_DIR_NATIVE)" @RC_INCLUDE@ "$(TCL_GENERIC_NATIVE)" @RC_INCLUDE@ "$(RC_DIR_NATIVE)" @DEPARG@
807
808depend:
809
810cleanhelp:
811	$(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl.exe
812
813clean: cleanhelp
814	$(RM) *.lib *.a *.exp *.dll *.res *.${OBJEXT} *~ \#* TAGS a.out
815	$(RM) $(WISH) $(TKTEST) $(CAT32)
816	$(RM) *.pch *.ilk *.pdb *.zip
817	$(RMDIR) *.vfs
818
819distclean: clean
820	$(RM) Makefile config.status config.cache config.log tkConfig.sh \
821		wish.exe.manifest
822
823Makefile: $(SRC_DIR)/Makefile.in
824	./config.status
825
826#
827# Regenerate the stubs files.
828#
829
830$(GENERIC_DIR)/tkStubInit.c: $(GENERIC_DIR)/tk.decls \
831		$(GENERIC_DIR)/tkInt.decls
832	@echo "Warning: tkStubInit.c may be out of date."
833	@echo "Developers may want to run \"make genstubs\" to regenerate."
834	@echo "This warning can be safely ignored, do not report as a bug!"
835
836genstubs:
837	$(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \
838	    "$(GENERIC_DIR_NATIVE)" \
839	    "$(GENERIC_DIR_NATIVE)/tk.decls" \
840	    "$(GENERIC_DIR_NATIVE)/tkInt.decls"
841	$(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \
842	    "$(TTK_DIR)" \
843	    "$(TTK_DIR)/ttk.decls"
844
845#
846# The list of all the targets that do not correspond to real files. This stops
847# 'make' from getting confused when someone makes an error in a rule.
848#
849
850.PHONY: all binaries libraries doc tkLibObjs objs tktest-real test test-classic
851.PHONY: test-ttk testlang runtest shell demo gdb install install-strip
852.PHONY: install-binaries install-libraries install-demos install-doc
853.PHONY: install-private-headers clean distclean depend genstubs checkstubs
854.PHONY: checkuchar checkexports rpm dist alldist allpatch html html-tcl html-tk
855
856# DO NOT DELETE THIS LINE -- make depend depends on it.
857