summaryrefslogtreecommitdiffstats
path: root/win/Makefile.in
blob: 632e2165190dd0c9e5a7b375452795d1a2d77374 (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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
# This file is a Makefile for Tk.  If it has the name "Makefile.in"
# then it is a template for a Makefile;  to generate the actual Makefile,
# run "./configure", which is a configuration script generated by the
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.

VERSION			= @TK_VERSION@
PATCH_LEVEL		= @TK_PATCH_LEVEL@

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
# site (you can make these changes in either Makefile.in or
# Makefile, but changes to Makefile will get lost if you re-run
# the configuration script).
#----------------------------------------------------------------

# Default top-level directories in which to install architecture-
# specific files (exec_prefix) and machine-independent files such
# as scripts (prefix).  The values specified here may be overridden
# at configure-time with the --exec-prefix and --prefix options
# to the "configure" script.

prefix			= @prefix@
exec_prefix		= @exec_prefix@
bindir			= @bindir@
libdir			= @libdir@
includedir		= @includedir@
mandir			= @mandir@

# The following definition can be set to non-null for special systems
# like AFS with replication.  It allows the pathnames used for installation
# to be different than those used for actually reference files at
# run-time.  INSTALL_ROOT is prepended to $prefix and $exec_prefix
# when installing files.
INSTALL_ROOT		=

# Directory from which applications will reference the library of Tk
# scripts (note: you can set the TK_LIBRARY environment variable at
# run-time to override this value):
TK_LIBRARY		= $(prefix)/lib/tk$(VERSION)

# Path to use at runtime to refer to LIB_INSTALL_DIR:
LIB_RUNTIME_DIR		= $(libdir)

# Directory in which to install the program wish:
BIN_INSTALL_DIR		= $(INSTALL_ROOT)$(bindir)

# Directory in which to install the .a or .so binary for the Tk library:
LIB_INSTALL_DIR		= $(INSTALL_ROOT)$(libdir)

# Path name to use when installing library scripts:
SCRIPT_INSTALL_DIR	= $(INSTALL_ROOT)$(TK_LIBRARY)

# Directory in which to install the include file tk.h:
INCLUDE_INSTALL_DIR	= $(INSTALL_ROOT)$(includedir)

# Directory in which to (optionally) install the private tk headers:
PRIVATE_INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir)

# Top-level directory for manual entries:
MAN_INSTALL_DIR		= $(INSTALL_ROOT)$(mandir)

# Directory in which to install manual entry for wish:
MAN1_INSTALL_DIR	= $(MAN_INSTALL_DIR)/man1

# Directory in which to install manual entries for Tk's C library
# procedures:
MAN3_INSTALL_DIR	= $(MAN_INSTALL_DIR)/man3

# Directory in which to install manual entries for the built-in
# Tk commands:
MANN_INSTALL_DIR	= $(MAN_INSTALL_DIR)/mann

# Libraries built with optimization switches have this additional extension
TK_DBGX			= @TK_DBGX@

# Directory in which to install the pkgIndex.tcl file for loadable Tk
PKG_INSTALL_DIR		= $(LIB_INSTALL_DIR)/tk$(VERSION)$(TK_DBGX)

# Package index file for loadable Tk
PKG_INDEX		= $(PKG_INSTALL_DIR)/pkgIndex.tcl

# The directory containing the Tcl source and header files.
TCL_SRC_DIR		= @TCL_SRC_DIR@

# The directory containing the Tcl library archive file appropriate
# for this version of Tk:
TCL_BIN_DIR		= @TCL_BIN_DIR@

# The directory containing the Tcl sources and headers appropriate
# for this version of Tk ("srcdir" will be replaced or has already
# been replaced by the configure script):
TCL_GENERIC_DIR		= @TCL_SRC_DIR@/generic

# The directory containing the platform specific Tcl sources and headers
# appropriate for this version of Tk:
TCL_PLATFORM_DIR	= @TCL_SRC_DIR@/win

TCL_TOOL_DIR		= @TCL_SRC_DIR@/tools

