1# Copyright (C) 2001-2019 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.,  1305 Grant Avenue - Suite 200, Novato,
13# CA 94945, U.S.A., +1(415)492-9861, for further information.
14#
15# makefile for OpenVMS VAX and Alpha using MMK
16#
17# Please contact Jim Dunham (dunham@omtool.com) if you have questions.
18# Addapted for MMK by Jouk Jansen (joukj@hrem.stm.tudelft.nl)
19# Support for VAX C on OpenVMS was removed in release 6.01 by Aladdin:
20# DEC C is now used on both VAX and Alpha platforms.
21#
22# ------------------------------- Options ------------------------------- #
23
24###### This section is the only part of the file you should need to edit.
25
26# on the make command line specify:
27#	mmk/descrip=[.base]openvms.mmk/macro=("DECWINDOWS1_2={0,1}")
28
29# Define the directory for the final executable, and the
30# source, generated intermediate file, and object directories
31# for the graphics library (GL) and the PostScript/PDF interpreter (PS).
32
33BINDIR=[.bin]
34GLSRCDIR=[.base]
35DEVSRCDIR=[.devices]
36GLGENDIR=[.obj]
37GLOBJDIR=[.obj]
38DEVGENDIR=[.obj]
39DEVOBJDIR=[.obj]
40PSSRCDIR=[.psi]
41PSGENDIR=[.obj]
42PSOBJDIR=[.obj]
43PSLIBDIR=[.lib]
44# Because of OpenVMS syntactic problems, the following redundant definitions
45# are necessary.  If you are using more than one GENDIR and/or OBJDIR,
46# you will have to edit the code below that creates these directories.
47BIN_DIR=BIN.DIR
48OBJ_DIR=OBJ.DIR
49
50# create directories
51.first
52	if f$search("$(BIN_DIR)") .eqs. "" then create/directory/log $(BINDIR)
53	if f$search("$(OBJ_DIR)") .eqs. "" then create/directory/log $(GLOBJDIR)
54
55# Do not edit the next group of lines.
56
57#.include $(COMMONDIR)vmscdefs.mak
58#.include $(COMMONDIR)vmsdefs.mak
59#.include $(COMMONDIR)generic.mak
60.include $(GLSRCDIR)version.mak
61DD=$(GLGENDIR)
62GLD=$(GLGENDIR)
63PSD=$(PSGENDIR)
64
65# ------ Generic options ------ #
66
67# Define the directory that will hold documentation at runtime.
68
69GS_DOCDIR=GS_DOC
70#GS_DOCDIR=SYS$COMMON:[GS]
71
72# Define the default directory/ies for the runtime
73# initialization and font files.  Separate multiple directories with ,.
74
75GS_LIB_DEFAULT=GS_LIB
76#GS_LIB_DEFAULT=SYS$COMMON:[GS],SYS$COMMON:[GS.FONT]
77
78# Define whether or not searching for initialization files should always
79# look in the current directory first.  This leads to well-known security
80# and confusion problems,  but may be convenient sometimes.
81
82SEARCH_HERE_FIRST=0
83
84# Define the name of the interpreter initialization file.
85# (There is no reason to change this.)
86
87GS_INIT=GS_INIT.PS
88
89# Choose generic configuration options.
90
91# Setting DEBUG=1 includes debugging features in the code
92
93DEBUG=0
94
95# Setting TDEBUG=1 includes symbol table information for the debugger,
96# and also enables stack tracing on failure.
97
98TDEBUG=
99
100# Setting CDEBUG=1 enables 'C' compiler debugging and turns off optimization
101# Code is substantially slower and larger.
102
103CDEBUG=
104
105# Define the name of the executable file.
106
107GS=GS
108
109# Define the directory where the IJG JPEG library sources are stored,
110# and the major version of the library that is stored there.
111# You may need to change this if the IJG library version changes.
112# See jpeg.mak for more information.
113
114.ifdef SYSLIB
115JSRCDIR=sys$library:
116.else
117JSRCDIR=[.jpeg]
118.endif
119
120# Define the directory where the PNG library sources are stored,
121# and the version of the library that is stored there.
122# You may need to change this if the libpng version changes.
123# See png.mak for more information.
124
125.ifdef SYSLIB
126PNGSRCDIR=sys$library:
127.else
128PNGSRCDIR=[.libpng]
129.endif
130
131# Define the directory where the zlib sources are stored.
132# See zlib.mak for more information.
133
134.ifdef SYSLIB
135ZSRCDIR=sys$library:
136.else
137ZSRCDIR=[.zlib]
138.endif
139
140# Define the directory where the jbig2dec library sources are stored.
141# See jbig2.mak for more information
142
143JBIG2_LIB=jbig2dec
144.ifdef SYSLIB
145JBIG2SRCDIR=sys$library:
146.else
147JBIG2SRCDIR=[.jbig2dec]
148.endif
149
150# Define the jpeg2k library and source directory
151
152# IJS has not been ported to OpenVMS. If you do the port,
153# you'll need to set these values. You'll also need to
154# include the ijs.mak makefile
155#
156# Define the directory where the ijs source is stored,
157# and the process forking method to use for the server.
158# See ijs.mak for more information.
159
160#IJSSRCDIR=[.ijs]
161#IJSEXECTYPE=unix
162
163# Note that built-in third-party libraries aren't available.
164
165SHARE_JPEG=0
166SHARE_LIBPNG=0
167SHARE_ZLIB=0
168SHARE_JBIG2=0
169
170# Define the path to X11 include files
171
172X_INCLUDE=DECW$INCLUDE
173
174# ------ Platform-specific options ------ #
175
176# Define the drive, directory, and compiler name for the 'C' compiler.
177# COMP is the full compiler path name.
178
179.ifdef DEBUG
180SW_DEBUG=/DEBUG/NOOPTIMIZE
181.else
182# This should include /OPTIMIZE, but some OpenVMS compilers have an
183# optimizer bug that causes them to generate incorrect code for gdevpsfx.c,
184# so we must disable optimization.  (Eventually we will check for the bug
185# in genarch and enable optimization if it is safe.)
186#SW_DEBUG=/NODEBUG/OPTIMIZE
187SW_DEBUG=/NODEBUG/NOOPTIMIZE
188.endif
189
190SW_PLATFORM=/DECC/PREFIX=ALL/NESTED_INCLUDE=PRIMARY/name=(as_is,short)/nowarn
191
192# Define any other compilation flags.
193# Including defines for A4 paper size
194
195.ifdef A4_PAPER
196SW_PAPER=/DEFINE=("A4","HAVE_MKSTEMP")
197.else
198SW_PAPER=/DEFINE=("HAVE_MKSTEMP")
199.endif
200
201.ifdef IEEE
202SW_IEEE=/float=ieee
203.else
204SW_IEEE=
205.endif
206
207COMP=CC$(SW_DEBUG)$(SW_PLATFORM)$(SW_PAPER)$(SW_IEEE)
208
209# LINK is the full linker path name
210
211.ifdef TDEBUG
212LINKER=LINK/DEBUG/TRACEBACK
213.else
214LINKER=LINK/NODEBUG/NOTRACEBACK
215.endif
216
217# INCDIR contains the include files
218INCDIR=
219
220# LIBDIR contains the library files
221LIBDIR=
222
223# Define the .dev module that implements thread and synchronization
224# primitives for this platform.  Don't change this unless you really know
225# what you're doing.
226
227SYNC=posync
228
229# ------ Devices and features ------ #
230
231# Choose the device(s) to include.  See devs.mak for details,
232# devs.mak and contrib.mak for the list of available devices.
233
234DEVICE_DEVS=$(DD)x11.dev $(DD)x11alpha.dev $(DD)x11cmyk.dev $(DD)x11gray2.dev $(DD)x11gray4.dev $(DD)x11mono.dev
235DEVICE_DEVS1=
236DEVICE_DEVS2=
237DEVICE_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
238DEVICE_DEVS4=$(DD)cdeskjet.dev $(DD)cdjcolor.dev $(DD)cdjmono.dev $(DD)cdj550.dev $(DD)pj.dev $(DD)pjxl.dev $(DD)pjxl300.dev
239DEVICE_DEVS5=$(DD)uniprint.dev
240DEVICE_DEVS6=$(DD)bj10e.dev $(DD)bj200.dev $(DD)bjc600.dev $(DD)bjc800.dev
241DEVICE_DEVS7=$(DD)faxg3.dev $(DD)faxg32d.dev $(DD)faxg4.dev
242DEVICE_DEVS8=$(DD)pcxmono.dev $(DD)pcxgray.dev $(DD)pcx16.dev $(DD)pcx256.dev $(DD)pcx24b.dev $(DD)pcxcmyk.dev
243DEVICE_DEVS9=$(DD)pbm.dev $(DD)pbmraw.dev $(DD)pgm.dev $(DD)pgmraw.dev $(DD)pgnm.dev $(DD)pgnmraw.dev
244DEVICE_DEVS10=$(DD)tiffcrle.dev $(DD)tiffg3.dev $(DD)tiffg32d.dev $(DD)tiffg4.dev $(DD)tifflzw.dev $(DD)tiffpack.dev
245DEVICE_DEVS11=$(DD)tiff12nc.dev $(DD)tiff24nc.dev
246DEVICE_DEVS12=$(DD)bit.dev $(DD)bitrgb.dev $(DD)bitcmyk.dev
247DEVICE_DEVS13=$(DD)pngmono.dev $(DD)pnggray.dev $(DD)png16.dev $(DD)png256.dev $(DD)png16m.dev $(DD)pngalpha.dev
248DEVICE_DEVS14=$(DD)jpeg.dev $(DD)jpeggray.dev
249DEVICE_DEVS15=$(DD)pdfwrite.dev $(DD)eps2write.dev $(DD)pxlmono.dev $(DD)pxlcolor.dev
250DEVICE_DEVS16=$(DD)bbox.dev
251# Overflow from DEVS9
252DEVICE_DEVS17=$(DD)pnm.dev $(DD)pnmraw.dev $(DD)ppm.dev $(DD)ppmraw.dev $(DD)pkm.dev $(DD)pkmraw.dev $(DD)pksm.dev $(DD)pksmraw.dev
253DEVICE_DEVS18=
254DEVICE_DEVS19=
255DEVICE_DEVS20=
256DEVICE_DEVS21=
257DEVICE_DEVS21=
258
259# Choose the language feature(s) to include.  See gs.mak for details.
260
261FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(PSD)fapi.dev $(PSD)jbig2.dev
262
263# Choose whether to compile the .ps initialization files into the executable.
264# See gs.mak for details.
265
266COMPILE_INITS=0
267
268# Choose whether to store band lists on files or in memory.
269# The choices are 'file' or 'memory'.
270
271BAND_LIST_STORAGE=file
272
273# Choose which compression method to use when storing band lists in memory.
274# The choices are 'lzw' or 'zlib'.
275
276BAND_LIST_COMPRESSOR=zlib
277
278# Choose the implementation of file I/O: 'stdio', 'fd', or 'both'.
279# See gs.mak and sfxfd.c for more details.
280
281FILE_IMPLEMENTATION=stdio
282
283# Choose the implementation of stdio: '' for file I/O and 'c' for callouts
284# See gs.mak and ziodevs.c/ziodevsc.c for more details.
285
286STDIO_IMPLEMENTATION=c
287
288# Define the platform name.
289
290GSPLATFORM=openvms_
291
292# Define the name of the makefile -- used in dependencies.
293
294MAKEFILE=$(GLSRCDIR)openvms.mmk
295TOP_MAKEFILES=$(MAKEFILE)
296
297# Define the platform options
298
299PLATOPT=
300
301# It is very unlikely that anyone would want to edit the remaining
302#   symbols, but we describe them here for completeness:
303
304# Define the suffix for command files (e.g., null or .bat).
305
306CMD=
307
308# Define the directory separator character (\ for MS-DOS, / for Unix,
309# nothing for OpenVMS).
310
311D=
312
313# Define the brackets for passing preprocessor definitions to the C compiler.
314NULL=
315
316D_=/DEFINE="
317_D_=$(NULL)=
318_D="
319
320# Define the syntax of search paths for the C compiler.
321# The OpenVMS compilers uses /INCLUDE=(dir1, dir2, ...dirn),
322# and only a single /INCLUDE switch is allowed in the command line.
323
324I_=/INCLUDE=(
325II=,
326_I=)
327
328# Define the string for specifying the output file from the C compiler.
329
330O_=/OBJECT=
331
332# Define the quoting string for mixed-case arguments.
333# (OpenVMS is the only platform where this isn't an empty string.)
334
335Q="
336
337# Define the extension for executable files (e.g., null or .exe).
338
339XE=.exe
340
341# Define the extension for executable files for the auxiliary programs
342# (e.g., null or .exe).
343
344XEAUX=.exe
345
346# Define the list of files that `make clean' removes.
347
348BEGINFILES=$(GLSRCDIR)OPENVMS.OPT $(GLSRCDIR)OPENVMS.COM
349
350# Define the C invocation for auxiliary programs (echogs, genarch).
351# We don't need to define this separately.
352
353CCAUX=
354
355# Define the C invocation for normal compilation.
356
357CC=$(COMP)
358
359# Define the Link invocation.
360
361LINK=$(LINKER)/EXE=$@ $+,$(GLSRCDIR)OPENVMS.OPT/OPTION
362
363# Define the auxiliary program dependency. We don't need this.
364
365AK=
366
367# Define the syntax for command, object, and executable files.
368
369OBJ=obj
370
371# Define the prefix for image invocations.
372
373EXP=MCR $(NULL)
374
375# Define the prefix for shell invocations.
376
377SH=
378
379# Define generic commands.
380
381CP_=@$(GLSRCDIR)COPY_ONE
382
383# Define the command for deleting (a) file(s) (including wild cards)
384
385RM_=@$(GLSRCDIR)RM_ONE
386
387# Define the command for deleting multiple files / patterns.
388
389RMN_=@$(GLSRCDIR)RM_ALL
390
391# Define the arguments for genconf.
392
393CONFILES=-p %s
394CONFLDTR=-o
395
396# Define the generic compilation rules.
397
398.suffixes : .c .obj .exe
399
400.obj.exe :
401	$(LINK)
402
403# ---------------------------- End of options ---------------------------- #
404
405# Define various incantations of the 'c' compiler.
406
407CC_=$(COMP)
408CC_INT=$(CC_)
409CC_NO_WARN=$(CC_)
410CC_SHARED=$(CC_)
411
412# ------------------- Include the generic makefiles ---------------------- #
413
414all : macro [.lib]Fontmap. $(GS_XE)
415
416#.include $(COMMONDIR)/ansidefs.mak
417#.include $(COMMONDIR)/vmsdefs.mak
418#.include $(COMMONDIR)/generic.mak
419.include $(GLSRCDIR)gs.mak
420.include $(GLSRCDIR)lib.mak
421.include $(PSSRCDIR)int.mak
422.include $(GLSRCDIR)jpeg.mak
423# zlib.mak must precede png.mak
424.include $(GLSRCDIR)zlib.mak
425.include $(GLSRCDIR)png.mak
426JBIG2_EXTRA_OBJS=$(JBIG2OBJDIR)$(D)snprintf.$(OBJ)
427.include $(GLSRCDIR)jbig2.mak
428.include $(GLSRCDIR)devs.mak
429.include $(GLSRCDIR)contrib.mak
430
431
432# ----------------------------- Main program ------------------------------
433
434macro :
435.ifdef A4_PAPER
436	@ a4p = 1
437.else
438	@ a4p = 0
439.endif
440.ifdef IEEE
441	@ i3e = 1
442.else
443	@ i3e = 0
444.endif
445.ifdef SYSLIB
446	@ dsl = 1
447.else
448	@ dsl = 0
449.endif
450	@ decc = f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes.""
451	@ decw12 = f$search("SYS$SHARE:DECW$XTLIBSHRR5.EXE").nes.""
452	@ macro = ""
453	@ if dsl.or.a4p.or.decc.or.decw12 then macro = "/MACRO=("
454	@ if decw12 then macro = macro + "DECWINDOWS1_2=1,"
455	@ if a4p then macro = macro + "A4_PAPER=1,"
456	@ if dsl then macro = macro + "SYSLIB=1,"
457	@ if i3e then macro = macro + "IEEE=1,"
458	@ if macro.nes."" then macro = f$extract(0,f$length(macro)-1,macro)+ ")"
459	$(MMS)$(MMSQUALIFIERS)'macro' $(GS_XE)
460
461$(GS_XE) : openvms $(GLGEN)arch.h $(GLOBJDIR)gs.$(OBJ) $(INT_ALL) $(LIB_ALL)
462	$(LINKER)/EXE=$@ $(GLOBJDIR)gs.$(OBJ),$(ld_tr)/OPTIONS,$(GLSRCDIR)OPENVMS.OPT/OPTION
463	@ Write Sys$Output "Build of GhostScript is complete!"
464
465# OpenVMS.dev
466
467openvms__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_paper.$(OBJ) $(GLOBJ)gp_vms.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ)
468$(GLGEN)openvms_.dev : $(openvms__) $(GLGEN)nosync.dev
469	$(SETMOD) $(GLGEN)openvms_ $(openvms__) -include $(GLGEN)nosync
470
471$(ECHOGS_XE) :  $(GLOBJDIR)echogs.$(OBJ)
472$(GENARCH_XE) : $(GLOBJDIR)genarch.$(OBJ)
473$(GENCONF_XE) : $(GLOBJDIR)genconf.$(OBJ)
474$(GENDEV_XE) : $(GLOBJDIR)gendev.$(OBJ)
475$(GENHT_XE) : $(GLOBJDIR)genht.$(OBJ)
476$(GENINIT_XE) : $(GLOBJDIR)geninit.$(OBJ)
477
478$(GLOBJDIR)echogs.$(OBJ) : $(GLSRCDIR)echogs.c
479$(GLOBJDIR)genarch.$(OBJ) : $(GLSRCDIR)genarch.c $(GENARCH_DEPS)
480$(GLOBJDIR)genconf.$(OBJ) : $(GLSRCDIR)genconf.c $(GENCONF_DEPS)
481$(GLOBJDIR)gendev.$(OBJ) : $(GLSRCDIR)gendev.c $(GENDEV_DEPS)
482# ****** NEED TO ADD $(GENHT_CFLAGS) HERE ******
483$(GLOBJDIR)genht.$(OBJ) : $(GLSRCDIR)genht.c $(GENHT_DEPS)
484$(GLOBJDIR)geninit.$(OBJ) : $(GLSRCDIR)geninit.c $(GENINIT_DEPS)
485
486$(GLOBJ)gp_vms.$(OBJ) : $(GLSRC)gp_vms.c $(string__h) $(memory__h) $(gx_h) $(gp_h) $(gpmisc_h) $(gsstruct_h)
487	$(CC_)/include=($(GLGENDIR),$(GLSRCDIR))/obj=$(GLOBJ)gp_vms.$(OBJ) $(GLSRC)gp_vms.c
488
489$(GLOBJ)gp_stdia.$(OBJ) : $(GLSRC)gp_stdia.c $(AK) $(stdio__h) $(time__h) $(unistd__h) $(gx_h) $(gp_h)
490	$(CC_)/incl=$(GLOBJ)/obj=$(GLOBJ)gp_stdia.$(OBJ) $(GLSRC)gp_stdia.c
491
492# Preliminary definitions
493
494openvms : $(GLSRCDIR)openvms.com $(GLSRCDIR)openvms.opt
495	@$(GLSRCDIR)OPENVMS
496
497$(GLSRCDIR)openvms.com : $(GLSRCDIR)append_l.com
498	@$(GLSRCDIR)APPEND_L $@ "$ DEFINE/JOB X11 $(X_INCLUDE)"
499	@$(GLSRCDIR)APPEND_L $@ "$ DEFINE/JOB GS_LIB ''F$ENVIRONMENT(""DEFAULT"")'"
500	@$(GLSRCDIR)APPEND_L $@ "$ DEFINE/JOB GS_DOC ''F$ENVIRONMENT(""DEFAULT"")'"
501	@$(GLSRCDIR)APPEND_L $@ "$ DEFINE/JOB DECC$USER_INCLUDE ''F$ENVIRONMENT(""DEFAULT"")', DECW$INCLUDE, DECC$LIBRARY_INCLUDE, SYS$LIBRARY"
502	@$(GLSRCDIR)APPEND_L $@ "$ DEFINE/JOB DECC$SYSTEM_INCLUDE ''F$ENVIRONMENT(""DEFAULT"")', DECW$INCLUDE, DECC$LIBRARY_INCLUDE, SYS$LIBRARY"
503	@$(GLSRCDIR)APPEND_L $@ "$ DEFINE/JOB SYS "DECC$LIBRARY_INCLUDE,SYS$LIBRARY"
504
505$(GLSRCDIR)openvms.opt :
506.ifdef DECWINDOWS1_2
507	@$(GLSRCDIR)APPEND_L $@ "SYS$SHARE:DECW$XMLIBSHR12.EXE/SHARE"
508	@$(GLSRCDIR)APPEND_L $@ "SYS$SHARE:DECW$XTLIBSHRR5.EXE/SHARE"
509	@$(GLSRCDIR)APPEND_L $@ "SYS$SHARE:DECW$XLIBSHR.EXE/SHARE"
510.else
511	@$(GLSRCDIR)APPEND_L $@ "SYS$SHARE:DECW$XMLIBSHR.EXE/SHARE"
512	@$(GLSRCDIR)APPEND_L $@ "SYS$SHARE:DECW$XTSHR.EXE/SHARE"
513	@$(GLSRCDIR)APPEND_L $@ "SYS$SHARE:DECW$XLIBSHR.EXE/SHARE"
514.endif
515	@$(GLSRCDIR)APPEND_L $@ ""Ident="""""GS $(GS_DOT_VERSION)"""""
516
517# The platform-specific makefiles must also include rules for creating
518# certain dynamically generated files:
519#	gconfig_.h - this indicates the presence or absence of
520#	    certain system header files that are located in different
521#	    places on different systems.  (It could be generated by
522#	    the GNU `configure' program.)
523
524$(gconfig__h) : $(TOP_MAKEFILES) $(ECHOGS_XE)
525	$(EXP)$(ECHOGS_XE) -w $(gconfig__h) -x 23 define "HAVE_SYS_TIME_H"
526