aboutsummaryrefslogtreecommitdiff
path: root/Makefile.vc
blob: 4628d7d0b6ae5da0a6ade684cd06c4835d3572d1 (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
# -*- 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.10 2005/03/09 13:42:02 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

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
jim:     setup $(OUTDIR)\jim.exe
dll:     setup $(OUTDIR)\jim.dll
win32:   setup $(OUTDIR)\jim-win32.dll
win32api: setup $(OUTDIR)\jim-win32api.dll
win32com: setup $(OUTDIR)\jim-win32com.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.dll: $(TMPDIR)\jim-win32.obj
        @$(LD) $(LDFLAGS) -dll -out:$@ $** $(LIBS)

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

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

.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 /q /s $(TMPDIR) >NUL

realclean: clean
        @if exist $(OUTDIR)\NUL rmdir /q /s $(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 @<<
$<
<<

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