# Converts a POSIX path to a Windows native path.
CYGPATH			= @CYGPATH@

# The name of the Tcl library.
TCL_LIB_FILE	  = "$(shell $(CYGPATH) '@TCL_BIN_DIR@/@TCL_LIB_FILE@')"
TCL_STUB_LIB_FILE = "$(shell $(CYGPATH) '@TCL_BIN_DIR@/@TCL_STUB_LIB_FILE@')"

SRC_DIR			= @srcdir@
ROOT_DIR		= $(SRC_DIR)/..
WIN_DIR			= $(SRC_DIR)
UNIX_DIR		= $(SRC_DIR)/../unix
GENERIC_DIR		= $(SRC_DIR)/../generic
TTK_DIR			= $(GENERIC_DIR)/ttk
BITMAP_DIR		= $(ROOT_DIR)/bitmaps
XLIB_DIR		= $(ROOT_DIR)/xlib
RC_DIR			= $(WIN_DIR)/rc

ROOT_DIR_NATIVE	   	= $(shell $(CYGPATH) '$(ROOT_DIR)' | sed 's!\\!/!g')
WIN_DIR_NATIVE	   	= $(shell $(CYGPATH) '$(WIN_DIR)' | sed 's!\\!/!g')
GENERIC_DIR_NATIVE 	= $(shell $(CYGPATH) '$(GENERIC_DIR)' | sed 's!\\!/!g')
BITMAP_DIR_NATIVE	= $(ROOT_DIR_NATIVE)/bitmaps
XLIB_DIR_NATIVE		= $(ROOT_DIR_NATIVE)/xlib
RC_DIR_NATIVE      	= $(WIN_DIR_NATIVE)/rc
TCL_GENERIC_NATIVE	= $(shell $(CYGPATH) '$(TCL_GENERIC_DIR)' | sed 's!\\!/!g')
TCL_PLATFORM_NATIVE	= $(shell $(CYGPATH) '$(TCL_PLATFORM_DIR)' | sed 's!\\!/!g')
TCL_SRC_DIR_NATIVE      = $(shell $(CYGPATH) '$(TCL_SRC_DIR)' | sed 's!\\!/!g')

DLLSUFFIX		= @DLLSUFFIX@
LIBSUFFIX		= @LIBSUFFIX@
EXESUFFIX		= @EXESUFFIX@

TK_STUB_LIB_FILE	= @TK_STUB_LIB_FILE@
TK_LIB_FILE		= @TK_LIB_FILE@
TK_DLL_FILE		= @TK_DLL_FILE@

SHARED_LIBRARIES 	= $(TK_DLL_FILE) $(TK_STUB_LIB_FILE)
STATIC_LIBRARIES	= $(TK_LIB_FILE)

WISH			= wish$(VER)${EXESUFFIX}
TKTEST			= tktest${EXEEXT}
CAT32			= cat32$(EXEEXT)
MAN2TCL			= man2tcl$(EXEEXT)

@SET_MAKE@

# Setting the VPATH variable to a list of paths will cause the
# makefile to look into these paths when resolving .c to .obj
# dependencies.

VPATH = $(GENERIC_DIR):$(TTK_DIR):$(WIN_DIR):$(UNIX_DIR):$(XLIB_DIR):$(RC_DIR)

# warning flags
CFLAGS_WARNING	= @CFLAGS_WARNING@

# The default switches for optimization or debugging
CFLAGS_DEBUG    = @CFLAGS_DEBUG@
CFLAGS_OPTIMIZE	= @CFLAGS_OPTIMIZE@

# The default switches for optimization or debugging
LDFLAGS_DEBUG    = @LDFLAGS_DEBUG@
LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@

# Tk does not used deprecated Tcl constructs so it should
# compile fine with -DTCL_NO_DEPRECATED. To remove its own
# set of deprecated code uncomment the second line.
NO_DEPRECATED_FLAGS	=
#NO_DEPRECATED_FLAGS	= -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED

