File: makefile.vc

package info (click to toggle)
tktable 2.7-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 928 kB
  • ctags: 644
  • sloc: ansic: 8,027; tcl: 987; makefile: 251; sh: 152
file content (187 lines) | stat: -rw-r--r-- 5,301 bytes parent folder | download
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
# Makefile.vc
#
# This makefile builds Tktable.dll, a table widget as a dynamically
# loadable Tk extension.  This makefile is suitable for use with
# Microsoft Visual C++ 4-5.
# TkTable assumes that Tcl/Tk has already been installed on Windows.
#
# This does not provide support for static builds on Windows
#
!include <ntwin32.mak>

PROJECT	= Tktable
TBL_COMMAND = table
TBL_RUNTIME = tkTable.tcl

# Project directories -- these may need to be customized for your site
#
# ROOT --	location of the source files.
# TMP_DIR --	location for .obj files.
# TOOLS32 --	location of VC++ compiler installation.
# DEST_DIR --	location of Tcl/Tk installation hierarchy
# DEST_DIRU --	same as above with "/" as path separator
#

ROOT		= ..
TMP_DIR		= .
TOOLS32		= C:\Progra~1\Microsoft Visual Studio\VC98
#TOOLS32		= C:\Progra~1\DevStudio\Vc
DEST_DIR	= C:\Progra~1\Tcl
DEST_DIRU	= C:/Progra~1/Tcl

WIN_DIR		= $(ROOT)\win
GENERIC_DIR	= $(ROOT)\generic

#Get version info (this is in Makefile and C format)
!include "$(GENERIC_DIR)\version.h"

# Set your version of Tcl

TCL_VERSION	= 8.3
TCL_VER		= 83

INST_RUNTIME	= $(DEST_DIR)\lib\$(PROJECT)$(TBL_VERSION)
INST_RUNTIMEU	= $(DEST_DIRU)/lib/$(PROJECT)$(TBL_VERSION)

# NO_EMBEDDED_RUNTIME means that the tkTable.tcl file will not be embedded
# into the executable, thus the default tkTable.tcl library file will not
# be available when the library is loaded.
# If this is defined, the tkTable.tcl file must be available in a
# predefined set of directories (see docs).
#TBL_CFLAGS	+= -DNO_EMBEDDED_RUNTIME

# comment out the following line to compile with symbols
NODEBUG=1

#
# Visual C++ tools
#

PATH	= $(TOOLS32)\bin;$(PATH)
cc32	= "$(TOOLS32)\bin\cl" -I"$(TOOLS32)\include"
CP      = copy
RM      = del

######################################################################
# Project specific targets
######################################################################

TBL_LIB_DIR	= $(ROOT)\library
# Assume that WISH is already INSTALLED
TCLSH		= $(DEST_DIR)\bin\tclsh$(TCL_VER)
WISH		= $(DEST_DIR)\bin\wish$(TCL_VER)
LIBS		= $(DEST_DIR)\lib\tclstub$(TCL_VER).lib \
		  $(DEST_DIR)\lib\tkstub$(TCL_VER).lib
INCLUDES	= -I"$(DEST_DIR)\include" -I.

DEFINES = -DDLL_BUILD -DBUILD_tkTable $(TBL_CFLAGS) \
	  -DTBL_VERSION=\"$(TBL_VERSION)\" \
	  -DTBL_COMMAND=\"$(TBL_COMMAND)\" \
	  -DTBL_RUNTIME="\"$(TBL_RUNTIME)\"" \
	  -DTBL_RUNTIME_DIR="\"$(INST_RUNTIMEU)\""

## Define this if you want to use STUBS
## This only works for the dynamic library
##
DEFINES	= $(DEFINES) -DUSE_TCL_STUBS -DUSE_TK_STUBS

#
# Global makefile settings
#
DLLOBJS = $(TMP_DIR)\tkTable.obj \
	$(TMP_DIR)\tkTableWin.obj \
	$(TMP_DIR)\tkTableTag.obj \
	$(TMP_DIR)\tkTableEdit.obj \
	$(TMP_DIR)\tkTableCell.obj \
	$(TMP_DIR)\tkTableCellSort.obj \
	$(TMP_DIR)\tkTableCmds.obj \
	$(TMP_DIR)\tkTableUtil.obj
