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#
16# Generic makefile, common to all platforms, products, and configurations.
17# The platform-specific makefiles `include' this file.
18
19# Ghostscript makefiles cannot use default compilation rules, because
20# they may place the output in (multiple) different directories.
21# All compilation rules must have the form
22#	<<compiler>> $(O_)<<output_file>> $(C_)<<input_file>>
23# to cope with the divergent syntaxes of the various compilers.
24# Spaces must appear where indicated, and nowhere else; in particular,
25# there must be no space between $(O_) and the output file name.
26
27# The platform-specific makefiles define the following symbols:
28#	GS - the name of the executable (without the extension, if any).
29#	GS_LIB_DEFAULT - the default directory/ies for searching for the
30#	    initialization and font files at run time.
31#	GS_DEV_DEFAULT - array of default device names, in order of
32#	    preference. If empty the first DEVICE_DEV will be used.
33#	GS_CACHE_DIR - the default directory for caching data between
34#	    ghostscript invocations.
35#	SEARCH_HERE_FIRST - the default setting of -P (whether or not to
36#	    look for files in the current directory first).
37#	GS_DOCDIR - the directory where documentation will be available
38#	    at run time.
39#	FTSRCDIR - the directory where there the FreeType library
40#	    source code is stored, relative to the source directory.
41#	JSRCDIR - the directory where the IJG JPEG library source code
42#	    is stored (at compilation time).
43#	PNGSRCDIR - the same for libpng.
44#	ZSRCDIR - the same for zlib.
45#	SHARE_FT - normally 0; if set to 1, asks the linker to use
46#	    and existing compiled freetype library instead of compiling
47#	    in the source code availabel in FTSRCDIR.
48#	SHARE_JPEG - normally 0; if set to 1, asks the linker to use
49#	    an existing compiled libjpeg (-ljpeg) instead of compiling and
50#	    linking libjpeg explicitly.  (We strongly recommend against
51#	    doing this: see Make.htm details.)
52#	JPEG_NAME - the name of the shared library, currently always
53#	    jpeg (libjpeg, -lpjeg).
54#	SHARE_LIBPNG - normally 0; if set to 1, asks the linker to use
55#	    an existing compiled libpng (-lpng) instead of compiling and
56#	    linking libpng explicitly.
57#	LIBPNG_NAME, the name of the shared libpng, currently always
58#	    png (libpng, -lpng).
59#	SHARE_ZLIB - normally 0; if set to 1, asks the linker to use
60#	    an existing compiled zlib (-lgz or -lz) instead of compiling
61#	    and linking libgz/libz explicitly.
62#	ZLIB_NAME - the name of the shared zlib, either gz (for libgz, -lgz)
63#	    or z (for libz, -lz).
64#	JBIG2_LIB - choice of which jbig2 implementation to use
65#	SHARE_JBIG2 - normally 0; if set to 1, asks the linker to use
66#	    an existing complied libjbig2dec instead of compiling and linking
67#	    in from a local copy of the source
68#	JBIG2SRCDIR - the name of the jbig2dec library source directory
69#	    typically 'jbig2dec' or 'jbig2dec-/version/'
70#	JPX_LIB - choice of which jpeg2k implementation to use
71#	SHARE_JPX - If set to 1, asks the linker to use an existing
72#	    complied jpeg2k library. If set to 0, asks to compile and
73#	    link from a local copy of the source using our custom
74#	    makefile.
75#	JPXSRCDIR - the name of the jpeg2k library source directory
76#	    e.g. 'jasper' or 'jasper-/version/'
77#	JPX_CFLAGS - any platform-specific flags that are required
78#	    to properly compile in the jpeg2k library source
79#	SHARE_LCMS - If set to 1, asks the linker to use a separately
80#	    compiled lcms library. If set to 0, the build will compile
81#	    in the library source found in LCMSSRCDIR
82#	LCMSSRCDIR - the name of the lcms library source directory
83#	    e.g. 'lcms' or 'lcms-<version>'
84#	DEVICE_DEVS - the devices to include in the executable.
85#	    See devs.mak for details.
86#	DEVICE_DEVS1...DEVICE_DEVS21 - additional devices, if the definition
87#	    of DEVICE_DEVS doesn't fit on one line.  See devs.mak for details.
88#	FEATURE_DEVS - what features to include in the executable.
89#	    Normally this is one of:
90#		    $(PSD)psl1.dev - a PostScript Level 1 language interpreter.
91#		    $(PSD)psl2.dev - a PostScript Level 2 language interpreter.
92#		    $(PSD)psl3.dev - a PostScript LanguageLevel 3 language
93#		      interpreter.
94#	      and/or
95#		    pdf - a PDF 1.2 interpreter.
96#	    psl3 includes everything in psl2, and psl2 includes everything
97#	      in psl1.  For backward compatibility, level1 is a synonym for
98#	      psl1, and level2 is a synonym for psl2.
99#	    The remaining features are of interest primarily to developers
100#	      who want to "mix and match" features to create custom
101#	      configurations:
102#		    btoken - support for binary token encodings.
103#			Included automatically in the dps and psl2 features.
104#		    cidfont - (currently partial) support for CID-keyed fonts.
105#		    color - support for the Level 1 CMYK color extensions.
106#			Included automatically in the dps and psl2 features.
107#		    compfont - support for composite (type 0) fonts.
108#			Included automatically in the psl2 feature.
109#		    dct - support for DCTEncode/Decode filters.
110#			Included automatically in the psl2 feature.
111#                   diskn - support for %disk IODevice emulation. Adds support
112#                       for %disk0 thru %disk9. Use requires setting the /Root
113#                       paramter for each %disk (see Language.htm).
114#		    dps - (partial) support for Display PostScript extensions:
115#			see Language.htm for details.
116#		    dpsnext - (partial) support for Display PostScript
117#			extensions with NeXT's additions.
118#		    epsf - support for recognizing and skipping the binary
119#			header of MS-DOS EPSF files.
120#		    filter - support for Level 2 filters (other than eexec,
121#			ASCIIHexEncode/Decode, NullEncode, PFBDecode,
122#			RunLengthEncode/Decode, and SubFileDecode, which are
123#			always included, and DCTEncode/Decode,
124#			which are separate).
125#			Included automatically in the psl2 feature.
126#		    fzlib - support for zlibEncode/Decode filters.
127#		    ttfont - support for TrueType fonts.
128#		    type1 - support for Type 1 fonts and eexec;
129#			normally included automatically in all configurations.
130#		    type32 - support for Type 32 (downloaded bitmap) fonts.
131#			Included automatically in the psl2 feature.
132#		    type42 - support for Type 42 (embedded TrueType) fonts.
133#			Included automatically in the psl2 feature.
134#                   fapi - Font API (3d party font renderer interface).
135#		There are quite a number of other sub-features that can be
136#		selectively included in or excluded from a configuration,
137#		but the above are the ones that are most likely to be of
138#		interest.
139#	COMPILE_INITS - normally 1; compiles the PostScript language
140#	    initialization files (gs_init.ps et al) and Resource/* tree
141#	    into the executable, eliminating the need for these files
142#	    to be present at run time. Files will be placed in the
143#	    %rom% device.
144#	BAND_LIST_STORAGE - normally file; if set to memory, stores band
145#	    lists in memory (with compression if needed).
146#	BAND_LIST_COMPRESSOR - normally zlib: selects the compression method
147#	    to use for band lists in memory.
148#	FILE_IMPLEMENTATION - normally stdio; if set to fd, uses file
149#	    descriptors instead of buffered stdio for file I/O; if set to
150#	    both, provides both implementations with different procedure
151#	    names for the fd-based implementation (see sfxfd.c for
152#	    more information).
153#	STDIO_IMPLEMENTATION - normally 'c' which uses callouts and
154#	    ziodevsc.c, but ghostscript library must use '' for file
155#	    based stdio in ziodevs.c.
156#           Callouts use procedure based streams and return back to
157#           to gs_main_interpret() in imain.c whenever stdio is needed.
158#
159# It is very unlikely that anyone would want to edit the remaining
160#   symbols, but we describe them here for completeness:
161#	GS_INIT - the name of the initialization file for the interpreter,
162#		normally gs_init.ps.
163#	PLATFORM - a "device" name for the platform, so that platforms can
164#		add various kinds of resources like devices and features.
165#	CMD - the suffix for shell command files (e.g., null or .bat).
166#		(This is only needed in a few places.)
167#	D - the directory separator character (\ for MS-DOS, / for Unix).
168#	O_ - the string for specifying the output file from the C compiler
169#		(-o for MS-DOS, -o ./ for Unix).
170#	OBJ - the extension for relocatable object files (e.g., o or obj).
171#	XE - the extension for executable files (e.g., null or .exe).
172#	XEAUX - the extension for the executable files (e.g., null or .exe)
173#		for the utility programs (those compiled with CCAUX).
174#	BEGINFILES - the list of additional files that `make clean' should
175#		delete.
176#	CCAUX - the C invocation for auxiliary programs (echogs, genarch,
177#		genconf, gendev, genht, geninit).
178#	CC_ - the C invocation for normal compilation.
179#	CCD - the C invocation for files that store into frame buffers or
180#		device registers.  Needed because some optimizing compilers
181#		will eliminate necessary stores.
182#	CCINT - the C invocation for compiling the main interpreter module,
183#		normally the same as CC_: this is needed because the
184#		Borland compiler generates *worse* code for this module
185#		(but only this module) when optimization (-O) is turned on.
186#	AK - if a particular platform requires any programs or data files
187#		to be built before compiling the source code, AK must list
188#		them.
189#	EXP - the prefix for invoking an executable program in a specified
190#		directory (MCR on OpenVMS, null on all other platforms).
191#	SH - the shell for scripts (null on MS-DOS, sh on Unix).
192#	CONFILES - the arguments for genconf to generate the appropriate
193#		linker control files (various).
194#	CONFLDTR - the genconf switch for generating ld_tr.
195#	CP_ - the command for copying one file to another.  Because of
196#		limitations in the MS-DOS/MS Windows environment, the
197#		second argument must be either '.' (in which case the
198#		write date may be either preserved or set to the current
199#		date) or a file name (in which case the write date is
200#		always updated).
201#	RM_ - the command for deleting (a) file(s) (including wild cards,
202#		but limited to a single file or pattern).
203#	RMN_ = the command for deleting multiple files / patterns.
204#
205# The platform-specific makefiles must also include rules for creating
206# certain dynamically generated files:
207#	gconfig_.h - this indicates the presence or absence of
208#	    certain system header files that are located in different
209#	    places on different systems.  (It could be generated by
210#	    the GNU `configure' program.)
211#	gconfigd.h - this is used for configuration-specific definitions
212#	    such as paths that must be defined by all top-level makefiles.
213
214#**************** PATCHES
215FTGENDIR=$(GLGENDIR)
216FTOBJDIR=$(GLOBJDIR)
217JGENDIR=$(GLGENDIR)
218JOBJDIR=$(GLOBJDIR)
219PNGGENDIR=$(GLGENDIR)
220PNGOBJDIR=$(GLOBJDIR)
221ZGENDIR=$(GLGENDIR)
222ZOBJDIR=$(GLOBJDIR)
223ZAUXDIR=$(AUXDIR)
224TIFFGENDIR=$(GLGENDIR)
225TIFFOBJDIR=$(GLOBJDIR)
226JBIG2GENDIR=$(GLGENDIR)
227JBIG2OBJDIR=$(GLOBJDIR)
228JPXGENDIR=$(GLGENDIR)
229JPXOBJDIR=$(GLOBJDIR)
230ICCGENDIR=$(GLGENDIR)
231ICCOBJDIR=$(GLOBJDIR)
232LCMSGENDIR=$(GLGENDIR)
233LCMSOBJDIR=$(GLOBJDIR)
234LCMS2GENDIR=$(GLGENDIR)
235LCMS2OBJDIR=$(GLOBJDIR)
236EXPATGENDIR=$(GLGENDIR)
237EXPATOBJDIR=$(GLOBJDIR)
238IJSGENDIR=$(GLGENDIR)
239IJSOBJDIR=$(GLOBJDIR)
240LCUPSGENDIR=$(GLGENDIR)
241LCUPSOBJDIR=$(GLOBJDIR)
242LCUPSIGENDIR=$(GLGENDIR)
243LCUPSIOBJDIR=$(GLOBJDIR)
244#**************** END PATCHES
245
246GSGEN=$(GLGENDIR)$(D)
247GSOBJ=$(GLOBJDIR)$(D)
248# All top-level makefiles define DD.
249#DD=$(GLGEN)
250
251# Define the name of this makefile.
252GS_MAK=$(GLSRCDIR)$(D)gs.mak
253
254# Define the names of the executables.
255GS_XE=$(BINDIR)$(D)$(GS)$(XE)
256AUX=$(AUXDIR)$(D)
257ECHOGS_XE=$(AUX)echogs$(XEAUX)
258GENARCH_XE=$(AUX)genarch$(XEAUX)
259GENCONF_XE=$(AUX)genconf$(XEAUX)
260GENDEV_XE=$(AUX)gendev$(XEAUX)
261GENHT_XE=$(AUX)genht$(XEAUX)
262MKROMFS_XE=$(AUX)mkromfs$(XEAUX)
263
264# Define the names of the generated header files.
265# gconfig*.h and gconfx*.h are generated dynamically.
266gconfig_h=$(GLGENDIR)$(D)gconfig.h
267gconfxx_h=$(GLGENDIR)$(D)gconfxx.h
268gconfigf_h=$(GLGENDIR)$(D)gconfxc.h
269gconfigd_h=$(GLGENDIR)$(D)gconfigd.h
270
271all default : $(GS_XE) $(GS_SHARED_OBJS) $(MAKEDIRSTOP) $(MAKEDIRS)
272	$(NO_OP)
273
274# the distclean and maintainer-clean targets (if any)
275# are the responsibility of the platform-specific
276# makefiles. We only handle the internal build system
277# apparatus here.
278realclean : clean
279	$(NO_OP)
280
281clean : mostlyclean
282	$(RM_) $(GSGEN)arch.h
283	$(RM_) $(GS_XE)
284	$(RM_) $(GS_SHARED_OBJS)
285	$(RMN_) -r $(BINDIR) $(GLGENDIR) $(GLOBJDIR) $(PSGENDIR) $(PSOBJDIR)
286
287#****** FOLLOWING IS WRONG, NEEDS TO BE PER-SUBSYSTEM ******
288mostlyclean : config-clean
289	$(RMN_) $(GSOBJ)*.$(OBJ) $(GSOBJ)*.a $(GSOBJ)core $(GSOBJ)gmon.out
290	$(RMN_) $(GSGEN)deflate.h $(GSGEN)zutil.h
291	$(RMN_) $(GSGEN)gconfig*.c $(GSGEN)gscdefs*.c $(GSGEN)iconfig*.c
292	$(RMN_) $(GSGEN)_temp_* $(GSGEN)_temp_*.* $(GSOBJ)*.map $(GSOBJ)*.sym
293	$(RMN_) $(GENARCH_XE) $(GENCONF_XE) $(GENDEV_XE) $(GENHT_XE)
294	$(RMN_) $(ECHOGS_XE)
295	$(RMN_) $(GSGEN)gs_init.ps $(BEGINFILES)
296	$(RMN_) $(MKROMFS_XE)
297	$(RMN_) $(MKROMFS_XE)_0
298	$(RMN_) $(MKROMFS_XE)_1
299	$(RMN_) $(GSGEN)gsromfs1.c $(GSGEN)gsromfs1_.c $(GSGEN)gsromfs1_1.c
300	$(RMN_) $(AUX)*.$(OBJ) $(AUX)gscdefs*.c
301
302# Remove only configuration-dependent information.
303#****** FOLLOWING IS WRONG, NEEDS TO BE PER-SUBSYSTEM ******
304config-clean :
305	$(RMN_) $(GSGEN)*.dev $(GSGEN)devs*.tr $(GSGEN)gconfig*.h
306	$(RMN_) $(GSGEN)gconfx*.h $(GSGEN)j*.h $(GSGEN)tif*.h
307	$(RMN_) $(GSGEN)c*.tr $(GSGEN)o*.tr $(GSGEN)l*.tr
308
309# Macros for constructing the *.dev files that describe features and
310# devices.
311SETDEV=$(EXP)$(ECHOGS_XE) -e .dev -w- -l-dev -b -s -l-obj
312SETPDEV=$(EXP)$(ECHOGS_XE) -e .dev -w- -l-dev -b -s -l-include -l$(GLGENDIR)$(D)page -l-obj
313SETDEV2=$(EXP)$(ECHOGS_XE) -e .dev -w- -l-dev2 -b -s -l-obj
314SETPDEV2=$(EXP)$(ECHOGS_XE) -e .dev -w- -l-dev2 -b -s -l-include -l$(GLGENDIR)$(D)page -l-obj
315SETMOD=$(EXP)$(ECHOGS_XE) -e .dev -w- -l-obj
316ADDMOD=$(EXP)$(ECHOGS_XE) -e .dev -a- $(NULL)
317SETCOMP=$(EXP)$(ECHOGS_XE) -e .dev -w- -l-comp
318ADDCOMP=$(EXP)$(ECHOGS_XE) -e .dev -a- -l-comp
319
320# Define the search lists and compilation switches for the third-party
321# libraries, and the compilation switches for their clients.
322# The search lists must be enclosed in $(I_) and $(_I).
323# Note that we can't define the entire compilation command,
324# because this must include $(GLSRCDIR), which isn't defined yet.
325ICCI_=$(ICCSRCDIR)
326ICCF_=
327# Currently there is no option for sharing icclib.
328ICCCF_=
329IJSI_=$(IJSSRCDIR)
330IJSF_=
331# Currently there is no option for sharing ijs.
332IJSCF_=
333JI_=$(JSRCDIR)
334JF_=
335JCF_=$(D_)SHARE_JPEG=$(SHARE_JPEG)$(_D)
336PI_=$(PNGSRCDIR) $(II)$(ZSRCDIR)
337# PF_ should include PNG_USE_CONST, but this doesn't work.
338#PF_=-DPNG_USE_CONST
339TI_=$(TIFFSRCDIR)$(D)libtiff $(II)$(JGENDIR)  $(II)$(ZSRCDIR)
340PF_=
341PCF_=$(D_)SHARE_LIBPNG=$(SHARE_LIBPNG)$(_D)
342ZI_=$(ZSRCDIR)
343ZF_=
344ZCF_=$(D_)SHARE_ZLIB=$(SHARE_ZLIB)$(_D)
345JB2I_=$(JBIG2SRCDIR)
346JB2CF_=$(JBIG2_CFLAGS)
347LDF_JB2I_=$(JBIG2SRCDIR)$(D)source$(D)libraries
348JPXI_=$(JPXSRCDIR)$(D)src$(D)libjasper$(D)include
349LWF_JPXI_=$(JPXSRCDIR)$(D)library$(D)source
350JPXCF_=$(JPX_CFLAGS)
351JPX_OPENJPEG_I_=$(JPXSRCDIR)$(D)libopenjpeg
352
353######################## How to define new 'features' #######################
354#
355# One defines new 'features' exactly like devices (see devs.mak for details).
356# For example, one would define a feature abc by adding the following to
357# gs.mak:
358#
359#	abc_=abc1.$(OBJ) ...
360#	$(PSD)abc.dev : $(GS_MAK) $(ECHOGS_XE) $(abc_)
361#		$(SETMOD) $(PSD)abc $(abc_)
362#		$(ADDMOD) $(PSD)abc -obj ... [if needed]
363#		$(ADDMOD) $(PSD)abc -oper ... [if appropriate]
364#		$(ADDMOD) $(PSD)abc -ps ... [if appropriate]
365#
366# Use PSD for interpreter-related features, GLD for library-related.
367# If the abc feature requires the presence of some other features jkl and
368# pqr, then the rules must look like this:
369#
370#	abc_=abc1.$(OBJ) ...
371#	$(PSD)abc.dev : $(GS_MAK) $(ECHOGS_XE) $(abc_)\
372#	 $(PSD)jkl.dev $(PSD)pqr.dev
373#		$(SETMOD) $(PSD)abc $(abc_)
374#		...
375#		$(ADDMOD) $(PSD)abc -include $(PSD)jkl
376#		$(ADDMOD) $(PSD)abc -include $(PSD)pqr
377
378# --------------------- Configuration-dependent files --------------------- #
379
380# gconfig.h shouldn't have to depend on DEVS_ALL, but that would
381# involve rewriting gsconfig to only save the device name, not the
382# contents of the <device>.dev files.
383# FEATURE_DEVS must precede DEVICE_DEVS so that devices can override
384# features in obscure cases.
385
386# FEATURE_DEVS_EXTRA and DEVICE_DEVS_EXTRA are explicitly reserved
387# to be set from the command line.
388FEATURE_DEVS_EXTRA=
389DEVICE_DEVS_EXTRA=
390
391DEVS_ALL=$(GLGENDIR)$(D)$(PLATFORM).dev\
392 $(FEATURE_DEVS) $(FEATURE_DEVS_EXTRA) \
393 $(DEVICE_DEVS) $(DEVICE_DEVS1) \
394 $(DEVICE_DEVS2) $(DEVICE_DEVS3) $(DEVICE_DEVS4) $(DEVICE_DEVS5) \
395 $(DEVICE_DEVS6) $(DEVICE_DEVS7) $(DEVICE_DEVS8) $(DEVICE_DEVS9) \
396 $(DEVICE_DEVS10) $(DEVICE_DEVS11) $(DEVICE_DEVS12) $(DEVICE_DEVS13) \
397 $(DEVICE_DEVS14) $(DEVICE_DEVS15) $(DEVICE_DEVS16) $(DEVICE_DEVS17) \
398 $(DEVICE_DEVS18) $(DEVICE_DEVS19) $(DEVICE_DEVS20) $(DEVICE_DEVS21) \
399 $(DEVICE_DEVS_EXTRA) $(GLD)romfs$(COMPILE_INITS).dev
400
401devs_tr=$(GLGENDIR)$(D)devs.tr
402$(devs_tr) : $(GS_MAK) $(TOP_MAKEFILES) $(ECHOGS_XE)
403	$(EXP)$(ECHOGS_XE) -w $(devs_tr) - -include $(GLGENDIR)$(D)$(PLATFORM)
404	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(FEATURE_DEVS)
405	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(FEATURE_DEVS_EXTRA)
406	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS)
407	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS1)
408	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS2)
409	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS3)
410	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS4)
411	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS5)
412	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS6)
413	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS7)
414	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS8)
415	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS9)
416	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS10)
417	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS11)
418	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS12)
419	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS13)
420	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS14)
421	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS15)
422	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS16)
423	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS17)
424	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS18)
425	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS19)
426	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS20)
427	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS21)
428	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(DEVICE_DEVS_EXTRA)
429	$(EXP)$(ECHOGS_XE) -a $(devs_tr) -+ $(GLD)romfs$(COMPILE_INITS).dev
430	$(EXP)$(ECHOGS_XE) -a $(devs_tr) - $(GLGENDIR)$(D)libcore
431
432# GCONFIG_EXTRAS can be set on the command line.
433# Note that it consists of arguments for echogs, i.e.,
434# it isn't just literal text.
435GCONFIG_EXTRAS=
436
437ld_tr=$(GLGENDIR)$(D)ld.tr
438$(ld_tr) : \
439  $(GS_MAK) $(TOP_MAKEFILES) $(GLSRCDIR)$(D)version.mak $(GENCONF_XE) $(ECHOGS_XE) $(devs_tr) $(DEVS_ALL) $(GLGENDIR)$(D)libcore.dev
440	$(EXP)$(GENCONF_XE) $(devs_tr) -h /dev/stdout $(CONFILES) $(CONFLDTR) $(ld_tr) | awk 'BEGIN{j=0; p=1;} /jpeg_device/ {if(j++ > 0) p=0;} // { if(p==1) { print; } else { p=1 } }' > $(gconfxx_h)
441	$(EXP)$(ECHOGS_XE) -a $(gconfxx_h) $(GCONFIG_EXTRAS)
442
443$(gconfxx_h) : $(ld_tr)
444	$(NO_OP)
445
446$(gconfig_h) : $(gconfxx_h)
447	$(RM_) $(gconfig_h)
448	$(CP_) $(gconfxx_h) $(gconfig_h)
449
450# The line above is an empty command; don't delete.
451
452# save our set of makefile variables that are defined in every build (paths, etc.)
453$(gconfigd_h) : $(ECHOGS_XE) $(GS_MAK) $(TOP_MAKEFILES) $(GLSRCDIR)$(D)version.mak
454	$(EXP)$(ECHOGS_XE) -w $(gconfigd_h) -x 23 define -s -u GS_LIB_DEFAULT -x 2022 $(GS_LIB_DEFAULT) -x 22
455	$(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u GS_DEV_DEFAULT -x 2022 $(GS_DEV_DEFAULT) -x 22
456	$(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u GS_CACHE_DIR -x 2022 $(GS_CACHE_DIR) -x 22
457	$(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u SEARCH_HERE_FIRST -s $(SEARCH_HERE_FIRST)
458	$(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u GS_DOCDIR -x 2022 $(GS_DOCDIR) -x 22
459	$(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u GS_INIT -x 2022 $(GS_INIT) -x 22
460	$(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u GS_REVISION -s $(GS_REVISION)
461	$(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u GS_REVISIONDATE -s $(GS_REVISIONDATE)
462
463obj_tr=$(GLGENDIR)$(D)obj.tr
464$(obj_tr) : $(ld_tr)
465	$(EXP)$(GENCONF_XE) $(devs_tr) $(CONFILES) -o $(obj_tr)
466