# To change the compiler switches, for example to change from optimization to
# debugging symbols, change the following line:
#CFLAGS		= $(CFLAGS_DEBUG)
#CFLAGS		= $(CFLAGS_OPTIMIZE)
#CFLAGS		= $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE)
CFLAGS		= @CFLAGS@ @CFLAGS_DEFAULT@ $(NO_DEPRECATED_FLAGS) -D_ATL_XP_TARGETING

# Special compiler flags to use when building man2tcl on Windows.
MAN2TCLFLAGS	= @MAN2TCLFLAGS@

AR		= @AR@
RANLIB		= @RANLIB@
CC		= @CC@
RC		= @RC@
RES		= @RES@
TK_RES		= @TK_RES@
AC_FLAGS	= @EXTRA_CFLAGS@ @DEFS@ @TCL_DEFS@
CPPFLAGS	= @CPPFLAGS@
LDFLAGS		= @LDFLAGS@ @LDFLAGS_DEFAULT@
LDFLAGS_CONSOLE	= @LDFLAGS_CONSOLE@
LDFLAGS_WINDOW	= @LDFLAGS_WINDOW@
EXEEXT		= @EXEEXT@
OBJEXT		= @OBJEXT@
STLIB_LD	= @STLIB_LD@
SHLIB_LD	= @SHLIB_LD@
SHLIB_LD_LIBS	= @SHLIB_LD_LIBS@
SHLIB_CFLAGS	= @SHLIB_CFLAGS@
SHLIB_SUFFIX	= @SHLIB_SUFFIX@
VER		= @TK_MAJOR_VERSION@@TK_MINOR_VERSION@
DOTVER		= @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@
LIBS		= $(TCL_STUB_LIB_FILE) @LIBS@ @LIBS_GUI@
RMDIR		= rm -rf
MKDIR		= mkdir -p
SHELL		= @SHELL@
RM		= rm -f
COPY		= cp

BUILD_TCLSH	= @BUILD_TCLSH@

# TCL_EXE is the name of a tclsh executable that is available *BEFORE*
# running make for the first time. Certain build targets (make genstubs)
# need it to be available on the PATH. This executable should *NOT* be
# required just to do a normal build although it can be required to run
# make dist.
TCL_EXE			= @TCLSH_PROG@

CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \
-I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \
-I"${XLIB_DIR_NATIVE}" -I"${BITMAP_DIR_NATIVE}" \
-I"${TCL_GENERIC_NATIVE}" -I"${TCL_PLATFORM_NATIVE}" ${AC_FLAGS}

CC_OBJNAME = @CC_OBJNAME@
CC_EXENAME = @CC_EXENAME@

STUB_CC_SWITCHES	= ${CC_SWITCHES} -DUSE_TCL_STUBS
CON_CC_SWITCHES		= ${CC_SWITCHES} -DCONSOLE

# Tk used to let the configure script choose which program to use
# for installing, but there are just too many different versions of
# "install" around;  better to use the install-sh script that comes
# with the distribution, which is slower but guaranteed to work.

INSTALL		= cp
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA	= ${INSTALL}

WISH_OBJS = \
	winMain.$(OBJEXT)

TKTEST_OBJS = \
	testMain.$(OBJEXT) \
	tkSquare.$(OBJEXT) \
	tkTest.$(OBJEXT) \
	tkOldTest.$(OBJEXT) \
	tkWinTest.$(OBJEXT)

XLIB_OBJS = \
	xcolors.$(OBJEXT) \
	xdraw.$(OBJEXT) \
	xgc.$(OBJEXT) \
	ximage.$(OBJEXT) \
	xutil.$(OBJEXT)

