1#  Copyright (C) 2001-2007 Artifex Software, Inc.
2#  All Rights Reserved.
3#
4#  This software is provided AS-IS with no warranty, either express or
5#  implied.
6#
7#  This software is distributed under license and may not be copied, modified
8#  or distributed except as expressly authorized under the terms of that
9#  license.  Refer to licensing information at http://www.artifex.com/
10#  or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11#  San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12#
13# $Id: msvclib.mak 10592 2010-01-07 10:53:36Z robin $
14# makefile for Microsoft Visual C++ 4.1 or later, Windows NT or Windows 95 LIBRARY.
15#
16# All configurable options are surrounded by !ifndef/!endif to allow
17# preconfiguration from within another makefile.
18
19# ------------------------------- Options ------------------------------- #
20
21###### This section is the only part of the file you should need to edit.
22
23# ------ Generic options ------ #
24
25# Define the root directory for Ghostscript installation.
26
27!ifndef AROOTDIR
28AROOTDIR=c:/gs
29!endif
30!ifndef GSROOTDIR
31GSROOTDIR=$(AROOTDIR)/gs$(GS_DOT_VERSION)
32!endif
33
34# Define the directory that will hold documentation at runtime.
35
36!ifndef GS_DOCDIR
37GS_DOCDIR=$(GSROOTDIR)/doc
38!endif
39
40# Define the default directory/ies for the runtime initialization, resource and
41# font files.  Separate multiple directories with ';'.
42# Use / to indicate directories, not \.
43# MSVC will not allow \'s here because it sees '\;' CPP-style as an
44# illegal escape.
45
46!ifndef GS_LIB_DEFAULT
47GS_LIB_DEFAULT=$(GSROOTDIR)/Resource/Init;$(GSROOTDIR)/lib;$(GSROOTDIR)/Resource;$(AROOTDIR)/fonts
48!endif
49
50# Define whether or not searching for initialization files should always
51# look in the current directory first.  This leads to well-known security
52# and confusion problems, but users insist on it.
53# NOTE: this also affects searching for files named on the command line:
54# see the "File searching" section of Use.htm for full details.
55# Because of this, setting SEARCH_HERE_FIRST to 0 is not recommended.
56
57!ifndef SEARCH_HERE_FIRST
58SEARCH_HERE_FIRST=1
59!endif
60
61# Define the name of the interpreter initialization file.
62# (There is no reason to change this.)
63
64GS_INIT=gs_init.ps
65
66# Choose generic configuration options.
67
68# Setting DEBUG=1 includes debugging features (-Z switch) in the code.
69# Code runs substantially slower even if no debugging switches are set,
70# and also takes about another 25K of memory.
71
72!ifndef DEBUG
73DEBUG=0
74!endif
75
76# Setting TDEBUG=1 includes symbol table information for the debugger,
77# and also enables stack checking.  Code is substantially slower and larger.
78
79# NOTE: The MSVC++ 5.0 compiler produces incorrect output code with TDEBUG=0.
80# Leave TDEBUG set to 1.
81
82!ifndef TDEBUG
83TDEBUG=1
84!endif
85
86# Define the name of the executable file.
87
88!ifndef GS
89GS=gslib
90!endif
91
92# Define the directory for the final executable, and the
93# source, generated intermediate file, and object directories
94# for the graphics library (GL) and the PostScript/PDF interpreter (PS).
95
96!ifndef BINDIR
97BINDIR=.\bin
98!endif
99!ifndef GLSRCDIR
100GLSRCDIR=.\base
101!ifndef PSRESDIR
102PSRESDIR=.\Resource
103!endif
104!endif
105!ifndef GLGENDIR
106!if "$(DEBUG)"="1"
107GLGENDIR=.\debugobj
108!else
109GLGENDIR=.\obj
110!endif
111!endif
112!ifndef GLOBJDIR
113!if "$(DEBUG)"="1"
114GLOBJDIR=.\debugobj
115!else
116GLOBJDIR=.\obj
117!endif
118!endif
119
120# Do not edit the next group of lines.
121NUL=
122DD=$(GLGENDIR)\$(NUL)
123GLD=$(GLGENDIR)\$(NUL)
124
125# Define the directory where the IJG JPEG library sources are stored,
126# and the major version of the library that is stored there.
127# You may need to change this if the IJG library version changes.
128# See jpeg.mak for more information.
129
130!ifndef JSRCDIR
131JSRCDIR=jpeg
132!endif
133
134# Define the directory where the PNG library sources are stored,
135# and the version of the library that is stored there.
136# You may need to change this if the libpng version changes.
137# See libpng.mak for more information.
138
139!ifndef PNGSRCDIR
140PNGSRCDIR=libpng
141!endif
142
143# Define the directory where the zlib sources are stored.
144# See zlib.mak for more information.
145
146!ifndef ZSRCDIR
147ZSRCDIR=zlib
148!endif
149
150# Define the jbig2 library and source location.
151# See jbig2.mak for more information.
152
153!ifndef JBIG2_LIB
154JBIG2_LIB=jbig2dec
155!endif
156
157!ifndef JBIG2SRCDIR
158JBIG2SRCDIR=jbig2dec
159!endif
160
161# Define the jasper library source location.
162# See jasper.mak for more information.
163
164!ifndef JPX_LIB
165JPX_LIB=jasper
166!endif
167
168# Alternatively, you can build a separate DLL
169# and define SHARE_JPX=1 in src/winlib.mak
170
171!ifndef JPXSRCDIR
172JPXSRCDIR=jasper
173!endif
174
175# Define the directory where the icclib source are stored.
176# See icclib.mak for more information
177
178!ifndef ICCSRCDIR
179ICCSRCDIR=icclib
180!endif
181
182# Define the directory where the imdi library source is stored.
183# See devs.mak for more information
184
185!ifndef IMDISRCDIR
186IMDISRCDIR=imdi
187!endif
188
189# Define any other compilation flags.
190
191!ifndef CFLAGS
192CFLAGS=
193!endif
194
195# ------ Platform-specific options ------ #
196
197# Define which major version of MSVC is being used (currently, 4, 5 & 6 supported)
198
199!ifndef MSVC_VERSION
200MSVC_VERSION = 6
201!endif
202
203# Define the drive, directory, and compiler name for the Microsoft C files.
204# COMPDIR contains the compiler and linker (normally \msdev\bin).
205# MSINCDIR contains the include files (normally \msdev\include).
206# LIBDIR contains the library files (normally \msdev\lib).
207# COMP is the full C compiler path name (normally \msdev\bin\cl).
208# COMPCPP is the full C++ compiler path name (normally \msdev\bin\cl).
209# COMPAUX is the compiler name for DOS utilities (normally \msdev\bin\cl).
210# RCOMP is the resource compiler name (normallly \msdev\bin\rc).
211# LINK is the full linker path name (normally \msdev\bin\link).
212# Note that when MSINCDIR and LIBDIR are used, they always get a '\' appended,
213#   so if you want to use the current directory, use an explicit '.'.
214
215!if $(MSVC_VERSION) == 4
216! ifndef DEVSTUDIO
217DEVSTUDIO=c:\msdev
218! endif
219COMPBASE=$(DEVSTUDIO)
220SHAREDBASE=$(DEVSTUDIO)
221!endif
222
223!if $(MSVC_VERSION) == 5
224! ifndef DEVSTUDIO
225DEVSTUDIO=C:\Program Files\Devstudio
226! endif
227!if "$(DEVSTUDIO)"==""
228COMPBASE=
229SHAREDBASE=
230!else
231COMPBASE=$(DEVSTUDIO)\VC
232SHAREDBASE=$(DEVSTUDIO)\SharedIDE
233!endif
234!endif
235
236!if $(MSVC_VERSION) == 6
237! ifndef DEVSTUDIO
238DEVSTUDIO=C:\Program Files\Microsoft Visual Studio
239! endif
240!if "$(DEVSTUDIO)"==""
241COMPBASE=
242SHAREDBASE=
243!else
244COMPBASE=$(DEVSTUDIO)\VC98
245SHAREDBASE=$(DEVSTUDIO)\Common\MSDev98
246!endif
247!endif
248
249# Some environments don't want to specify the path names for the tools at all.
250# Typical definitions for such an environment would be:
251#   MSINCDIR= LIBDIR= COMP=cl COMPAUX=cl RCOMP=rc LINK=link
252# COMPDIR, LINKDIR, and RCDIR are irrelevant, since they are only used to
253# define COMP, LINK, and RCOMP respectively, but we allow them to be
254# overridden anyway for completeness.
255!ifndef COMPDIR
256!if "$(COMPBASE)"==""
257COMPDIR=
258!else
259COMPDIR=$(COMPBASE)\bin
260!endif
261!endif
262
263!ifndef LINKDIR
264!if "$(COMPBASE)"==""
265LINKDIR=
266!else
267LINKDIR=$(COMPBASE)\bin
268!endif
269!endif
270
271!ifndef RCDIR
272!if "$(SHAREDBASE)"==""
273RCDIR=
274!else
275RCDIR=$(SHAREDBASE)\bin
276!endif
277!endif
278
279!ifndef MSINCDIR
280!if "$(COMPBASE)"==""
281MSINCDIR=
282!else
283MSINCDIR=$(COMPBASE)\include
284!endif
285!endif
286
287!ifndef LIBDIR
288!if "$(COMPBASE)"==""
289LIBDIR=
290!else
291LIBDIR=$(COMPBASE)\lib
292!endif
293!endif
294
295!ifndef COMP
296!if "$(COMPDIR)"==""
297COMP=cl
298!else
299COMP="$(COMPDIR)\cl"
300!endif
301!endif
302!ifndef COMPCPP
303COMPCPP=$(COMP)
304!endif
305!ifndef COMPAUX
306COMPAUX=$(COMP)
307!endif
308
309!ifndef RCOMP
310!if "$(RCDIR)"==""
311RCOMP=rc
312!else
313RCOMP="$(RCDIR)\rc"
314!endif
315!endif
316
317!ifndef LINK
318!if "$(LINKDIR)"==""
319LINK=link
320!else
321LINK="$(LINKDIR)\link"
322!endif
323!endif
324
325# nmake does not have a form of .BEFORE or .FIRST which can be used
326# to specify actions before anything else is done.  If LIB and INCLUDE
327# are not defined then we want to define them before we link or
328# compile.  Here is a kludge which allows us to to do what we want.
329# nmake does evaluate preprocessor directives when they are encountered.
330# So the desired set statements are put into dummy preprocessor
331# directives.
332!ifndef INCLUDE
333!if "$(MSINCDIR)"!=""
334!if [set INCLUDE=$(MSINCDIR)]==0
335!endif
336!endif
337!endif
338!ifndef LIB
339!if "$(LIBDIR)"!=""
340!if [set LIB=$(LIBDIR)]==0
341!endif
342!endif
343!endif
344
345# Define the processor architecture. (i386, ppc, alpha)
346
347!ifndef CPU_FAMILY
348CPU_FAMILY=i386
349#CPU_FAMILY=ppc
350#CPU_FAMILY=alpha  # not supported yet - we need someone to tweak
351!endif
352
353# Define the processor (CPU) type. Allowable values depend on the family:
354#   i386: 386, 486, 586
355#   ppc: 601, 604, 620
356#   alpha: not currently used.
357
358!ifndef CPU_TYPE
359CPU_TYPE=486
360#CPU_TYPE=601
361!endif
362
363# Define the .dev module that implements thread and synchronization
364# primitives for this platform.  Don't change this unless you really know
365# what you're doing.
366
367!ifndef SYNC
368SYNC=winsync
369!endif
370
371# ------ Devices and features ------ #
372
373# Choose the language feature(s) to include.  See gs.mak for details.
374
375!ifndef FEATURE_DEVS
376FEATURE_DEVS=$(GLD)psl3lib.dev $(GLD)path1lib.dev $(GLD)dps2lib.dev $(GLD)psl2cs.dev $(GLD)cielib.dev $(GLD)imasklib.dev $(GLD)patlib.dev $(GLD)htxlib.dev $(GLD)roplib.dev $(GLD)devcmap.dev $(GLD)bbox.dev $(GLD)pipe.dev
377!endif
378
379# Choose whether to compile the .ps initialization files into the executable.
380# See gs.mak for details.
381
382!ifndef COMPILE_INITS
383COMPILE_INITS=0
384!endif
385
386# Choose whether to store band lists on files or in memory.
387# The choices are 'file' or 'memory'.
388
389!ifndef BAND_LIST_STORAGE
390BAND_LIST_STORAGE=file
391!endif
392
393# Choose which compression method to use when storing band lists in memory.
394# The choices are 'lzw' or 'zlib'.
395
396!ifndef BAND_LIST_COMPRESSOR
397BAND_LIST_COMPRESSOR=zlib
398!endif
399
400# Choose the implementation of file I/O: 'stdio', 'fd', or 'both'.
401# See gs.mak and sfilefd.c for more details.
402
403!ifndef FILE_IMPLEMENTATION
404FILE_IMPLEMENTATION=stdio
405!endif
406
407# Choose the implementation of stdio: Only '' is allowed for library.
408# See gs.mak and ziodevs.c/ziodevsc.c for more details.
409
410STDIO_IMPLEMENTATION=
411
412# Choose the device(s) to include.  See devs.mak for details,
413# devs.mak and contrib.mak for the list of available devices.
414!ifndef DEVICE_DEVS
415DEVICE_DEVS=$(DD)ljet2p.dev $(DD)bbox.dev
416DEVICE_DEVS1=
417DEVICE_DEVS2=
418DEVICE_DEVS3=
419DEVICE_DEVS4=
420DEVICE_DEVS5=
421DEVICE_DEVS6=
422DEVICE_DEVS7=
423DEVICE_DEVS8=
424DEVICE_DEVS9=
425DEVICE_DEVS10=
426DEVICE_DEVS11=
427DEVICE_DEVS12=
428DEVICE_DEVS13=
429DEVICE_DEVS14=
430DEVICE_DEVS15=
431DEVICE_DEVS16=
432DEVICE_DEVS17=
433DEVICE_DEVS18=
434DEVICE_DEVS19=
435DEVICE_DEVS20=
436!endif
437
438# ---------------------------- End of options ---------------------------- #
439
440# Define the name of the makefile -- used in dependencies.
441
442MAKEFILE=$(GLSRCDIR)\msvclib.mak
443TOP_MAKEFILES=$(MAKEFILE) $(GLSRCDIR)\msvccmd.mak $(GLSRCDIR)\msvctail.mak $(GLSRCDIR)\winlib.mak
444
445# Define the files to be removed by `make clean'.
446# nmake expands macros when encountered, not when used,
447# so this must precede the !include statements.
448
449BEGINFILES2=$(GLOBJDIR)\$(GS).ilk $(GLOBJDIR)\$(GS).pdb $(GLOBJDIR)\genarch.ilk $(GLOBJDIR)\genarch.pdb $(GLOBJDIR)\*.sbr
450
451# Define these right away because they modify the behavior of
452# msvccmd.mak, msvctail.mak & winlib.mak.
453
454LIB_ONLY=$(GLOBJDIR)\gslib.obj $(GLOBJDIR)\gsnogc.obj $(GLOBJDIR)\gconfig.obj $(GLOBJDIR)\gscdefs.obj $(GLOBJDIR)\gsromfs$(COMPILE_INITS).obj
455MAKEDLL=0
456PLATFORM=mslib32_
457
458!include $(GLSRCDIR)\version.mak
459!include $(GLSRCDIR)\msvccmd.mak
460!include $(GLSRCDIR)\winlib.mak
461!include $(GLSRCDIR)\msvctail.mak
462
463# -------------------------------- Library -------------------------------- #
464
465# The Windows Win32 platform for library
466
467# For some reason, C-file dependencies have to come before mslib32__.dev
468
469$(GLOBJ)gp_mslib.$(OBJ): $(GLSRC)gp_mslib.c $(AK)
470	$(GLCCWIN) $(GLO_)gp_mslib.$(OBJ) $(C_) $(GLSRC)gp_mslib.c
471
472mslib32__=$(GLOBJ)gp_mslib.$(OBJ)
473
474$(GLGEN)mslib32_.dev: $(mslib32__) $(ECHOGS_XE) $(GLGEN)mswin32_.dev
475	$(SETMOD) $(GLGEN)mslib32_ $(mslib32__)
476	$(ADDMOD) $(GLGEN)mslib32_ -include $(GLGEN)mswin32_.dev
477
478# ----------------------------- Main program ------------------------------ #
479
480# The library tester EXE
481$(GS_XE):  $(GS_ALL) $(DEVS_ALL) $(LIB_ONLY) $(LIBCTR)
482	copy $(ld_tr) $(GLGENDIR)\gslib32.tr
483	echo $(GLOBJDIR)\gsromfs$(COMPILE_INITS).$(OBJ) >> $(GLGENDIR)\gslib32.tr
484	echo $(GLOBJ)gsnogc.obj >> $(GLGENDIR)\gslib32.tr
485	echo $(GLOBJ)gconfig.obj >> $(GLGENDIR)\gslib32.tr
486	echo $(GLOBJ)gscdefs.obj >> $(GLGENDIR)\gslib32.tr
487	echo  /SUBSYSTEM:CONSOLE > $(GLGENDIR)\gslib32.rsp
488	echo  /OUT:$(GS_XE) >> $(GLGENDIR)\gslib32.rsp
489	$(LINK) $(LCT) @$(GLGENDIR)\gslib32.rsp $(GLOBJ)gslib @$(GLGENDIR)\gslib32.tr @$(LIBCTR)
490	-del $(GLGENDIR)\gslib32.rsp
491	-del $(GLGENDIR)\gslib32.tr
492