# $(TMP_DIR)\tkTablePs.obj

DLL=$(PROJECT).dll

#
# Targets
#
all: pkgIndex.tcl

test: pkgIndex.tcl
	@"$(WISH)" <<
	    lappend auto_path $(ROOT)
	    set code [catch {
		    package require $(PROJECT)
		    pack [$(TBL_COMMAND) .t]
		} msg]
	    if {$$code != 0} {
		tk_messageBox -type ok -message\
		    "$(PROJECT) failed to load and run: $$msg"
	    } else {
		tk_messageBox -type ok -message\
		    "everything seems OK for 'package require $(PROJECT)'"
	    }
	    exit $$code
<<

pkgIndex.tcl: $(DLL)
	"$(TCLSH)" << pkgIndex.tcl
	set out [open [lindex $$argv 0] w]
	puts $$out {if {[catch {package require Tcl 8.2}]} return}
	puts -nonewline $$out {package ifneeded $(PROJECT) $(TBL_VERSION) }
	puts -nonewline $$out {"package require Tk 8.2; }
	puts $$out {[list load [file join $$dir $(DLL)] $(PROJECT)]"}
	close $$out
<<

pkgIndex.tcl-NOSTUBS: $(DLL)
	"$(TCLSH)" << pkgIndex.tcl
	set out [open [lindex $$argv 0] w]
	puts $$out {if {[catch {package require Tcl $(TCL_VERSION)}]} return}
	puts -nonewline $$out {package ifneeded $(PROJECT) $(TBL_VERSION) }
	puts -nonewline $$out {"package require Tk $(TCL_VERSION); }
	puts $$out {[list load [file join $$dir $(DLL)] $(PROJECT)]"}
	close $$out
<<

$(DLL): tkTable.tcl.h $(DLLOBJS)
	$(link) $(linkdebug) $(dlllflags) $(LIBS) \
		$(guilibsdll) -out:$@ $(DLLOBJS)

tkTable.tcl.h: $(TBL_LIB_DIR)\tkTable.tcl
	"$(TCLSH)" << $(TBL_LIB_DIR)\tkTable.tcl >$(TMP_DIR)\tkTable.tcl.h
	set in [open [lindex $$argv 0] r]
	while {[gets $$in line] != -1} {
	    switch -regexp -- $$line "^$$" - {^#} continue
	    regsub -all {\\} $$line {\\\\} line
	    regsub -all {"} $$line {\"} line
	    puts "\"$$line\\n\""
	}
<<

# Implicit Targets

{$(WIN_DIR)}.c{$(TMP_DIR)}.obj:
	$(cc32) $(cdebug) $(cflags) $(cvarsdll) \
		$(INCLUDES) $(DEFINES) -Fo$(TMP_DIR)\ $<

{$(GENERIC_DIR)}.c{$(TMP_DIR)}.obj:
	$(cc32) $(cdebug) $(cflags) $(cvarsdll) \
		$(INCLUDES) $(DEFINES) -Fo$(TMP_DIR)\ $<

install: $(DLL)
	if not exist "$(INST_RUNTIME)\" mkdir "$(INST_RUNTIME)"
	copy "$(TBL_LIB_DIR)\tkTable.tcl" "$(INST_RUNTIME)"
	copy "$(DLL)" "$(INST_RUNTIME)"
	copy pkgIndex.tcl "$(INST_RUNTIME)"

uninstall:
	-$(RM) "$(INST_RUNTIME)\tkTable.tcl"
	-$(RM) "$(INST_RUNTIME)\$(DLL)"
	-$(RM) "$(INST_RUNTIME)\pkgIndex.tcl"

clean:
	-$(RM) $(TMP_DIR)\*.obj 2>nul
	-$(RM) $(TMP_DIR)\$(DLL) 2>nul
	-$(RM) $(TMP_DIR)\$(PROJECT).lib 2>nul
	-$(RM) $(TMP_DIR)\$(PROJECT).exp 2>nul
	-$(RM) $(TMP_DIR)\pkgIndex.tcl 2>nul
	-$(RM) $(TMP_DIR)\tkTable.tcl.h 2>nul