TK_OBJS = \
	tkConsole.$(OBJEXT) \
	tkUnixMenubu.$(OBJEXT) \
	tkUnixScale.$(OBJEXT) \
	$(XLIB_OBJS) \
	tkWin3d.$(OBJEXT) \
	tkWin32Dll.$(OBJEXT) \
	tkWinButton.$(OBJEXT) \
	tkWinClipboard.$(OBJEXT) \
	tkWinColor.$(OBJEXT) \
	tkWinConfig.$(OBJEXT) \
	tkWinCursor.$(OBJEXT) \
	tkWinDialog.$(OBJEXT) \
	tkWinDraw.$(OBJEXT) \
	tkWinEmbed.$(OBJEXT) \
	tkWinFont.$(OBJEXT) \
	tkWinImage.$(OBJEXT) \
	tkWinInit.$(OBJEXT) \
	tkWinKey.$(OBJEXT) \
	tkWinMenu.$(OBJEXT) \
	tkWinPixmap.$(OBJEXT) \
	tkWinPointer.$(OBJEXT) \
	tkWinRegion.$(OBJEXT) \
	tkWinScrlbr.$(OBJEXT) \
	tkWinSend.$(OBJEXT) \
	tkWinSendCom.$(OBJEXT) \
	tkWinWindow.$(OBJEXT) \
	tkWinWm.$(OBJEXT) \
	tkWinX.$(OBJEXT) \
	stubs.$(OBJEXT) \
	tk3d.$(OBJEXT) \
	tkArgv.$(OBJEXT) \
	tkAtom.$(OBJEXT) \
	tkBind.$(OBJEXT) \
	tkBitmap.$(OBJEXT) \
	tkButton.$(OBJEXT) \
	tkCanvArc.$(OBJEXT) \
	tkCanvBmap.$(OBJEXT) \
	tkCanvImg.$(OBJEXT) \
	tkCanvLine.$(OBJEXT) \
	tkCanvPoly.$(OBJEXT) \
	tkCanvPs.$(OBJEXT) \
	tkCanvText.$(OBJEXT) \
	tkCanvUtil.$(OBJEXT) \
	tkCanvWind.$(OBJEXT) \
	tkCanvas.$(OBJEXT) \
	tkClipboard.$(OBJEXT) \
	tkCmds.$(OBJEXT) \
	tkColor.$(OBJEXT) \
	tkConfig.$(OBJEXT) \
	tkCursor.$(OBJEXT) \
	tkEntry.$(OBJEXT) \
	tkError.$(OBJEXT) \
	tkEvent.$(OBJEXT) \
	tkFileFilter.$(OBJEXT) \
	tkFocus.$(OBJEXT) \
	tkFont.$(OBJEXT) \
	tkFrame.$(OBJEXT) \
	tkGC.$(OBJEXT) \
	tkGeometry.$(OBJEXT) \
	tkGet.$(OBJEXT) \
	tkGrab.$(OBJEXT) \
	tkGrid.$(OBJEXT) \
	tkImage.$(OBJEXT) \
	tkImgBmap.$(OBJEXT) \
	tkImgGIF.$(OBJEXT) \
	tkImgPPM.$(OBJEXT) \
	tkImgPhoto.$(OBJEXT) \
	tkImgUtil.$(OBJEXT) \
	tkListbox.$(OBJEXT) \
	tkMacWinMenu.$(OBJEXT) \
	tkMain.$(OBJEXT) \
	tkMenu.$(OBJEXT) \
	tkMenubutton.$(OBJEXT) \
	tkMenuDraw.$(OBJEXT) \
	tkMessage.$(OBJEXT) \
	tkPanedWindow.$(OBJEXT) \
	tkObj.$(OBJEXT) \
	tkOldConfig.$(OBJEXT) \
	tkOption.$(OBJEXT) \
	tkPack.$(OBJEXT) \
	tkPlace.$(OBJEXT) \
	tkPointer.$(OBJEXT) \
	tkRectOval.$(OBJEXT) \
	tkScale.$(OBJEXT) \
	tkScrollbar.$(OBJEXT) \
	tkSelect.$(OBJEXT) \
	tkStyle.$(OBJEXT) \
	tkText.$(OBJEXT) \
	tkTextBTree.$(OBJEXT) \
	tkTextDisp.$(OBJEXT) \
	tkTextImage.$(OBJEXT) \
	tkTextIndex.$(OBJEXT) \
	tkTextMark.$(OBJEXT) \
	tkTextTag.$(OBJEXT) \
	tkTextWind.$(OBJEXT) \
	tkTrig.$(OBJEXT) \
	tkUndo.$(OBJEXT) \
	tkUtil.$(OBJEXT) \
	tkVisual.$(OBJEXT) \
	tkStubInit.$(OBJEXT) \
	tkWindow.$(OBJEXT) \
	$(TTK_OBJS)

