aboutsummaryrefslogtreecommitdiff
path: root/Makefile.vc
blob: 395381c341151f937e786fae191bc537a38c3e74 (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
# -*- Makefile -*- 
#
# This is a Microsoft Visual C NMAKE makefile to use in building the
# Jim interpreter.
#
# Usage:
#   nmake -f Makefile.vc clean all
#
# To build a debug build, add DEBUG=1 to the command line. To build
# for profiling, add PROFILE=1. eg:
#   nmake -f Makefile.vc DEBUG=1 clean all
#
#
# Copyright (C) 2005 Pat Thoyts <patthoyts@users.sourceforge.net>
#
#-------------------------------------------------------------------------
# $Id: Makefile.vc,v 1.12 2005/04/06 14:16:56 patthoyts Exp $
#-------------------------------------------------------------------------

SRCDIR =.

!ifndef DEBUG
DEBUG   =0
!endif
!ifndef PROFILE
PROFILE =0
!endif


!if $(DEBUG)
OUTDIR =Debug
CFLAGS =-Od -Zi -GZ -MDd -D_DEBUG
LDFLAGS=-debug:full -debugtype:cv
!else
OUTDIR =Release
CFLAGS =-O2 -Op -Gs -MD -DNDEBUG
LDFLAGS=-release -opt:ref -opt:icf,3
!endif

!if $(PROFILE)
CFLAGS =$(CFLAGS) -Zi
LDFLAGS=$(LDFLAGS) -profile -map
!endif

!if "$(OS)" == "Windows_NT"
RMDIR = rmdir /s /q
!else
RMDIR = deltree /y
!endif

TMPDIR =$(OUTDIR)\Objects

CC     =cl -nologo
LD     =link -nologo

# -Fd$(TMPDIR)^\
CFLAGS =$(CFLAGS) -W3 -GX -YX -Fp$(TMPDIR)^\
INC    =
DEFS   =-DWIN32
LIBS   =


all:     jim win32 win32com win32api
jim:     setup $(OUTDIR)\jim.exe
jimwish: setup $(OUTDIR)\jimwish.exe
dll:     setup $(OUTDIR)\jim.dll
win32:   setup $(OUTDIR)\jim-win32-1.0.dll
win32api: setup $(OUTDIR)\jim-win32api-1.0.dll
win32com: setup $(OUTDIR)\jim-win32com-1.0.dll

$(OUTDIR)\jim.exe: $(TMPDIR)\jim.obj $(TMPDIR)\jimsh.obj
	@$(LD) $(LDFLAGS) -out:$@ $** $(LIBS)

$(OUTDIR)\jim.dll: $(TMPDIR)\jim.obj
	@$(LD) $(LDFLAGS) -dll -out:$@ $** $(LIBS)

$(OUTDIR)\jim-win32-1.0.dll: $(TMPDIR)\jim-win32.obj
        @$(LD) $(LDFLAGS) -dll -out:$@ $** $(LIBS)

$(OUTDIR)\jim-win32api-1.0.dll: $(TMPDIR)\jim-win32api.obj
        @$(LD) $(LDFLAGS) -dll -out:$@ $** $(LIBS)

$(OUTDIR)\jim-win32com-1.0.dll: $(TMPDIR)\jim-win32com.obj
        @$(LD) $(LDFLAGS) -dll -out:$@ $** $(LIBS)

$(OUTDIR)\jimwish.exe: $(TMPDIR)\jim.obj $(TMPDIR)\jimwish.obj
        @$(LD) $(LDFLAGS) -out:$@ $** $(LIBS) user32.lib

.PHONY: all jim dll win32 win32api win32com

#-------------------------------------------------------------------------
setup:
	@if not exist $(OUTDIR) mkdir $(OUTDIR)
	@if not exist $(TMPDIR) mkdir $(TMPDIR)


test: jim
	$(OUTDIR)\jim.exe test.tcl

clean:
        @if exist $(TMPDIR)\NUL $(RMDIR) $(TMPDIR) >NUL

realclean: clean
        @if exist $(OUTDIR)\NUL $(RMDIR) $(OUTDIR) >NUL

#-------------------------------------------------------------------------

.SUFFIXES:.c .cpp

{$(SRCDIR)}.c{$(TMPDIR)}.obj::
        @$(CC) $(CFLAGS) $(DEFS) $(INC) -Fa$(TMPDIR)\ -Fo$(TMPDIR)\ -c @<<
$<
<<

{$(SRCDIR)}.cpp{$(TMPDIR)}.obj::
        @$(CC) $(CFLAGS) $(DEFS) $(INC) -Fo$(TMPDIR)\ -c @<<
$<
<<

#-------------------------------------------------------------------------