xref: /plan9/sys/src/cmd/gs/src/os2.mak (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1#    Copyright (C) 1989, 1995, 1996, 1997, 1998, 1999, 2000 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: os2.mak,v 1.47 2005/08/31 05:52:32 ray Exp $
17# makefile for MS-DOS or OS/2 GCC/EMX platform.
18# Uses Borland (MSDOS) MAKER or
19# Uses IBM NMAKE.EXE Version 2.000.000 Mar 27 1992
20
21# ------------------------------- Options ------------------------------- #
22
23###### This section is the only part of the file you should need to edit.
24
25# ------ Generic options ------ #
26
27# Define the directory for the final executable, and the
28# source, generated intermediate file, and object directories
29# for the graphics library (GL) and the PostScript/PDF interpreter (PS).
30
31# This makefile has never been tested with any other values than these,
32# and almost certainly won't work with other values.
33BINDIR=bin
34GLSRCDIR=src
35GLGENDIR=obj
36GLOBJDIR=obj
37PSSRCDIR=src
38PSLIBDIR=lib
39PSGENDIR=obj
40PSOBJDIR=obj
41
42# Define the root directory for Ghostscript installation.
43
44AROOTDIR=c:/gs
45GSROOTDIR=$(AROOTDIR)/gs$(GS_DOT_VERSION)
46
47# Define the directory that will hold documentation at runtime.
48
49GS_DOCDIR=$(GSROOTDIR)/doc
50
51# Define the default directory/ies for the runtime
52# initialization, resource and font files.  Separate multiple directories with ;.
53# Use / to indicate directories, not a single \.
54
55GS_LIB_DEFAULT=$(GSROOTDIR)/lib;$(GSROOTDIR)/Resource;$(AROOTDIR)/fonts
56
57# Define whether or not searching for initialization files should always
58# look in the current directory first.  This leads to well-known security
59# and confusion problems, but users insist on it.
60# NOTE: this also affects searching for files named on the command line:
61# see the "File searching" section of Use.htm for full details.
62# Because of this, setting SEARCH_HERE_FIRST to 0 is not recommended.
63
64SEARCH_HERE_FIRST=1
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
77DEBUG=0
78
79# Setting GDEBUG=1 includes symbol table information for GDB.
80# Produces larger .OBJ and .EXE files.
81
82GDEBUG=0
83
84# Setting NOPRIVATE=1 makes private (static) procedures and variables public,
85# so they are visible to the debugger and profiler.
86# No execution time or space penalty, just larger .OBJ and .EXE files.
87
88NOPRIVATE=0
89
90# Setting MAKEDLL=1 makes the target a DLL instead of an EXE
91MAKEDLL=1
92
93# Setting EMX=1 uses GCC/EMX
94# Setting IBMCPP=1 uses IBM C++
95EMX=1
96IBMCPP=0
97
98# Setting BUILD_X11=1 builds X11 client using Xfree86
99BUILD_X11=0
100!if $(BUILD_X11)
101X11INCLUDE=-I$(X11ROOT)\XFree86\include
102X11LIBS=$(X11ROOT)\XFree86\lib\Xt.lib $(X11ROOT)\XFree86\lib\X11.lib
103MT_OPT=-Zmtd
104!endif
105
106# Define the name of the executable file.
107
108GS=gsos2
109GSDLL=gsdll2
110
111# Define the name of a pre-built executable that can be invoked at build
112# time.  Currently, this is only needed for compiled fonts.  The usual
113# alternatives are:
114#   - the standard name of Ghostscript on your system (typically `gs'):
115BUILD_TIME_GS=gsos2
116#   - the name of the executable you are building now.  If you choose this
117# option, then you must build the executable first without compiled fonts,
118# and then again with compiled fonts.
119#BUILD_TIME_GS=$(BINDIR)\$(GS) -I$(PSLIBDIR)
120
121# Define the directory where the IJG JPEG library sources are stored,
122# and the major version of the library that is stored there.
123# You may need to change this if the IJG library version changes.
124# See jpeg.mak for more information.
125
126JSRCDIR=jpeg
127JVERSION=6
128
129# Define the directory where the PNG library sources are stored,
130# and the version of the library that is stored there.
131# You may need to change this if the libpng version changes.
132# See libpng.mak for more information.
133
134PSRCDIR=libpng
135PVERSION=10208
136
137# Define the directory where the zlib sources are stored.
138# See zlib.mak for more information.
139
140ZSRCDIR=zlib
141
142# Define the jbig2dec library source location.
143# See jbig2.mak for more information.
144
145JBIG2SRCDIR=jbig2dec
146
147# Define the directory where the icclib source are stored.
148# See icclib.mak for more information
149
150ICCSRCDIR=icclib
151
152# IJS has not been ported to OS/2. If you do the port,
153# you'll need to set these values. You'll also need to
154# include the ijs.mak makefile (right after icclib.mak).
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=win
162
163# 1 --> Use 64 bits for gx_color_index.  This is required only for
164# non standard devices or DeviceN process color model devices.
165USE_LARGE_COLOR_INDEX=1
166
167!if $(USE_LARGE_COLOR_INDEX) == 1
168# Definitions to force gx_color_index to 64 bits
169LARGEST_UINTEGER_TYPE=unsigned long long
170GX_COLOR_INDEX_TYPE=$(LARGEST_UINTEGER_TYPE)
171GCIFLAGS=-DGX_COLOR_INDEX_TYPE="$(GX_COLOR_INDEX_TYPE)"
172!else
173GCIFLAGS=
174!endif
175
176
177# The following is a hack to get around the special treatment of \ at
178# the end of a line.
179NUL=
180DD=$(GLGENDIR)\$(NUL)
181GLD=$(GLGENDIR)\$(NUL)
182PSD=$(PSGENDIR)\$(NUL)
183
184
185# ------ Platform-specific options ------ #
186
187# If you don't have an assembler, set USE_ASM=0.  Otherwise, set USE_ASM=1,
188# and set ASM to the name of the assembler you are using.  This can be
189# a full path name if you want.  Normally it will be masm or tasm.
190
191USE_ASM=0
192ASM=
193
194# Define the drive, directory, and compiler name for the EMX files.
195# COMP is the compiler name (gcc)
196# COMPDIR contains the compiler and linker (normally \emx\bin).
197# EMXPATH contains the path to the EMX directory (normally /emx)
198# INCDIR contains the include files (normally /emx/include).
199# LIBDIR contains the library files (normally /emx/lib).
200# Note that these prefixes are always followed by a \,
201#   so if you want to use the current directory, use an explicit '.'.
202
203!if $(EMX)
204COMP=gcc $(X11INCLUDE)
205COMPBASE=\emx
206EMXPATH=/emx
207COMPDIR=$(COMPBASE)\bin
208INCDIR=$(EMXPATH)/include
209LIBDIR=$(EMXPATH)/lib
210!if $(PVERSION) >= 10009
211CPNG=-DPNGAPI=
212!endif
213!endif
214
215!if $(IBMCPP)
216COMP=icc /Q
217COMPBASE=\ibmcpp
218TOOLPATH=\toolkit
219COMPDIR=$(COMPBASE)\bin
220INCDIR=$(TOOLPATH)\h;$(COMPBASE)\include
221LIBDIR=$(TOOLPATH)\lib;$(COMPBASE)\lib
222!endif
223
224# Choose platform-specific options.
225
226# Define the processor (CPU) type.  Options are 86 (8086 or 8088),
227# 186, 286, 386, 485 (486SX or Cyrix 486SLC), 486 (486DX), or 586 (Pentium).
228# Higher numbers produce code that may be significantly smaller and faster,
229# but the executable will bail out with an error message on any processor
230# less capable than the designated one.
231
232# EMX requires 386 or higher
233CPU_TYPE=386
234
235# Define the math coprocessor (FPU) type.
236# Options are -1 (optimize for no FPU), 0 (optimize for FPU present,
237# but do not require a FPU), 87, 287, or 387.
238# If CPU_TYPE is 486 or above, FPU_TYPE is implicitly set to 387,
239# since 486DX and later processors include the equivalent of an 80387 on-chip.
240# An xx87 option means that the executable will run only if a FPU
241# of that type (or higher) is available: this is NOT currently checked
242# at runtime.
243
244FPU_TYPE=387
245
246# Define the .dev module that implements thread and synchronization
247# primitives for this platform.  Don't change this unless you really know
248# what you're doing.
249
250SYNC=winsync
251
252# ---------------------------- End of options ---------------------------- #
253
254# Note that built-in libpng and zlib aren't available.
255
256SHARE_JPEG=0
257SHARE_LIBPNG=0
258SHARE_ZLIB=0
259SHARE_JBIG2=0
260
261# Swapping `make' out of memory makes linking much faster.
262# only used by Borland MAKER.EXE
263
264#.swap
265
266# Define the platform name.
267
268PLATFORM=os2_
269
270# Define the name of the makefile -- used in dependencies.
271
272MAKEFILE=$(PSSRCDIR)\os2.mak
273TOP_MAKEFILES=$(MAKEFILE)
274
275# Define the files to be deleted by 'make clean'.
276
277BEGINFILES=$(BINDIR)\gspmdrv.exe $(GLOBJDIR)\gspmdrv.o $(GLOBJDIR)\gs*.res $(GLOBJDIR)\gs*.ico $(BINDIR)\$(GSDLL).dll
278
279# Define the auxiliary program dependency. We don't use this.
280
281AK=
282
283#Compiler Optimiser option
284!if $(EMX)
285CO=-O
286!endif
287!if $(IBMCPP)
288#CO=/O+
289CO=/O-
290!endif
291
292# Make sure we get the right default target for make.
293
294dosdefault: default $(BINDIR)\gspmdrv.exe
295
296# Define a rule for invoking just the preprocessor.
297
298.c.i:
299	$(COMPDIR)\cpp $(CCFLAGS) $<
300
301# Define the extensions for command, object, and executable files.
302
303# Work around the fact that some `make' programs drop trailing spaces
304# or interpret == as a special definition operator.
305NULL=
306
307CMD=.cmd
308C_=-c
309D_=-D
310_D_=$(NULL)=
311_D=
312I_=-I
313II=-I
314_I=
315O_=-o $(NULL)
316!if $(MAKEDLL)
317OBJ=obj
318!else
319OBJ=o
320!endif
321Q=
322XE=.exe
323XEAUX=.exe
324
325# Define the current directory prefix and shell name.
326
327D=\#
328
329EXP=
330SH=
331
332# Define generic commands.
333
334# We use cp.cmd rather than copy /B so that we update the write date.
335CP_=$(GLSRCDIR)\cp.cmd
336# We use rm.cmd rather than erase because rm.cmd never generates
337# a non-zero return code.
338RM_=$(GLSRCDIR)\rm.cmd
339# OS/2 erase, unlike MS-DOS erase, accepts multiple files or patterns.
340RMN_=$(GLSRCDIR)\rm.cmd
341
342# Define the arguments for genconf.
343
344!if $(MAKEDLL)
345CONFILES=-p %%s+
346!else
347CONFILES=
348!endif
349CONFLDTR=-ol
350
351# Define the generic compilation flags.
352
353!if $(CPU_TYPE) >= 486
354ASMCPU=/DFOR80386 /DFOR80486
355PLATOPT=-DFOR80386 -DFOR80486
356!else
357!if $(CPU_TYPE) >= 386
358ASMCPU=/DFOR80386
359PLATOPT=-DFOR80386
360!endif
361!endif
362
363!if $(FPU_TYPE) > 0
364ASMFPU=/DFORFPU
365!else
366ASMFPU=
367!endif
368
369!if $(USE_ASM)
370INTASM=iutilasm.$(OBJ)
371PCFBASM=gdevegaa.$(OBJ)
372!else
373INTASM=
374PCFBASM=
375!endif
376
377# Define the generic compilation rules.
378
379ASMFLAGS=$(ASMCPU) $(ASMFPU) $(ASMDEBUG)
380
381.asm.o:
382	$(ASM) $(ASMFLAGS) $<;
383
384# ---------------------- MS-DOS I/O debugging option ---------------------- #
385
386dosio_=$(PSOBJ)zdosio.$(OBJ)
387dosio.dev: $(PSGEN)dosio.dev
388	$(NO_OP)
389
390$(PSGEN)dosio.dev: $(dosio_)
391	$(SETMOD) $(PSGEN)dosio $(dosio_)
392	$(ADDMOD) $(PSGEN)dosio -oper zdosio
393
394$(PSOBJ)zdosio.$(OBJ): $(PSSRC)zdosio.c $(OP) $(store_h)
395	$(PSCC) $(PSO_)zdosio.$(OBJ) $(C_) $(PSSRC)zdosio.c
396
397# ----------------------------- Assembly code ----------------------------- #
398
399$(PSOBJ)iutilasm.$(OBJ): $(PSSRC)iutilasm.asm
400
401#################  END
402
403# Define the compilation flags.
404
405!if $(NOPRIVATE)
406CP=-DNOPRIVATE
407!else
408CP=
409!endif
410
411!if $(DEBUG)
412CD=-DDEBUG
413!else
414CD=
415!endif
416
417!if $(GDEBUG)
418!if $(EMX)
419CGDB=-g
420!endif
421!if $(IBMCPP)
422CGDB=/Ti+
423!endif
424!else
425CGDB=
426!endif
427
428!if $(MAKEDLL)
429!if $(EMX)
430CDLL=-Zdll -Zso -Zsys -Zomf $(MT_OPT) -D__DLL__
431!endif
432!if $(IBMCPP)
433CDLL=/Gd- /Ge- /Gm+ /Gs+ /D__DLL__
434!endif
435!else
436CDLL=
437!endif
438
439!if $(EMX)
440CEXE=-Zomf
441!endif
442
443GENOPT=$(CP) $(CD) $(CGDB) $(CDLL) $(CO) $(CPNG)
444
445CCFLAGS0=$(GENOPT) $(PLATOPT) -D__OS2__ $(GCIFLAGS)
446CCFLAGS=$(CCFLAGS0)
447CC=$(COMPDIR)\$(COMP) $(CCFLAGS0)
448CC_=$(CC)
449CC_D=$(CC) $(CO)
450CC_INT=$(CC)
451CC_NO_WARN=$(CC_)
452
453# ------ Devices and features ------ #
454
455# Choose the language feature(s) to include.  See gs.mak for details.
456# Since we have a large address space, we include some optional features.
457
458FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(PSD)os2print.dev
459
460# Choose whether to compile the .ps initialization files into the executable.
461# See gs.mak for details.
462
463COMPILE_INITS=0
464
465# Choose whether to store band lists on files or in memory.
466# The choices are 'file' or 'memory'.
467
468BAND_LIST_STORAGE=file
469
470# Choose which compression method to use when storing band lists in memory.
471# The choices are 'lzw' or 'zlib'.
472
473BAND_LIST_COMPRESSOR=zlib
474
475# Choose the implementation of file I/O: 'stdio', 'fd', or 'both'.
476# See gs.mak and sfxfd.c for more details.
477
478FILE_IMPLEMENTATION=stdio
479
480# Choose the implementation of stdio: '' for file I/O and 'c' for callouts
481# See gs.mak and ziodevs.c/ziodevsc.c for more details.
482
483STDIO_IMPLEMENTATION=c
484
485# Choose the device(s) to include.  See devs.mak for details,
486# devs.mak, pcwin.mak, and contrib.mak for the list of available devices.
487
488!if $(MAKEDLL)
489DEVICE_DEVS=$(DD)display.dev $(DD)os2pm.dev $(DD)os2dll.dev $(DD)os2prn.dev
490!else
491DEVICE_DEVS=$(DD)os2pm.dev
492!endif
493!if $(BUILD_X11)
494DEVICE_DEVS1=$(DD)x11.dev $(DD)x11alpha.dev $(DD)x11cmyk.dev $(DD)x11gray2.dev $(DD)x11gray4.dev $(DD)x11mono.dev
495!else
496DEVICE_DEVS1=
497!endif
498DEVICE_DEVS2=$(DD)epson.dev $(DD)eps9high.dev $(DD)eps9mid.dev $(DD)epsonc.dev $(DD)ibmpro.dev
499DEVICE_DEVS3=$(DD)deskjet.dev $(DD)djet500.dev $(DD)laserjet.dev $(DD)ljetplus.dev $(DD)ljet2p.dev
500DEVICE_DEVS4=$(DD)cdeskjet.dev $(DD)cdjcolor.dev $(DD)cdjmono.dev $(DD)cdj550.dev
501DEVICE_DEVS5=$(DD)uniprint.dev $(DD)djet500c.dev $(DD)declj250.dev $(DD)lj250.dev
502DEVICE_DEVS6=$(DD)st800.dev $(DD)stcolor.dev $(DD)bj10e.dev $(DD)bj200.dev
503DEVICE_DEVS7=$(DD)t4693d2.dev $(DD)t4693d4.dev $(DD)t4693d8.dev $(DD)tek4696.dev
504DEVICE_DEVS8=$(DD)pcxmono.dev $(DD)pcxgray.dev $(DD)pcx16.dev $(DD)pcx256.dev $(DD)pcx24b.dev $(DD)pcxcmyk.dev
505DEVICE_DEVS9=$(DD)pbm.dev $(DD)pbmraw.dev $(DD)pgm.dev $(DD)pgmraw.dev $(DD)pgnm.dev $(DD)pgnmraw.dev $(DD)pkmraw.dev
506DEVICE_DEVS10=$(DD)tiffcrle.dev $(DD)tiffg3.dev $(DD)tiffg32d.dev $(DD)tiffg4.dev $(DD)tifflzw.dev $(DD)tiffpack.dev
507DEVICE_DEVS11=$(DD)bmpmono.dev $(DD)bmpgray.dev $(DD)bmp16.dev $(DD)bmp256.dev $(DD)bmp16m.dev $(DD)tiff12nc.dev $(DD)tiff24nc.dev $(DD)tiffgray.dev $(DD)tiff32nc.dev $(DD)tiffsep.dev
508DEVICE_DEVS12=$(DD)psmono.dev $(DD)bit.dev $(DD)bitrgb.dev $(DD)bitcmyk.dev
509DEVICE_DEVS13=$(DD)pngmono.dev $(DD)pnggray.dev $(DD)png16.dev $(DD)png256.dev $(DD)png16m.dev $(DD)pngalpha.dev
510DEVICE_DEVS14=$(DD)jpeg.dev $(DD)jpeggray.dev $(DD)jpegcmyk.dev
511DEVICE_DEVS15=$(DD)pdfwrite.dev $(DD)pswrite.dev $(DD)ps2write.dev $(DD)epswrite.dev $(DD)pxlmono.dev $(DD)pxlcolor.dev
512DEVICE_DEVS16=$(DD)bbox.dev
513# Overflow for DEVS3,4,5,6,9
514DEVICE_DEVS17=$(DD)ljet3.dev $(DD)ljet3d.dev $(DD)ljet4.dev $(DD)ljet4d.dev
515DEVICE_DEVS18=$(DD)pj.dev $(DD)pjxl.dev $(DD)pjxl300.dev $(DD)jetp3852.dev $(DD)r4081.dev
516DEVICE_DEVS19=$(DD)lbp8.dev $(DD)m8510.dev $(DD)necp6.dev $(DD)bjc600.dev $(DD)bjc800.dev
517DEVICE_DEVS20=$(DD)pnm.dev $(DD)pnmraw.dev $(DD)ppm.dev $(DD)ppmraw.dev
518DEVICE_DEVS21= $(DD)spotcmyk.dev $(DD)devicen.dev $(DD)bmpsep1.dev $(DD)bmpsep8.dev $(DD)bmp16m.dev $(DD)bmp32b.dev $(DD)psdcmyk.dev $(DD)psdrgb.dev
519
520# Include the generic makefiles.
521!include "$(GLSRCDIR)\version.mak"
522!include "$(GLSRCDIR)\gs.mak"
523!include "$(GLSRCDIR)\lib.mak"
524!include "$(GLSRCDIR)\jpeg.mak"
525# zlib.mak must precede libpng.mak
526!include "$(GLSRCDIR)\zlib.mak"
527!include "$(GLSRCDIR)\libpng.mak"
528!include "$(GLSRCDIR)\jbig2.mak"
529!include "$(GLSRCDIR)\icclib.mak"
530!include "$(GLSRCDIR)\devs.mak"
531!include "$(GLSRCDIR)\pcwin.mak"
532!include "$(GLSRCDIR)\contrib.mak"
533!include "$(PSSRCDIR)\int.mak"
534!include "$(PSSRCDIR)\cfonts.mak"
535
536# -------------------------------- Library -------------------------------- #
537
538# The GCC/EMX platform
539
540os2__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_os2.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ)
541$(GLGEN)os2_.dev: $(os2__) $(GLD)nosync.dev
542	$(SETMOD) $(GLGEN)os2_ $(os2__) -include $(GLD)nosync
543
544$(GLOBJ)gp_os2.$(OBJ): $(GLSRC)gp_os2.c $(GLSRC)gp_os2.h\
545 $(dos__h) $(pipe__h) $(string__h) $(time__h)\
546 $(gsdll_h) $(gx_h) $(gsexit_h) $(gsutil_h) $(gp_h) $(gpmisc_h)
547	$(GLCC) $(GLO_)gp_os2.$(OBJ) $(C_) $(GLSRC)gp_os2.c
548
549$(GLOBJ)gp_stdia.$(OBJ): $(GLSRC)gp_stdia.c $(AK)\
550  $(stdio__h) $(time__h) $(unistd__h) $(gx_h) $(gp_h)
551	$(GLCC) $(GLO_)gp_stdia.$(OBJ) $(C_) $(GLSRC)gp_stdia.c
552
553# Define OS/2 printer (file system) as a separable feature.
554
555os2print_=$(GLOBJ)gp_os2pr.$(OBJ)
556$(GLD)os2print.dev: $(ECHOGS_XE) $(os2print_)
557	$(SETMOD) $(GLD)os2print $(os2print_)
558	$(ADDMOD) $(GLD)os2print -iodev printer
559
560$(GLOBJ)gp_os2pr.$(OBJ): $(GLSRC)gp_os2pr.c $(GLSRC)gp_os2.h $(AK)\
561 $(ctype__h) $(errno__h) $(stdio__h) $(string__h)\
562 $(gserror_h) $(gsmemory_h) $(gstypes_h) $(gxiodev_h)
563	$(GLCC) $(GLO_)gp_os2pr.$(OBJ) $(C_) $(GLSRC)gp_os2pr.c
564
565
566# -------------------------- Auxiliary programs --------------------------- #
567
568#CCAUX=$(COMPDIR)\$(COMP) $(CO)
569# emx 0.9d (gcc 2.8.1) crashes when compiling genarch.c with optimizer
570CCAUX=$(COMPDIR)\$(COMP)
571
572$(ECHOGS_XE): $(GLSRCDIR)\echogs.c
573!if $(EMX)
574	$(CCAUX) -o $(AUXGEN)echogs $(GLSRCDIR)\echogs.c
575	$(COMPDIR)\emxbind $(EMXPATH)/bin/emxl.exe $(AUXGEN)echogs $(ECHOGS_XE)
576	del $(AUXGEN)echogs
577!endif
578!if $(IBMCPP)
579	$(CCAUX) /Fe$(ECHOGS_XE) $(GLSRCDIR)\echogs.c
580!endif
581
582$(GENARCH_XE): $(GLSRCDIR)\genarch.c $(GENARCH_DEPS)
583	-mkdir $(GLGENDIR)
584	-mkdir $(BINDIR)
585!if $(EMX)
586	$(CCAUX) -DHAVE_LONG_LONG -o $(AUXGEN)genarch $(GLSRCDIR)\genarch.c
587	$(COMPDIR)\emxbind $(EMXPATH)/bin/emxl.exe $(AUXGEN)genarch $(GENARCH_XE)
588	del $(AUXGEN)genarch
589!endif
590!if $(IBMCPP)
591	$(CCAUX) /Fe$(GENARCH_XE) $(GLSRCDIR)\genarch.c
592!endif
593
594$(GENCONF_XE): $(GLSRCDIR)\genconf.c $(GENCONF_DEPS)
595!if $(EMX)
596	$(CCAUX) -o $(AUXGEN)genconf $(GLSRCDIR)\genconf.c
597	$(COMPDIR)\emxbind $(EMXPATH)/bin/emxl.exe $(AUXGEN)genconf $(GENCONF_XE)
598	del $(AUXGEN)genconf
599!endif
600!if $(IBMCPP)
601	$(CCAUX) /Fe$(GENCONF_XE) $(GLSRCDIR)\genconf.c
602!endif
603
604$(GENDEV_XE): $(GLSRCDIR)\gendev.c $(GENDEV_DEPS)
605!if $(EMX)
606	$(CCAUX) -o $(AUXGEN)gendev $(GLSRCDIR)\gendev.c
607	$(COMPDIR)\emxbind $(EMXPATH)/bin/emxl.exe $(AUXGEN)gendev $(GENDEV_XE)
608	del $(AUXGEN)gendev
609!endif
610!if $(IBMCPP)
611	$(CCAUX) /Fe$(GENDEV_XE) $(GLSRCDIR)\gendev.c
612!endif
613
614$(GENHT_XE): $(PSSRC)genht.c $(GENHT_DEPS)
615!if $(EMX)
616	$(CCAUX) -o $(AUXGEN)genht $(GENHT_CFLAGS) $(PSSRC)genht.c
617	$(COMPDIR)\emxbind $(EMXPATH)/bin/emxl.exe $(AUXGEN)genht $(GENHT_XE)
618	del $(AUXGEN)genht
619!endif
620!if $(IBMCPP)
621	$(CCAUX) /Fe$(GENHT_XE) genht.c
622!endif
623
624$(GENINIT_XE): $(PSSRC)geninit.c $(GENINIT_DEPS)
625!if $(EMX)
626	$(CCAUX) -o $(AUXGEN)geninit $(PSSRC)geninit.c
627	$(COMPDIR)\emxbind $(EMXPATH)/bin/emxl.exe $(AUXGEN)geninit $(GENINIT_XE)
628	del $(AUXGEN)geninit
629!endif
630!if $(IBMCPP)
631	$(CCAUX) /Fe$(GENINIT_XE) geninit.c
632!endif
633
634# No special gconfig_.h is needed.
635$(gconfig__h): $(TOP_MAKEFILES) $(ECHOGS_XE)
636	$(ECHOGS_XE) -w $(gconfig__h) /* This file deliberately left blank. */
637
638$(gconfigv_h): $(PSSRCDIR)\os2.mak $(TOP_MAKEFILES) $(ECHOGS_XE)
639	$(ECHOGS_XE) -w $(gconfigv_h) -x 23 define USE_ASM -x 2028 -q $(USE_ASM)-0 -x 29
640	$(ECHOGS_XE) -a $(gconfigv_h) -x 23 define USE_FPU -x 2028 -q $(FPU_TYPE)-0 -x 29
641	$(ECHOGS_XE) -a $(gconfigv_h) -x 23 define EXTEND_NAMES 0$(EXTEND_NAMES)
642	$(ECHOGS_XE) -a $(gconfigv_h) -x 23 define SYSTEM_CONSTANTS_ARE_WRITABLE 0$(SYSTEM_CONSTANTS_ARE_WRITABLE)
643
644# ----------------------------- Main program ------------------------------ #
645
646gsdllos2_h=$(GLSRC)gsdllos2.h
647
648# Interpreter main program
649
650ICONS=$(PSOBJ)gsos2.ico $(GLOBJ)gspmdrv.ico
651
652$(PSOBJ)dpmain.$(OBJ): $(PSSRC)dpmain.c $(AK)\
653 $(gdevdsp_h) $(iapi_h) $(gscdefs_h) $(ierrors_h)
654	$(CC) $(CEXE) -I$(PSSRCDIR) -I$(GLSRCDIR) -I$(GLGENDIR) $(PSO_)dpmain.$(OBJ) $(C_) $(PSSRC)dpmain.c
655
656!if $(MAKEDLL)
657#making a DLL
658GS_ALL=$(PSOBJ)gsdll.$(OBJ) $(INT_ALL) $(INTASM)\
659  $(LIB_ALL) $(LIBCTR) $(ld_tr) $(PSOBJ)$(GS).res $(ICONS)
660
661$(GS_XE): $(BINDIR)\$(GSDLL).dll $(PSSRC)dpmain.c $(gsdll_h) $(gsdllos2_h) $(PSSRC)gsos2.rc $(GLOBJ)gscdefs.$(OBJ)
662!if $(EMX)
663	$(COMPDIR)\$(COMP) $(CGDB) $(CO) -Zomf $(MT_OPT) -I$(PSSRCDIR) -I$(GLSRCDIR) -I$(PSOBJDIR) -I$(GLOBJDIR) -o$(GS_XE) $(PSSRC)dpmain.c $(GLOBJ)gscdefs.$(OBJ) $(PSSRC)gsos2.def
664!endif
665!if $(IBMCPP)
666	$(CCAUX) -I$(PSSRCDIR) -I$(GLSRCDIR) -I$(PSOBJDIR) -I$(GLOBJDIR) /Fe$(GX_XE) $(PSSRC)dpmain.c $(GLOBJ)gscdefs.$(OBJ)
667!endif
668	rc $(PSOBJ)$(GS).res $(GS_XE)
669
670$(PSOBJ)gsdll.$(OBJ): $(PSSRC)gsdll.c $(gsdll_h) $(ghost_h) $(gscdefs_h)
671	$(PSCC) $(PSO_)gsdll.$(OBJ) $(C_) $(PSSRC)gsdll.c
672
673$(BINDIR)\$(GSDLL).dll: $(GS_ALL) $(ALL_DEVS) $(PSOBJ)gsdll.$(OBJ)
674!if $(EMX)
675	LINK386 /DEBUG $(COMPBASE)\lib\dll0.obj $(COMPBASE)\lib\end.lib @$(ld_tr) $(PSOBJ)gsdll.obj, $(BINDIR)\$(GSDLL).dll, ,$(X11LIBS) $(COMPBASE)\lib\gcc.lib $(COMPBASE)\lib\st\c.lib $(COMPBASE)\lib\st\c_dllso.lib $(COMPBASE)\lib\st\sys.lib $(COMPBASE)\lib\c_alias.lib $(COMPBASE)\lib\os2.lib, $(PSSRC)gsdll2.def
676!endif
677!if $(IBMCPP)
678	LINK386 /NOE /DEBUG @$(ld_tr) $(PSOBJ)gsdll.obj, $(BINDIR)\$(GSDLL).dll, , , $(PSSRC)gsdll2.def
679!endif
680
681!else
682#making an EXE
683GS_ALL=$(PSOBJ)gs.$(OBJ) $(INT_ALL) $(INTASM)\
684  $(LIB_ALL) $(LIBCTR) $(ld_tr) $(PSOBJ)$(GS).res $(ICONS)
685
686$(GS_XE): $(GS_ALL) $(ALL_DEVS)
687	$(COMPDIR)\$(COMP) $(CGDB) I$(PSSRCDIR) -I$(GLSRCDIR) -o $(PSOBJ)$(GS) $(PSOBJ)gs.$(OBJ) @$(ld_tr) $(INTASM) -lm
688	$(COMPDIR)\emxbind -r$(PSOBJ)$(GS).res $(COMPDIR)\emxl.exe $(PSOBJ)$(GS) $(GS_XE) -ac
689	del $(PSOBJ)$(GS)
690!endif
691
692# Make the icons from their text form.
693
694$(PSOBJ)gsos2.ico: $(PSSRC)gsos2.icx $(ECHOGS_XE)
695	$(ECHOGS_XE) -wb $(PSOBJ)gsos2.ico -n -X -r $(PSSRC)gsos2.icx
696
697$(GLOBJ)gspmdrv.ico: $(GLSRC)gspmdrv.icx $(ECHOGS_XE)
698	$(ECHOGS_XE) -wb $(GLOBJ)gspmdrv.ico -n -X -r $(GLSRC)gspmdrv.icx
699
700$(PSOBJ)$(GS).res: $(PSSRC)$(GS).rc $(PSOBJ)gsos2.ico
701	rc -i $(COMPBASE)\include -i $(PSSRCDIR) -i $(PSOBJDIR) -r $(PSSRC)$(GS).rc $(PSOBJ)$(GS).res
702
703
704# PM driver program
705
706$(GLOBJ)gspmdrv.o: $(GLSRC)gspmdrv.c $(GLSRC)gspmdrv.h
707	$(COMPDIR)\$(COMP) $(CGDB) $(CO) -I$(GLSRCDIR) -o $(GLOBJ)gspmdrv.o -c $(GLSRC)gspmdrv.c
708
709$(GLOBJ)gspmdrv.res: $(GLSRC)gspmdrv.rc $(GLSRC)gspmdrv.h $(GLOBJ)gspmdrv.ico
710	rc -i $(COMPBASE)\include -i $(GLSRCDIR) -i $(GLOBJDIR) -r $(GLSRC)gspmdrv.rc $(GLOBJ)gspmdrv.res
711
712$(BINDIR)\gspmdrv.exe: $(GLOBJ)gspmdrv.o $(GLOBJ)gspmdrv.res $(GLSRC)gspmdrv.def
713	$(COMPDIR)\$(COMP) $(CGDB) $(CO) -o $(GLOBJ)gspmdrv $(GLOBJ)gspmdrv.o
714	$(COMPDIR)\emxbind -p -r$(GLOBJ)gspmdrv.res -d$(GLSRC)gspmdrv.def $(COMPDIR)\emxl.exe $(GLOBJ)gspmdrv $(BINDIR)\gspmdrv.exe
715	del $(GLOBJ)gspmdrv
716
717# Create a ZIP archive
718# This assumes that the current directory is named gs#.## relative to its
719# parent, where #.## is the Ghostscript version.
720
721ZIP_XE=zip
722ZIPPROGFILE1=gs$(GS_DOT_VERSION)\bin\gsos2.exe
723ZIPPROGFILE2=gs$(GS_DOT_VERSION)\bin\gsdll2.dll
724ZIPPROGFILE3=gs$(GS_DOT_VERSION)\bin\gspmdrv.exe
725ZIPPROGFILE4=gs$(GS_DOT_VERSION)\doc
726ZIPPROGFILE5=gs$(GS_DOT_VERSION)\examples
727ZIPPROGFILE6=gs$(GS_DOT_VERSION)\lib
728ZIPFONTDIR=fonts
729
730# Make the zip archive.
731zip:
732	cd ..
733	-del gs$(GS_VERSION)os2.zip
734	$(ZIP_XE) -9 -r gs$(GS_VERSION)os2.zip $(ZIPFONTDIR)
735	$(ZIP_XE) -9 -r gs$(GS_VERSION)os2.zip $(ZIPPROGFILE1)
736	$(ZIP_XE) -9 -r gs$(GS_VERSION)os2.zip $(ZIPPROGFILE2)
737	$(ZIP_XE) -9 -r gs$(GS_VERSION)os2.zip $(ZIPPROGFILE3)
738	$(ZIP_XE) -9 -r gs$(GS_VERSION)os2.zip $(ZIPPROGFILE4)
739	$(ZIP_XE) -9 -r gs$(GS_VERSION)os2.zip $(ZIPPROGFILE5)
740	$(ZIP_XE) -9 -r gs$(GS_VERSION)os2.zip $(ZIPPROGFILE6)
741	cd gs$(GS_DOT_VERSION)
742