TTK_OBJS = \
	ttkWinMonitor.$(OBJEXT) \
	ttkWinTheme.$(OBJEXT) \
	ttkWinXPTheme.$(OBJEXT) \
	ttkBlink.$(OBJEXT) \
	ttkButton.$(OBJEXT) \
	ttkCache.$(OBJEXT) \
	ttkClamTheme.$(OBJEXT) \
	ttkClassicTheme.$(OBJEXT) \
	ttkDefaultTheme.$(OBJEXT) \
	ttkElements.$(OBJEXT) \
	ttkEntry.$(OBJEXT) \
	ttkFrame.$(OBJEXT) \
	ttkImage.$(OBJEXT) \
	ttkInit.$(OBJEXT) \
	ttkLabel.$(OBJEXT) \
	ttkLayout.$(OBJEXT) \
	ttkManager.$(OBJEXT) \
	ttkNotebook.$(OBJEXT) \
	ttkPanedwindow.$(OBJEXT) \
	ttkProgress.$(OBJEXT) \
	ttkScale.$(OBJEXT) \
	ttkScrollbar.$(OBJEXT) \
	ttkScroll.$(OBJEXT) \
	ttkSeparator.$(OBJEXT) \
	ttkSquare.$(OBJEXT) \
	ttkState.$(OBJEXT) \
	ttkTagSet.$(OBJEXT) \
	ttkTheme.$(OBJEXT) \
	ttkTrace.$(OBJEXT) \
	ttkTrack.$(OBJEXT) \
	ttkTreeview.$(OBJEXT) \
	ttkWidget.$(OBJEXT) \
	ttkStubInit.$(OBJEXT)

STUB_OBJS = \
	tkStubLib.$(OBJEXT) \
	ttkStubLib.$(OBJEXT)

TCL_DOCS = "$(TCL_SRC_DIR_NATIVE)/doc/*.[13n]"
TK_DOCS = "$(ROOT_DIR_NATIVE)/doc/*.[13n]"
CORE_DOCS = $(TCL_DOCS) $(TK_DOCS)

DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget

SHELL_ENV = \
	@TCL_LIBRARY="$(TCL_SRC_DIR_NATIVE)/library"; export TCL_LIBRARY; \
	TK_LIBRARY="$(ROOT_DIR_NATIVE)/library"; export TK_LIBRARY; \
	PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH;

# Main targets.  The default target -- all -- builds the binaries,
# performs any post processing on libraries or documents.

all: binaries libraries doc

binaries: @LIBRARIES@ $(WISH)

libraries:

$(ROOT_DIR)/doc/man.macros:
	$(INSTALL_DATA) "$(TCL_SRC_DIR)/doc/man.macros" "$(ROOT_DIR)/doc/man.macros"

doc: $(ROOT_DIR)/doc/man.macros

winhelp: $(TCL_SRC_DIR)/tools/man2help.tcl $(MAN2TCL)
	$(TCL_EXE) "$(TCL_SRC_DIR_NATIVE)/tools/man2help.tcl" tcl "$(VER)" $(CORE_DOCS)
	$(COPY) "$(TCL_BIN_DIR)/tcl.hpj" ./
	hcw /c /e tcl.hpj
	$(COPY) ./tcl$(VER).cnt ./TCL$(VER).HLP "$(TCL_SRC_DIR_NATIVE)/tools/"

