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
|
# Makefile.vc
#
# This makefile builds Tktable.dll, a table widget as a dynamically
# loadable Tk extension. This makefile is suitable for use with VC++ 5+.
#
# TkTable assumes that Tcl/Tk has already been installed on Windows.
#
# This does not provide support for static builds on Windows
#
# Set this to the appropriate value of /MACHINE: for your platform
# Choices: IX86, IA64
MACHINE = IX86
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 = .
!if "$(MACHINE)" == "IA64"
# This assumes "-64" suffixes your Win64 build
v3 = 84-64
# IA64 support is based on the standard setup with v2 of the
# Microsoft SDK for XP, RC1
TOOLS32 = C:/Progra~1/Microsoft SDK
CC = "$(TOOLS32)/bin/Win64/cl.exe"
LD = "$(TOOLS32)/bin/Win64/link.exe"
libpath32 = /LIBPATH:"$(TOOLS32)/lib/IA64" \
/LIBPATH:"$(TOOLS32)/lib/Prerelease/IA64"
include32 = -I"$(TOOLS32)/Include/prerelease" \
-I"$(TOOLS32)/Include/Win64/crt" \
-I"$(TOOLS32)/Include/Win64/crt/sys" \
-I"$(TOOLS32)/Include"
!else
# Visual Studio 5 default
#TOOLS32 = C:/Progra~1/devstudio/vc
# Visual Studio 6 default
TOOLS32 = C:/Progra~1/Microsoft Visual Studio/VC98
CC = "$(TOOLS32)/bin/cl.exe"
LD = "$(TOOLS32)/bin/link.exe" -link50compat
libpath32 = /LIBPATH:"$(TOOLS32)/lib"
include32 = -I"$(TOOLS32)/include"
!endif
DEST_DIR = C:\Tcl
DEST_DIRU = C:/Tcl
WIN_DIR = $(ROOT)\win
GENERIC_DIR = $(ROOT)\generic
VPATH = $(GENERIC_DIR):$(WIN_DIR)
#Get version info (this is in Makefile and C format)
!include "$(GENERIC_DIR)\version.h"
# Set your version of Tcl
TCL_VERSION = 8.4
TCL_VER = 84
INST_RUNTIME = $(DEST_DIR)\lib\$(PROJECT)$(VERSION)
INST_RUNTIMEU = $(DEST_DIRU)/lib/$(PROJECT)$(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
# change the following line to compile with symbols
DEBUG = 0
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)
WIN_LIBS = gdi32.lib user32.lib
LIBS = $(DEST_DIR)\lib\tclstub$(TCL_VER).lib \
$(DEST_DIR)\lib\tkstub$(TCL_VER).lib $(WIN_LIBS)
LIBS = C:\build\tcl84-64\tclstub$(TCL_VER).lib \
C:\build\tk84-64\tkstub$(TCL_VER).lib $(WIN_LIBS)
INCLUDES = -I"$(DEST_DIR)\include" -I. $(include32)
DEFINES = -DDLL_BUILD -DBUILD_Tktable $(TBL_CFLAGS) \
-DPACKAGE_VERSION=\"$(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
CC_SWITCHES = $(CFLAGS) $(EXTRA_CFLAGS) $(DEFINES) $(INCLUDES)
#---------------------------------------------------------------------
# Compile flags
#---------------------------------------------------------------------
!if !$(DEBUG)
# This cranks the optimization level to maximize speed
cdebug = -O2 -Gs
!else if "$(MACHINE)" == "IA64"
cdebug = -Od -Zi
!else
cdebug = -Z7 -Od -WX
DBGX = d
!endif
# declarations common to all compiler options
cflags = -c -W3 -nologo -Fp$(TMP_DIR)\ -YX -MT$(DBGX)
#---------------------------------------------------------------------
# Link flags
#---------------------------------------------------------------------
!if $(DEBUG)
ldebug = -debug:full -debugtype:cv
!else
ldebug = -release
!endif
# declarations common to all linker options
lflags = -nologo -machine:$(MACHINE) -warn:3 $(libpath32)
# declarations for use on Intel i386, i486, and Pentium systems
!IF "$(MACHINE)" == "IX86"
DLLENTRY = @12
dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll
!ELSE IF "$(MACHINE)" == "IA64"
dlllflags = $(lflags) -dll
!ELSE
dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll
!ENDIF
conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup
guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup
#
# 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) $(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) $(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)
$(LD) $(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:
$(CC) $(CC_SWITCHES) $(cdebug) $(cflags) $(cvarsdll) -Fo$(TMP_DIR)\ $<
{$(GENERIC_DIR)}.c{$(TMP_DIR)}.obj:
$(CC) $(CC_SWITCHES) $(cdebug) $(cflags) $(cvarsdll) -Fo$(TMP_DIR)\ $<
install: pkgIndex.tcl $(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
|