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 Unix/gcc/X11 configuration.
16
17# ------------------------------- Options ------------------------------- #
18
19####### The following are the only parts of the file you should need to edit.
20
21# Define the directory for the final executable, and the
22# source, generated intermediate file, and object directories
23# for the graphics library (GL) and the PostScript/PDF interpreter (PS).
24
25BINDIR=./$(BUILDDIRPREFIX)bin
26GLSRCDIR=./base
27GLGENDIR=./$(BUILDDIRPREFIX)obj
28GLOBJDIR=./$(BUILDDIRPREFIX)obj
29AUXDIR=$(GLGENDIR)/aux
30PSSRCDIR=./psi
31PSLIBDIR=./lib
32PSRESDIR=./Resource
33PSGENDIR=./$(BUILDDIRPREFIX)obj
34PSOBJDIR=./$(BUILDDIRPREFIX)obj
35
36# Do not edit the next group of lines.
37
38#include $(COMMONDIR)/gccdefs.mak
39#include $(COMMONDIR)/unixdefs.mak
40#include $(COMMONDIR)/generic.mak
41include $(GLSRCDIR)/version.mak
42DD=$(GLGENDIR)/
43GLD=$(GLGENDIR)/
44PSD=$(PSGENDIR)/
45
46# ------ Generic options ------ #
47
48# Define the installation commands and target directories for
49# executables and files.  The commands are only relevant to `make install';
50# the directories also define the default search path for the
51# initialization files (gs_*.ps) and the fonts.
52
53INSTALL = $(GLSRCDIR)/instcopy -c
54INSTALL_PROGRAM = $(INSTALL) -m 755
55INSTALL_DATA = $(INSTALL) -m 644
56
57prefix = /usr/local
58exec_prefix = $(prefix)
59bindir = $(exec_prefix)/bin
60scriptdir = $(bindir)
61includedir = $(prefix)/include
62libdir = $(exec_prefix)/lib
63mandir = $(prefix)/man
64man1ext = 1
65datadir = $(prefix)/share
66gsdir = $(datadir)/ghostscript
67gsdatadir = $(gsdir)/$(GS_DOT_VERSION)
68gssharedir = $(libdir)/ghostscript/$(GS_DOT_VERSION)
69gsincludedir = $(includedir)/ghostscript/
70
71docdir=$(gsdatadir)/doc
72exdir=$(gsdatadir)/examples
73GS_DOCDIR=$(docdir)
74
75# Define the default directory/ies for the runtime
76# initialization, resource and font files.  Separate multiple directories with a :.
77
78GS_LIB_DEFAULT=$(gsdatadir)/Resource/Init:$(gsdatadir)/lib:$(gsdatadir)/Resource/Font:$(gsdir)/fonts
79
80# Define whether or not searching for initialization files should always
81# look in the current directory first.  This leads to well-known security
82# and confusion problems,  but may be convenient sometimes.
83
84SEARCH_HERE_FIRST=0
85
86# Define the name of the interpreter initialization file.
87# (There is no reason to change this.)
88
89GS_INIT=gs_init.ps
90
91# Choose generic configuration options.
92
93# -DDEBUG
94#	includes debugging features (-Z switch) in the code.
95#	  Code runs substantially slower even if no debugging switches
96#	  are set.
97
98GENOPT=
99
100# Choose capability options.
101
102# -DHAVE_MKSTEMP
103#       uses mkstemp instead of mktemp
104#               This uses the more secure temporary file creation call
105#               Enable this if it is available on your platform.
106
107CAPOPT= -DHAVE_MKSTEMP
108
109# Define the name of the executable file.
110
111GS=gs
112
113# Define the directories for debugging and profiling binaries, relative to
114# the standard binaries.
115
116DEBUGDIRPREFIX=debug
117MEMENTODIRPREFIX=mem
118PGDIRPREFIX=pg
119
120# Define whether to compile in the FreeType library, and if so, where
121# the source tree is location. Otherwise, what library name to use
122# in linking to a shared implementation.
123
124FT_BRIDGE=1
125SHARE_FT=0
126FTSRCDIR=freetype
127FT_CFLAGS=-Ifreetype/include
128FT_LIBS=
129
130# Define the directory where the IJG JPEG library sources are stored,
131# and the major version of the library that is stored there.
132# You may need to change this if the IJG library version changes.
133# See jpeg.mak for more information.
134
135JSRCDIR=jpeg
136
137# Note: if a shared library is used, it may not contain the
138# D_MAX_BLOCKS_IN_MCU patch, and thus may not be able to read
139# some older JPEG streams that violate the standard. If the JPEG
140# library built from local sources, the patch will be applied.
141
142SHARE_JPEG=0
143JPEG_NAME=jpeg
144
145# Define the directory where the PNG library sources are stored,
146# and the version of the library that is stored there.
147# You may need to change this if the libpng version changes.
148# See png.mak for more information.
149
150PNGSRCDIR=libpng
151
152# Choose whether to use a shared version of the PNG library, and if so,
153# what its name is.
154# See gs.mak and Make.htm for more information.
155
156SHARE_LIBPNG=0
157LIBPNG_NAME=png
158
159# Define whether to use a shared version of libtiff and where
160# it is stored and what its name is.
161
162SHARE_LIBTIFF=0
163TIFFSRCDIR=tiff
164TIFFPLATFORM=unix
165TIFFCONFIG_SUFFIX=.unix
166LIBTIFF_NAME=tiff
167
168# Define the directory where the zlib sources are stored.
169# See zlib.mak for more information.
170
171ZSRCDIR=zlib
172
173# Choose whether to use a shared version of the zlib library, and if so,
174# what its name is (usually libz, but sometimes libgz).
175# See gs.mak and Make.htm for more information.
176
177SHARE_ZLIB=0
178#ZLIB_NAME=gz
179ZLIB_NAME=z
180
181# Choose shared or compiled in libjbig2dec and source location
182SHARE_JBIG2=0
183JBIG2_LIB=jbig2dec
184JBIG2SRCDIR=jbig2dec
185
186# Define the directory where the icclib source are stored.
187# See icclib.mak for more information
188ICCSRCDIR=icclib
189
190# Define the directory where the lcms source is stored.
191# See lcms.mak for more information
192
193SHARE_LCMS=0
194LCMSSRCDIR=lcms
195
196# Define the directory where the lcms2 source is stored.
197# See lcms2.mak for more information
198
199LCMS2SRCDIR=lcms2
200
201# Which CMS are we using?
202# Options are currently lcms or lcms2
203
204WHICH_CMS=lcms2
205
206# Define the directory where the ijs source is stored,
207# and the process forking method to use for the server.
208# See ijs.mak for more information.
209
210SHARE_IJS=0
211IJS_NAME=
212IJSSRCDIR=ijs
213IJSEXECTYPE=unix
214
215# Define how to build the library archives.  (These are not used in any
216# standard configuration.)
217
218AR=ar
219ARFLAGS=qc
220RANLIB=ranlib
221
222# ------ Platform-specific options ------ #
223
224# Define the name of the C compiler.
225
226CC=gcc
227
228# Define the name of the linker for the final link step.
229# Normally this is the same as the C compiler.
230
231CCLD=$(CC)
232
233# Define the default gcc flags.
234# Note that depending whether or not we are running a version of gcc with
235# the 2.7.0-2.7.2 optimizer bug, either "-Dconst=" or
236# "-Wcast-qual -Wwrite-strings" is automatically included.
237
238GCFLAGS=-Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -fno-builtin -fno-common
239
240# Define the added flags for standard, debugging, profiling
241# and shared object builds.
242
243CFLAGS_STANDARD=-O2
244CFLAGS_DEBUG=-g -O0
245CFLAGS_PROFILE=-pg -O2
246CFLAGS_SO=-fPIC
247
248# Define the other compilation flags.  Add at most one of the following:
249#	-DBSD4_2 for 4.2bsd systems.
250#	-DSYSV for System V or DG/UX.
251# 	-DSYSV -D__SVR3 for SCO ODT, ISC Unix 2.2 or before,
252#	   or any System III Unix, or System V release 3-or-older Unix.
253#	-DSVR4 -DSVR4_0 (not -DSYSV) for System V release 4.0.
254#	-DSVR4 (not -DSYSV) for System V release 4.2 (or later) and Solaris 2.
255# XCFLAGS can be set from the command line.
256# We don't include -ansi, because this gets in the way of the platform-
257#   specific stuff that <math.h> typically needs; nevertheless, we expect
258#   gcc to accept ANSI-style function prototypes and function definitions.
259XCFLAGS=-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\"$(gssharedir)\"
260
261CFLAGS=$(CFLAGS_STANDARD) $(GCFLAGS) $(XCFLAGS)
262
263# Define platform flags for ld.
264# SunOS 4.n may need -Bstatic.
265# Solaris 2.6 (and possibly some other versions) with any of the SHARE_
266# parameters set to 1 may need
267#	-R /usr/local/xxx/lib:/usr/local/lib
268# giving the full path names of the shared library directories.
269# XLDFLAGS can be set from the command line.
270XLDFLAGS=
271
272LDFLAGS=$(XLDFLAGS)
273
274# Define any extra libraries to link into the executable.
275# ISC Unix 2.2 wants -linet.
276# SCO Unix needs -lsocket if you aren't including the X11 driver.
277# SVR4 may need -lnsl.
278# Solaris may need -lnsl -lsocket -lposix4.
279# (Libraries required by individual drivers are handled automatically.)
280
281EXTRALIBS=-rdynamic -ldl
282
283# Define the standard libraries to search at the end of linking.
284# Most platforms require -lpthread for the POSIX threads library;
285# on FreeBSD, change -lpthread to -lc_r; BSDI and perhaps some others
286# include pthreads in libc and don't require any additional library.
287# All reasonable platforms require -lm, but Rhapsody and perhaps one or
288# two others fold libm into libc and don't require any additional library.
289
290#STDLIBS=-lpthread -lm
291
292# Since the default build is for nosync, don't include pthread lib
293STDLIBS=-lm
294
295# Define the include switch(es) for the X11 header files.
296# This can be null if handled in some other way (e.g., the files are
297# in /usr/include, or the directory is supplied by an environment variable);
298# in particular, SCO Xenix, Unix, and ODT just want
299#XINCLUDE=
300# Note that x_.h expects to find the header files in $(XINCLUDE)/X11,
301# not in $(XINCLUDE).
302
303XINCLUDE=-I/usr/X11R6/include
304
305# Define the directory/ies and library names for the X11 library files.
306# XLIBDIRS is for ld and should include -L; XLIBDIR is for LD_RUN_PATH
307# (dynamic libraries on SVR4) and should not include -L.
308# Newer SVR4 systems can use -R in XLIBDIRS rather than setting XLIBDIR.
309# Both can be null if these files are in the default linker search path;
310# in particular, SCO Xenix, Unix, and ODT just want
311#XLIBDIRS=
312# Solaris and other SVR4 systems with dynamic linking probably want
313#XLIBDIRS=-L/usr/openwin/lib -R/usr/openwin/lib
314# X11R6 (on any platform) may need
315#XLIBS=Xt SM ICE Xext X11
316
317#XLIBDIRS=-L/usr/local/X/lib
318XLIBDIRS=-L/usr/X11R6/lib
319XLIBDIR=
320XLIBS=Xt Xext X11
321
322# Define the .dev module that implements thread and synchronization
323# primitives for this platform.
324
325# If POSIX sync primitives are used, also change the STDLIBS to include
326# the pthread library.
327#SYNC=posync
328
329# define the file name extension for a shared lib
330DYNANIC_LIB_EXT=so
331
332# Default is No sync primitives since some platforms don't have it (HP-UX)
333SYNC=nosync
334
335SOC_LOADER=dxmainc.c
336# ------ Devices and features ------ #
337
338# Choose the language feature(s) to include.  See gs.mak for details.
339
340FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(GLD)pipe.dev $(PSD)fapi.dev
341#FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev
342# The following is strictly for testing.
343FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)rasterop.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev
344#FEATURE_DEVS=$(FEATURE_DEVS_ALL)
345
346# Choose whether to compile the .ps initialization files into the executable.
347# See gs.mak for details.
348
349COMPILE_INITS=1
350
351# Choose whether to store band lists on files or in memory.
352# The choices are 'file' or 'memory'.
353
354BAND_LIST_STORAGE=file
355
356# Choose which compression method to use when storing band lists in memory.
357# The choices are 'lzw' or 'zlib'.
358
359BAND_LIST_COMPRESSOR=zlib
360
361# Choose the implementation of file I/O: 'stdio', 'fd', or 'both'.
362# See gs.mak and sfxfd.c for more details.
363
364FILE_IMPLEMENTATION=stdio
365
366# Choose the implementation of stdio: '' for file I/O and 'c' for callouts
367# See gs.mak and ziodevs.c/ziodevsc.c for more details.
368
369STDIO_IMPLEMENTATION=c
370
371# Override the default device.  This is set to 'display' by
372# unix-dll.mak when building a shared object.
373DISPLAY_DEV=
374
375# Choose the device(s) to include.  See devs.mak for details,
376# devs.mak and contrib.mak for the list of available devices.
377
378DEVICE_DEVS=$(DISPLAY_DEV) $(DD)x11.dev $(DD)x11alpha.dev $(DD)x11cmyk.dev $(DD)x11gray2.dev $(DD)x11gray4.dev $(DD)x11mono.dev
379
380#DEVICE_DEVS1=
381#DEVICE_DEVS2=
382#DEVICE_DEVS3=
383#DEVICE_DEVS4=
384#DEVICE_DEVS5=
385#DEVICE_DEVS6=
386#DEVICE_DEVS7=
387#DEVICE_DEVS8=
388#DEVICE_DEVS9=
389#DEVICE_DEVS10=
390#DEVICE_DEVS11=
391#DEVICE_DEVS12=
392#DEVICE_DEVS13=
393#DEVICE_DEVS14=
394#DEVICE_DEVS15=
395#DEVICE_DEVS16=
396#DEVICE_DEVS17=
397#DEVICE_DEVS18=
398#DEVICE_DEVS19=
399#DEVICE_DEVS20=
400
401DEVICE_DEVS1=$(DD)bmpmono.dev $(DD)bmpgray.dev $(DD)bmpsep1.dev $(DD)bmpsep8.dev $(DD)bmp16.dev $(DD)bmp256.dev $(DD)bmp16m.dev $(DD)bmp32b.dev $(DD)stcolor.dev
402DEVICE_DEVS2=$(DD)epson.dev $(DD)eps9high.dev $(DD)eps9mid.dev $(DD)epsonc.dev $(DD)ibmpro.dev
403DEVICE_DEVS3=$(DD)deskjet.dev $(DD)djet500.dev $(DD)laserjet.dev $(DD)ljetplus.dev $(DD)ljet2p.dev $(DD)ljet3.dev $(DD)ljet3d.dev $(DD)ljet4.dev $(DD)ljet4d.dev $(DD)lj5mono.dev $(DD)lj5gray.dev
404DEVICE_DEVS4=$(DD)cdeskjet.dev $(DD)cdjcolor.dev $(DD)cdjmono.dev $(DD)cdj550.dev $(DD)pj.dev $(DD)pjxl.dev $(DD)pjxl300.dev
405DEVICE_DEVS5=$(DD)uniprint.dev $(DD)ijs.dev
406DEVICE_DEVS6=$(DD)bj10e.dev $(DD)bj200.dev $(DD)bjc600.dev $(DD)bjc800.dev
407DEVICE_DEVS7=$(DD)faxg3.dev $(DD)faxg32d.dev $(DD)faxg4.dev
408DEVICE_DEVS8=$(DD)pcxmono.dev $(DD)pcxgray.dev $(DD)pcx16.dev $(DD)pcx256.dev $(DD)pcx24b.dev $(DD)pcxcmyk.dev
409DEVICE_DEVS9=$(DD)pbm.dev $(DD)pbmraw.dev $(DD)pgm.dev $(DD)pgmraw.dev $(DD)pgnm.dev $(DD)pgnmraw.dev $(DD)pnm.dev $(DD)pnmraw.dev $(DD)ppm.dev $(DD)ppmraw.dev $(DD)pkm.dev $(DD)pkmraw.dev $(DD)pksm.dev $(DD)pksmraw.dev
410DEVICE_DEVS10=$(DD)tiffcrle.dev $(DD)tiffg3.dev $(DD)tiffg32d.dev $(DD)tiffg4.dev $(DD)tifflzw.dev $(DD)tiffpack.dev
411DEVICE_DEVS11=$(DD)tiff12nc.dev $(DD)tiff24nc.dev $(DD)tiff48nc.dev $(DD)tiffgray.dev $(DD)tiff32nc.dev $(DD)tiff64nc.dev $(DD)tiffsep.dev $(DD)tiffsep1.dev $(DD)tiffscaled.dev $(DD)tiffscaled8.dev $(DD)tiffscaled24.dev
412DEVICE_DEVS12=$(DD)psmono.dev $(DD)psgray.dev $(DD)psrgb.dev $(DD)bit.dev $(DD)bitrgb.dev $(DD)bitcmyk.dev
413DEVICE_DEVS13=$(DD)pngmono.dev $(DD)pngmonod.dev $(DD)pnggray.dev $(DD)png16.dev $(DD)png256.dev $(DD)png16m.dev $(DD)pngalpha.dev
414DEVICE_DEVS14=$(DD)jpeg.dev $(DD)jpeggray.dev $(DD)jpegcmyk.dev
415DEVICE_DEVS15=$(DD)pdfwrite.dev $(DD)pswrite.dev $(DD)ps2write.dev $(DD)epswrite.dev $(DD)txtwrite.dev $(DD)pxlmono.dev $(DD)pxlcolor.dev
416DEVICE_DEVS16=$(DD)bbox.dev $(DD)inkcov.dev
417
418DEVICE_DEVS17=$(DD)plan.dev $(DD)planm.dev $(DD)plang.dev $(DD)planc.dev $(DD)plank.dev
419
420DEVICE_DEVS18=
421DEVICE_DEVS19=
422DEVICE_DEVS20=$(DD)cljet5.dev $(DD)cljet5c.dev $(DD)pamcmyk32.dev $(DD)pamcmyk4.dev
423DEVICE_DEVS21=$(DD)spotcmyk.dev $(DD)devicen.dev $(DD)xcf.dev $(DD)bmpsep1.dev $(DD)bmpsep8.dev $(DD)bmp16m.dev $(DD)bmp32b.dev $(DD)psdcmyk.dev $(DD)psdrgb.dev
424
425# Shared library target to build.
426# Note that the two vga devices are Linux specific, and requires svgalib
427# We also don't do X modularized because modularization on Mac OS X doesn't work.
428GS_SHARED_OBJS=
429#GS_SHARED_OBJS=$(GLOBJDIR)/X11.so $(GLOBJDIR)/lvga256.so $(GLOBJDIR)/vgalib.so
430
431
432# ---------------------------- End of options --------------------------- #
433
434# Define the name of the partial makefile that specifies options --
435# used in dependencies.
436
437MAKEFILE=$(GLSRCDIR)/unix-gcc.mak
438TOP_MAKEFILES=$(MAKEFILE) $(GLSRCDIR)/unixhead.mak
439
440# Define the auxiliary programs dependency. There aren't any, but we use
441# this as a hook to detect whether we're running a version of gcc with
442# the const optimization bug.
443
444AK=$(GLGENDIR)/cc.tr
445
446# Define the compilation rules and flags.
447
448CCFLAGS=$(GENOPT) $(CAPOPT) $(CFLAGS) -DGX_COLOR_INDEX_TYPE='unsigned long long'
449CC_=$(CC) `cat $(AK)` $(CCFLAGS)
450CCAUX=$(CC) `cat $(AK)` $(CFLAGS)
451# These are the specific warnings we have to turn off to compile those
452# specific few files that need this.  We may turn off others in the future.
453CC_NO_WARN=$(CC_) -Wno-cast-qual -Wno-traditional
454CC_SHARED=$(CC_) $(CFLAGS_SO)
455
456LD_SET_DT_SONAME=-soname=
457
458# MAKEDIRS = the dependency on ALL object files (must be the last one on
459# the line. Requires GNU make to make it an 'order only' dependency
460# MAKEDIRSTOP = the topmost dependency - set this if you can't set MAKEDIRS
461MAKEDIRS=
462MAKEDIRSTOP=directories
463
464# ---------------- End of platform-specific section ---------------- #
465
466include $(GLSRCDIR)/unixhead.mak
467include $(GLSRCDIR)/gs.mak
468# psromfs.mak must precede lib.mak
469include $(PSSRCDIR)/psromfs.mak
470include $(GLSRCDIR)/lib.mak
471include $(PSSRCDIR)/int.mak
472include $(GLSRCDIR)/freetype.mak
473include $(GLSRCDIR)/jpeg.mak
474# zlib.mak must precede png.mak
475include $(GLSRCDIR)/zlib.mak
476include $(GLSRCDIR)/png.mak
477include $(GLSRCDIR)/tiff.mak
478include $(GLSRCDIR)/jbig2.mak
479include $(GLSRCDIR)/icclib.mak
480include $(GLSRCDIR)/lcms.mak
481include $(GLSRCDIR)/ijs.mak
482include $(GLSRCDIR)/devs.mak
483include $(GLSRCDIR)/contrib.mak
484include $(GLSRCDIR)/unix-aux.mak
485include $(GLSRCDIR)/unixlink.mak
486include $(GLSRCDIR)/unix-dll.mak
487include $(GLSRCDIR)/unix-end.mak
488include $(GLSRCDIR)/unixinst.mak
489
490# This has to come last so it won't be taken as the default target.
491$(AK):
492	if ( $(CC) --version | egrep "^2\.7\.([01]|2(\.[^1-9]|$$))" >/dev/null ); then echo -Dconst= >$(AK); else echo -Wcast-qual -Wwrite-strings >$(AK); fi
493
494# platform-specific clean-up
495# this makefile is intended to be hand edited so we don't distribute
496# the (presumedly modified) version in the top level directory
497distclean : clean config-clean
498	-$(RM) Makefile
499	@-rmdir $(BINDIR) $(GLOBJDIR) $(PSOBJDIR)
500
501maintainer-clean : distclean
502	# nothing special to do
503
504
505