$(MAN2TCL): $(TCL_SRC_DIR)/tools/man2tcl.c
	$(CC) $(CFLAGS_OPTIMIZE) $(MAN2TCLFLAGS) -o $(MAN2TCL) "$(TCL_SRC_DIR_NATIVE)/tools/man2tcl.c"

# Specifying TESTFLAGS on the command line is the standard way to pass
# args to tcltest, ie:
#	% make test TESTFLAGS="-verbose bps -file fileName.test"

test: test-classic test-ttk

test-classic: binaries $(TKTEST) $(CAT32)
	$(SHELL_ENV) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" \
	$(TESTFLAGS) | ./$(CAT32)

test-ttk: binaries $(TKTEST) $(CAT32)
	$(SHELL_ENV) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/ttk/all.tcl" \
	$(TESTFLAGS) | ./$(CAT32)

runtest: binaries $(TKTEST)
	$(SHELL_ENV) ./$(TKTEST) $(TESTFLAGS) $(SCRIPT)

# This target can be used to run wish from the build directory
# via `make shell` or `make shell SCRIPT=foo.tcl`
shell: binaries
	$(SHELL_ENV) ./$(WISH) $(SCRIPT)

demo: $(WISH)
	$(SHELL_ENV) ./$(WISH) $(ROOT_DIR)/library/demos/widget

# This target can be used to run wish inside either gdb or insight
gdb: binaries
	@echo "set env TCL_LIBRARY=$(TCL_SRC_DIR_NATIVE)/library" > gdb.run
	@echo "set env TK_LIBRARY=$(ROOT_DIR_NATIVE)/library" >> gdb.run
	PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH; \
	gdb ./$(WISH) --command=gdb.run
	@$(RM) gdb.run

install: all install-binaries install-libraries install-doc install-demos

install-binaries: binaries
	@for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) $(PKG_INSTALL_DIR); \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		$(MKDIR) $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@for i in $(TK_DLL_FILE) $(WISH); \
	    do \
	    if [ -f $$i ]; then \
		echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \
		$(COPY) $$i "$(BIN_INSTALL_DIR)"; \
	    fi; \
	    done
	@echo "Creating package index $(PKG_INDEX)";
	@$(RM) $(PKG_INDEX);
	@(\
	echo "if {[catch {package present Tcl 8.5.0}]} return";\
	echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\
	echo "	|| ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\
	echo "    package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]] Tk]";\
	echo "} else {";\
	echo "    package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE)]] Tk]";\
	echo "}";\
	) > $(PKG_INDEX);
	@for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \
	    do \
	    if [ -f $$i ]; then \
		echo "Installing $$i to $(LIB_INSTALL_DIR)/"; \
		$(COPY) $$i "$(LIB_INSTALL_DIR)"; \
	    fi; \
	    done

