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