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