install-libraries: libraries
	@for i in $(INSTALL_ROOT)$(prefix)/lib \
		$(INCLUDE_INSTALL_DIR) $(INCLUDE_INSTALL_DIR)/X11 \
		$(SCRIPT_INSTALL_DIR) $(SCRIPT_INSTALL_DIR)/images \
		$(SCRIPT_INSTALL_DIR)/msgs $(SCRIPT_INSTALL_DIR)/ttk; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		$(MKDIR) $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@echo "Installing header files to $(INCLUDE_INSTALL_DIR)/";
	@for i in $(GENERIC_DIR)/tk.h $(GENERIC_DIR)/tkPlatDecls.h \
		$(GENERIC_DIR)/tkIntXlibDecls.h $(GENERIC_DIR)/tkDecls.h ; \
	    do \
	    $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR); \
	    done;
	@for i in $(XLIB_DIR)/X11/*.h; \
	    do \
	    $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR)/X11; \
	    done;
	@echo "Installing library files to $(SCRIPT_INSTALL_DIR)";
	@for i in $(ROOT_DIR)/library/*.tcl $(ROOT_DIR)/library/tclIndex \
		$(UNIX_DIR)/tkAppInit.c; \
	    do \
	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
	    done;
	@echo "Installing library ttk directory";
	@for i in $(ROOT_DIR)/library/ttk/*.tcl; \
	    do \
	    if [ -f $$i ] ; then \
		$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/ttk; \
	    fi; \
	    done;
	@echo "Installing library images directory";
	@for i in $(ROOT_DIR)/library/images/*; \
	    do \
	    if [ -f $$i ] ; then \
		$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/images; \
	    fi; \
	    done;
	@echo "Installing translation directory";
	@for i in $(ROOT_DIR)/library/msgs/*.msg; \
	    do \
	    if [ -f $$i ] ; then \
		$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/msgs; \
	    fi; \
	    done;

install-demos:
	@for i in $(INSTALL_ROOT)$(prefix)/lib $(SCRIPT_INSTALL_DIR) \
		$(SCRIPT_INSTALL_DIR)/demos \
		$(SCRIPT_INSTALL_DIR)/demos/images ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		$(MKDIR) $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@echo "Installing demos to $(SCRIPT_INSTALL_DIR)/demos/";
	@for i in $(ROOT_DIR)/library/demos/*; \
	    do \
	    if [ -f $$i ] ; then \
		sed -e '3 s|exec wish|exec wish$(VER)|' \
			$$i > $(SCRIPT_INSTALL_DIR)/demos/`basename $$i`; \
	    fi; \
	    done;
	@for i in $(DEMOPROGS); \
	    do \
	    if test $$i = "square"; then \
	    rm -f  $(SCRIPT_INSTALL_DIR)/demos/$$i; \
	    else \
	    chmod 755 $(SCRIPT_INSTALL_DIR)/demos/$$i; \
	    fi; \
	    done;
	@echo "Installing demo images";
	@for i in $(ROOT_DIR)/library/demos/images/*; \
	    do \
	    if [ -f $$i ] ; then \
		$(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/images; \
		fi; \
	    done;

install-doc: doc

# Optional target to install private headers
install-private-headers: libraries
	@for i in $(PRIVATE_INCLUDE_INSTALL_DIR); \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		$(MKDIR) $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@echo "Installing private header files to $(PRIVATE_INCLUDE_INSTALL_DIR)/";
	@for i in $(GENERIC_DIR)/tkInt.h $(GENERIC_DIR)/tkIntDecls.h \
		$(GENERIC_DIR)/tkIntPlatDecls.h $(GENERIC_DIR)/tkPort.h \
		$(WIN_DIR)/tkWinPort.h $(WIN_DIR)/tkWinInt.h $(WIN_DIR)/tkWin.h; \
	    do \
	    $(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \
	    done;

$(WISH): $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) wish.$(RES)
	$(CC) $(CFLAGS) $(WISH_OBJS) $(TCL_LIB_FILE) $(TK_LIB_FILE) $(LIBS) \
	wish.$(RES) $(CC_EXENAME) $(LDFLAGS_WINDOW)
	@VC_MANIFEST_EMBED_EXE@

tktest: $(TKTEST)

$(TKTEST): $(TKTEST_OBJS) $(TK_LIB_FILE) wish.$(RES)
	$(CC) $(CFLAGS) $(TKTEST_OBJS) $(TCL_LIB_FILE) \
	$(TK_LIB_FILE) $(LIBS) \
	wish.$(RES) $(CC_EXENAME) $(LDFLAGS_WINDOW)
	@VC_MANIFEST_EMBED_EXE@

# Msys make requires this next rule for some reason.
$(TCL_SRC_DIR)/win/cat.c:

cat32.${OBJEXT}: $(TCL_SRC_DIR)/win/cat.c
	$(CC) -c $(CC_SWITCHES) "$(TCL_SRC_DIR)/win/cat.c" $(CC_OBJNAME)

$(CAT32): cat32.${OBJEXT}
	$(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE)

# The following targets are configured by autoconf to generate either
# a shared library or static library

${TK_STUB_LIB_FILE}: ${STUB_OBJS}
	@$(RM) ${TK_STUB_LIB_FILE}
	@MAKE_STUB_LIB@ ${STUB_OBJS}
	@POST_MAKE_LIB@

${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES)
	@$(RM) ${TK_DLL_FILE}
	@MAKE_DLL@ ${TK_OBJS} $(TK_RES) $(SHLIB_LD_LIBS)
	@VC_MANIFEST_EMBED_DLL@

${TK_LIB_FILE}: ${TK_OBJS}
	@$(RM) ${TK_LIB_FILE}
	@MAKE_LIB@ ${TK_OBJS}
	@POST_MAKE_LIB@

# Special case object file targets

winMain.$(OBJEXT): winMain.c
	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)

testMain.$(OBJEXT): winMain.c
	$(CC) -c $(CC_SWITCHES) @DEPARG@ -DTK_TEST $(CC_OBJNAME)

tkTest.$(OBJEXT): tkTest.c
	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)

tkOldTest.$(OBJEXT): tkOldTest.c
	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)

tkWinTest.$(OBJEXT): tkWinTest.c
	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)

tkSquare.$(OBJEXT): tkSquare.c
	$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)

# Extra dependency info
tkConsole.$(OBJEXT): configure Makefile
tkMain.$(OBJEXT): configure Makefile
tkWindow.$(OBJEXT): configure Makefile

# Add the object extension to the implicit rules.  By default .obj is not
# automatically added.

.SUFFIXES: .${OBJEXT}
.SUFFIXES: .$(RES)
.SUFFIXES: .rc

# Implicit rule for all object files that will end up in the Tk library

%.$(OBJEXT): %.c
	$(CC) -c $(STUB_CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME)

.rc.$(RES):
	$(RC) @RC_OUT@ $@ @RC_TYPE@ @RC_DEFINES@ @RC_INCLUDE@ "$(GENERIC_DIR_NATIVE)" @RC_INCLUDE@ "$(TCL_GENERIC_NATIVE)" @RC_INCLUDE@ "$(TCL_PLATFORM_NATIVE)" @RC_INCLUDE@ "$(RC_DIR_NATIVE)" @DEPARG@

depend:

cleanhelp:
	$(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl${EXEEXT}

clean: cleanhelp
	$(RM) *.lib *.a *.exp *.dll *.res *.${OBJEXT} *~ \#* TAGS a.out
	$(RM) $(WISH) $(TKTEST) $(CAT32)
	$(RM) *.pch *.ilk *.pdb

distclean: clean
	$(RM) Makefile config.status config.cache config.log tkConfig.sh \
		wish.exe.manifest

Makefile: $(SRC_DIR)/Makefile.in
	./config.status

#
# Regenerate the stubs files.
#

$(GENERIC_DIR)/tkStubInit.c: $(GENERIC_DIR)/tk.decls \
		$(GENERIC_DIR)/tkInt.decls
	@echo "Warning: tkStubInit.c may be out of date."
	@echo "Developers may want to run \"make genstubs\" to regenerate."
	@echo "This warning can be safely ignored, do not report as a bug!"

genstubs:
	$(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \
	    "$(GENERIC_DIR_NATIVE)" \
	    "$(GENERIC_DIR_NATIVE)/tk.decls" \
	    "$(GENERIC_DIR_NATIVE)/tkInt.decls"
	$(TCL_EXE) "$(TTK_DIR)/ttkGenStubs.tcl" \
	    "$(TTK_DIR)" \
	    "$(TTK_DIR)/ttk.decls"

#
# The list of all the targets that do not correspond to real files. This stops
# 'make' from getting confused when someone makes an error in a rule.
#

.PHONY: all binaries libraries doc tkLibObjs objs tktest-real test test-classic
.PHONY: test-ttk testlang runtest shell demo gdb install install-strip
.PHONY: install-binaries install-libraries install-demos install-doc
.PHONY: install-private-headers clean distclean depend genstubs checkstubs
.PHONY: checkuchar checkexports rpm dist alldist allpatch html html-tcl html-tk

# DO NOT DELETE THIS LINE -- make depend depends on it.