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