-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (61 loc) · 1.39 KB
/
Makefile
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
!ifndef DEBUG
DEBUG = 0
!endif
!ifndef TCLVER
TCLVER=8.5
!endif
!ifndef TCLDIR
TCLDIR=\opt\tcl$(TCLVER)
!endif
!ifndef MACHINE
!ifndef CPU
CPU = IX86
!endif
MACHINE = $(CPU)
!endif
CC =cl -nologo
LD =link -nologo
RM =del /q/f >NUL
!if $(DEBUG)
CFLAGS =-W4 -MDd -Od -Zi -DDEBUG
LDFLAGS =-debug
!else
CFLAGS =-W3 -MD -O2 -Zi -D_NDEBUG
LDFLAGS =-debug
!endif
CFLAGS =-DTCL_VERSION_MINIMUM=\"$(TCLVER)\"
V=$(TCLVER:.=)
INC =-I. -I$(TCLDIR)\include
LIBS =-libpath:$(TCLDIR)\lib tclstub$V.lib tkstub$V.lib
!if "$(MACHINE)" == "AMD64"
OUT_DIR =win32-x86_64
LDFLAGS = $(LDFLAGS) -machine:AMD64
LIBS = $(LIBS) bufferoverflowU.lib
!else
OUT_DIR =win32-ix86
!endif
TMP_DIR = $(OUT_DIR)
all: setup $(OUT_DIR)\imgscale.dll pkgIndex.tcl
setup:
@if not exist $(OUT_DIR) mkdir $(OUT_DIR)
@if not exist $(TMP_DIR) mkdir $(TMP_DIR)
$(OUT_DIR)\imgscale.dll: $(TMP_DIR)\imgscale.obj
@$(LD) -dll -out:$@ $(LDFLAGS) $** $(LIBS)
@$(RM) $(@:.dll=.exp) $(@:.dll=.ilk)
pkgIndex.tcl:
@echo. ^ ^ Creating pkgIndex file.
@type << >$@
package ifneeded imgscale 1.0 \
"package require platform
load \[file join [list $$dir] \[platform::generic\]\
imgscale[info sharedlibextension]\]"
<<
{}.c{$(TMP_DIR)}.obj::
@$(CC) $(CFLAGS) $(INC) -DUSE_TCL_STUBS -DUSE_TK_STUBS -Fo$(TMP_DIR)\ -c @<<
$<
<<
clean:
-@rmdir /s/q $(OUT_DIR) >NUL
-@$(RM) vc*.pdb
-@$(RM) pkgIndex.tcl
.PHONY: clean setup