1
2# ------------------------------------------------------------------------
3#
4# 	Nmakefile for BLT library using VC++.
5#
6#  	Please note this file may or may not be up-to-date.
7#
8#	You can compare it with "Makefile.vc" in this directory.  That's
9#	what I use to build BLT (so it should be current).  It builds BLT
10#	with VC++ 6.0 and the cygwin32 tool suite from
11#
12#		http://sourceware.cygnus.com
13#
14# ------------------------------------------------------------------------
15
16!INCLUDE ../win/makedefs
17
18TOOLS32       =	C:/Program Files/Microsoft Visual Studio/Vc98
19prefix        =	C:/Program Files/Tcl
20
21AR            =	lib.exe
22LD            =	link.exe
23CC            =	cl.exe
24rc32          =	rc.exe
25RM	      = -del
26
27# ------------------------------------------------------------------------
28# 	C Compiler options
29# ------------------------------------------------------------------------
30
31DEFINES       =	-D_X86_=1 -D__STDC__ -DWIN32 -DCONSOLE -D_MT \
32			$(DEBUG_DEFINES) $(SHLIB_DEFINES)
33EXTRA_CFLAGS  =	-nologo -W3
34
35!IF "$(SHARED)" == "1"
36SHLIB_DEFINES = -D_DLL
37SHLIB_TARGET  =	build-dll
38LIBS =		$(COMMON_LIBS)
39!ELSE
40SHLIB_DEFINES = -D_CTYPE_DISABLE_MACROS
41LIBS          =	$(COMMON_LIBS) $(EXTRA_LIBS)
42!ENDIF
43
44!IF "$(DEBUG)" == "1"
45CFLAGS        =	-Z7 -Od
46DEBUG_LDFLAGS =	-debug:full -debugtype:cv
47D             =	d
48builddir      =	.\Debug
49!ELSE
50CFLAGS        =	-Ox -GB -GD
51DEBUG_LDFLAGS =	-debug:full -debugtype:cv
52D             =
53builddir      =	.\Release
54!ENDIF
55
56MSVCRT        =	msvcrt$(DBG).lib
57TK_LIB        =	$(TKDIR)/win/$(builddir)/tk$(v2)$(D).lib
58TCL_LIB       =	$(TCLDIR)/win/$(builddir)/tcl$(v2)$(D).lib
59
60# ------------------------------------------------------------------------
61# 	Linker flags and options
62# ------------------------------------------------------------------------
63
64JPEGLIB       =	$(JPEGDIR)/libjpeg.lib
65
66COMMON_LDFLAGS =	-nodefaultlib -release -nologo -warn:3 \
67		-machine:IX86 -align:0x1000 \
68		$(DEBUG_LDFLAGS)
69
70DLLENTRY      =	@12
71SHLIB_LDFLAGS = $(COMMON_LDFLAGS) \
72		-subsystem:console -entry:mainCRTStartup \
73		-subsystem:windows -entry:WinMainCRTStartup \
74		-entry:_DllMainCRTStartup$(DLLENTRY) -dll
75
76LDFLAGS       =	$(COMMON_LDFLAGS) \
77		-fixed:NO -stack:2300000
78
79COMMON_LIBS   =	$(TK_LIB) $(TCL_LIB) \
80		$(MSVCRT) \
81		kernel32.lib user32.lib
82
83EXTRA_LIBS    =	$(OLELIB) \
84		$(JPEGLIB) \
85		gdi32.lib \
86		oldnames.lib \
87		advapi32.lib \
88		winspool.lib
89
90TCL_ONLY_LIBS = $(TCL_LIB) $(MSVCRT)  kernel32.lib user32.lib advapi32.lib
91
92# ------------------------------------------------------------------------
93# 	Source and target directories
94# ------------------------------------------------------------------------
95
96srcdir        =	.
97instdirs      =	$(prefix) $(exec_prefix) $(bindir) $(libdir) \
98		$(includedir)
99instdirs      =	$(exec_prefix) $(prefix) $(libdir)
100
101# ------------------------------------------------------------------------
102# 	Directories containing Tcl and Tk include files and libraries
103# ------------------------------------------------------------------------
104
105JPEGDIR       =	$(srcdir)/../../jpeg-6b
106TCLDIR        =	$(srcdir)/../../tcl$(v3)
107TKDIR         =	$(srcdir)/../../tk$(v3)
108INCLUDES      =	-I. -I$(srcdir) \
109		-I"$(TOOLS32)/include" \
110		-I$(TCLDIR)/win \
111		-I$(TCLDIR)/generic \
112		-I$(TKDIR)/win \
113		-I$(TKDIR)/generic \
114		-I$(TKDIR)/xlib \
115		-I$(JPEGDIR)
116SHLIB_LD_LIBS =	$(COMMON_LIBS) $(EXTRA_LIBS)
117
118# ------------------------------------------------------------------------
119# 	You don't need to edit anything beyond this point
120# ------------------------------------------------------------------------
121
122N_OBJS =	bltTed.o
123V3_OBJS =	bltTri.o bltGrMt.o
124
125TK_OBJS =	tkButton.o tkFrame.o tkScrollbar.o
126
127GRAPH_OBJS =	bltGrAxis.o \
128		bltGrBar.o \
129		bltGrElem.o \
130		bltGrGrid.o \
131		bltGrHairs.o \
132		bltGrLegd.o \
133		bltGrLine.o \
134		bltGrMarker.o \
135		bltGrMisc.o \
136		bltGrPen.o \
137		bltGrPs.o \
138		bltGraph.o
139
140TCL_ONLY_OBJS =	bltAlloc.o \
141		bltArrayObj.o \
142		bltBgexec.o \
143		bltChain.o \
144		bltDebug.o \
145		bltHash.o \
146		bltList.o \
147		bltNsUtil.o \
148		bltParse.o \
149		bltPool.o \
150		bltSpline.o \
151		bltSwitch.o \
152		bltTree.o \
153		bltTreeCmd.o \
154		bltUnixPipe.o \
155		bltUtil.o \
156		bltVector.o \
157		bltVecMath.o \
158		bltVecCmd.o \
159		bltVecObjCmd.o \
160		bltWatch.o
161
162OBJS =		$(GRAPH_OBJS) \
163		$(TCL_ONLY_OBJS) \
164		bltBeep.o \
165		bltBind.o \
166		bltBitmap.o \
167		bltBusy.o \
168		bltCanvEps.o \
169		bltColor.o \
170		bltConfig.o \
171		bltContainer.o \
172		bltCutbuffer.o \
173		bltDragdrop.o \
174		bltHierbox.o \
175		bltHtext.o \
176		bltImage.o \
177		bltUnixImage.o \
178		bltPs.o \
179		bltTable.o \
180		bltTabnotebook.o \
181		bltTabset.o \
182		bltText.o \
183		bltTile.o \
184		bltTreeView.o \
185		bltTreeViewCmd.o \
186		bltTreeViewEdit.o \
187		bltTreeViewColumn.o \
188		bltTreeViewStyle.o \
189		bltUnixDnd.o \
190		bltWindow.o \
191		bltObjConfig.o \
192		bltWinop.o \
193		$(TK_OBJS) $(N_OBJS)
194
195bltwish =	bltwish.exe
196bltsh =		bltsh.exe
197headers =	$(srcdir)/blt.h \
198		$(srcdir)/bltBind.h \
199		$(srcdir)/bltChain.h \
200		bltHash.h \
201		$(srcdir)/bltList.h \
202		$(srcdir)/bltPool.h \
203		$(srcdir)/bltTree.h \
204		$(srcdir)/bltVector.h
205
206version       =	$(BLT_MAJOR_VERSION)$(BLT_MINOR_VERSION)
207bltwish2 =	bltwish$(version).exe
208bltsh2 =	bltsh$(version).exe
209
210lib_name =	BLT$(version)
211lib_a =		BLT$(version).lib
212lib_so =	BLT$(version).dll
213tcl_only_lib_a = BLTlite$(version).lib
214tcl_only_lib_so = BLTlite$(version).dll
215
216CC_SWITCHES   =	$(CFLAGS) $(EXTRA_CFLAGS) $(DEFINES) $(INCLUDES)
217VPATH         =	$(srcdir)
218
219all: build-library $(SHLIB_TARGET) build-demos
220
221build-demos: $(SHLIB_TARGET) $(bltwish) $(bltsh)
222
223build-library: $(BLT_LIB)
224
225build-library: $(lib_a) $(tcl_only_lib_a)
226
227build-dll: build-library $(lib_so) $(tcl_only_lib_so)
228
229$(bltwish): $(lib_a) tkConsole.o  bltWinMain.c
230	$(RM) $(bltwish)
231	$(CC) -c $(CC_SWITCHES) -DTCLLIBPATH=\"$(TCLLIBPATH)\" \
232		-FobltWinMain.o $(srcdir)/bltWinMain.c
233	LIB=$(TOOLS32)/lib \
234	$(LD) $(LDFLAGS) tkConsole.o bltWinMain.o -out:$(bltwish) \
235		$(lib_a) $(LIBS)
236
237$(bltsh): $(tcl_only_lib_a) bltWinMain.c
238	$(RM) $(bltsh)
239	$(CC) -c $(CC_SWITCHES) -DTCL_ONLY \
240		-DTCLLIBPATH=\"$(TCLLIBPATH)\" \
241		-FobltWinMain.o $(srcdir)/bltWinMain.c
242	LIB=$(TOOLS32)/lib \
243	$(LD) $(LDFLAGS) bltWinMain.o -out:$(bltsh) \
244		$(tcl_only_lib_a) $(TCL_ONLY_LIBS)
245
246$(lib_a):  bltHash.h $(OBJS) bltInit.c
247	$(RM) bltInit.o
248	$(CC) -c $(CC_SWITCHES)  -DBLT_LIBRARY=\"$(BLT_LIBRARY)\" \
249		-FobltInit.o $(srcdir)/bltInit.c
250	$(RM) $@
251	$(AR) -out:$@ bltInit.o $(OBJS)
252
253$(lib_so): $(lib_a) $(OBJS) bltInit.c
254	$(RM) bltInit.o
255	$(CC) -c $(CC_SWITCHES) -DBLT_LIBRARY=\"$(BLT_LIBRARY)\" \
256		-FobltInit.o $(srcdir)/bltInit.c
257	$(RM) $@
258	LIB=$(TOOLS32)/lib \
259	$(LD) $(SHLIB_LDFLAGS) -out:$@ bltInit.o $(OBJS) $(SHLIB_LD_LIBS)
260
261$(tcl_only_lib_a):  bltHash.h $(TCL_ONLY_OBJS) bltInit.c
262	$(RM) bltInit.o
263	$(CC) -c $(CC_SWITCHES) -DTCL_ONLY -DBLT_LIBRARY=\"$(BLT_LIBRARY)\" \
264		-FobltInit.o $(srcdir)/bltInit.c
265	$(RM) $@
266	$(AR) -out:$@ bltInit.o $(TCL_ONLY_OBJS)
267
268$(tcl_only_lib_so): $(tcl_only_lib_a) $(TCL_ONLY_OBJS) bltInit.c
269	$(RM) bltInit.o
270	$(CC) -c $(CC_SWITCHES) -DTCL_ONLY -DBLT_LIBRARY=\"$(BLT_LIBRARY)\" \
271		-FobltInit.o $(srcdir)/bltInit.c
272	$(RM) $@
273	LIB=$(TOOLS32)/lib \
274	$(LD) $(SHLIB_LDFLAGS) -out:$@ bltInit.o $(TCL_ONLY_OBJS) \
275		$(TCL_ONLY_LIBS)
276
277bltHash.h: bltHash.h.in
278	sed -e 's/@SIZEOF_VOID_P@/4/' \
279	    -e 's/@SIZEOF_INT@/4/' \
280	    -e 's/@SIZEOF_LONG@/4/' \
281	    -e 's/@SIZEOF_LONG_LONG@/8/' \
282	    -e 's/@HAVE_INTTYPES_H@/0/' \
283	    bltHash.h.in > bltHash.h
284
285clean:
286	-del *.o 2>nul
287	-del *.pdb 2>nul
288	-del *.exp 2>nul
289	-del $(lib_name).* 2>nul
290	-del $(bltwish) 2>nul
291	-del $(bltsh) 2>nul
292	-del $(srcdir)\*.bak 2>nul
293	-del $(srcdir)\*~ 2>nul
294	-del $(srcdir)\"#"* 2>nul
295
296{$(srcdir)}.c.o:
297	$(CC) -c $(CC_SWITCHES) -Fo$*.o $<
298
299
300
301
302
303
304
305
306
307