?? make.htm
字號:
<p>
It is possible to substitute an LZW compressor for the LZW-compatible
encoder provided with the standard fileset, by finding two lines in
<b><tt>lib.mak</tt></b>
<blockquote><b><tt>
lzwe_=slzwce.$(OBJ) slzwc.$(OBJ)<br>
#lzwe_=slzwe.$(OBJ) slzwc.$(OBJ)
</tt></b></blockquote>
<p>
and changing them to
<blockquote><b><tt>
#lzwe_=slzwce.$(OBJ) slzwc.$(OBJ)<br>
lzwe_=slzwe.$(OBJ) slzwc.$(OB)
</tt></b></blockquote>
<p>
If you do this, you are responsible for constructing or obtaining a file
<b><tt>slzwe.c</tt></b> that implements LZW compression; no such file is
included in any current standard Ghostscript distribution, although you may
be able to find one in distributions that predate Unisys's amnesty cutoff
of January 1, 1995. You are also responsible for drawing your own
conclusions about the applicability to LZW compression code of patents held
by Unisys and IBM, and for obtaining any licenses you believe to be
relevant.
<h2><a name="Makefile_setup"></a>Setting up "makefile"</h2>
<p>
After you make all your changes, as the final step in preparing to build
Ghostscript you must usually associate the name "<b><tt>makefile</tt></b>"
with the correct makefile for your environment so the
<b><tt>make</tt></b> command can find it. See the section on your
particular platform for how to do that if necessary.
<h2><a name="Invoke_make"></a>Invoking "make"</h2>
<dl>
<dt><b><tt>make</tt></b>
<dd>Builds Ghostscript without debugging options.
</dl>
<dl>
<dt><a name="Debugging"></a><b><tt>make debug</tt></b>
<dd>Builds Ghostscript with debugging options and additional internal error
checks. The program will be somewhat larger and slower, but it will behave
no differently unless you actually turn on debugging options at execution
time with the <b><tt>-DDEBUG</tt></b> or
<a href="Use.htm#Debugging"><b><tt>-Z</tt></b> command line switches</a>
described in the usage documentation.
</dl>
<dl>
<dt><b><tt>make begin</tt></b>
<dd>On PC platforms, attempts a quick and dirty compilation of all the
<b><tt>.c</tt></b> files in the current directory. See the
<a href="#Make_begin">more detailed explanation</a>.
</dl>
<dl>
<dt><b><tt>make install</tt></b>
<dd>After building, installs the Ghostscript executables, support files,
and documentation, but does <b><em>not</em></b> install fonts. See the
<a href="Install.htm">installation documentation</a>.
</dl>
<dl>
<dt><b><tt>make clean</tt></b>
<dd>Deletes all the files created by the build process (relocatables,
executables, and miscellaneous temporary files). If you've built an
executable and want to save it, move it first to another place, because
"<b><tt>make clean</tt></b>" deletes it.
</dl>
<p>
<b><em>Note:</em></b> on most platforms some of these simple instructions don't
quite work in one way or another. Read the section on your specific
platform.
<h2><a name="Cross-compiling"></a>Cross-compiling</h2>
<p>
If you are compiling Ghostscript on machine <b>X</b> with a cross-compiler
that generates code for machine <b>Y</b>, an extra phase is needed:
<blockquote><ol>
<li><b><tt>make arch.h</tt></b>
<li>Edit <b><tt>arch.h</tt></b> to reflect the architecture of machine <b>Y</b>.
<li>Finally make the executable.
</ol></blockquote>
<hr>
<h1><a name="PC_build"></a>How to build Ghostscript from source (PC version)</h1>
<p>
The relevant makefiles are
<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">PC makefiles</font><hr>
<tr> <th align=left>Makefile
<td>  
<th align=left>Construction tools
<td>  
<th align=left>For environment
<tr> <td colspan=5><hr>
<tr> <td valign=top><b><tt>bcwin32.mak</tt></b>
<td>
<td valign=top><a href="#Borland_build">Borland C++ 4.x</a>
<td>
<td valign=top>32-bit MS Windows 3.1 + Win32s, 95, NT
<tr> <td valign=top><b><tt>msvc32.mak</tt></b>
<td>
<td valign=top><a href="#Microsoft_build">Microsoft Visual C++ 4.x or 5.x</a>
<td>
<td valign=top>MS Windows32-bit
<tr> <td valign=top><b><tt>watc.mak</tt></b>
<td>
<td valign=top><a href="#Watcom_build">Watcom C/386 or C++</a>
<td>
<td valign=top>MS-DOS 32-bit (extended)
<tr> <td valign=top><b><tt>watcw32.mak</tt></b>
<td>
<td valign=top><a href="#Watcom_build">Watcom C/386 or C++</a>
<td>
<td valign=top>MS Windows 32-bit (<b>DOESN'T WORK YET</b>)
<tr> <td valign=top><b><tt>unix-gcc.mak</tt></b>
<td>
<td valign=top><a href="#Cygwin32_build">Cygnus gcc</a>
<td>
<td valign=top><a href="http://www.cygnus.com/misc/gnu-win32/">Cygnus gnu-win32</a>
</table></blockquote>
<p>
To build Ghostscript you need MS-DOS version 3.3 or later and Borland C/C++
(4.0 or later); Microsoft Visual C++ (version 4.0 or later); Watcom C/386
(version 8.5 or later) or C++ (any version); or the free djgpp + go32
development system. The options in the makefiles were chosen to strike a
balance between RAM consumption and likely usefulness. The default
configuration generates an executable that assumes the directory where
<b><tt>make</tt></b> was run as the final default directory for looking up
the Ghostscript initialization and font files.
<p>
You must have <b><tt>COMMAND.COM</tt></b> in your path to build
Ghostscript. After making the changes needed to choose features and
devices to build into the executable, to build the Ghostscript executable
all you need do is give the <b><tt>make</tt></b> command.
<p><a name="Make_begin"></a>
A special make target "<b><tt>begin</tt></b>" attempts to compile all the
<b><tt>.c</tt></b> files in the current directory. Some of these
compilations will fail, but the ones that succeed will go considerably
faster because they don't individually pay the overhead of starting up the
compiler. So a good strategy for building the executable for the first
time, or after changing a widely used <b><tt>.h</tt></b> file, is to do the
fast compilation of everything possible, then the controlled compilation of
everything that failed in the first step:
<blockquote><b><tt>
make begin<br>
make
</tt></b></blockquote>
<p>
<b><em>Note:</em></b> if you unpack the Ghostscript sources on a DOS or MS Windows
system from a Unix tar file, the unpacked files have linefeed alone as the
line terminator (the Unix convention) instead of carriage return + linefeed
(the Microsoft convention), which may make the C compiler unhappy. One
simple way to fix this, if you have the InfoZIP <b><tt>zip</tt></b> and
<b><tt>unzip</tt></b> programs, is
<blockquote><table cellpadding=0 cellspacing=0>
<tr> <td><b><tt>zip -l CVTEMP.zip *.bat *.c *.h</tt></b>
<td>
<td>(Letter "l", not the digit "1")
<tr> <td><b><tt>unzip -o CVTEMP.zip</tt></b>
<td>
<td>(Rewrite all the same files correctly)
<tr> <td><b><tt>del CVTEMP.zip</tt></b>
<td>
<td>(Delete the temporary zip file)
</table></blockquote>
<h2><a name="Borland_build"></a>Borland environment</h2>
<p>
To compile Ghostscript with the Borland environment, you need Borland C++
(version 4.0 or later); specifically the compiler, <b><tt>make</tt></b> utility, and
linker. You also need either the Borland assembler (version 1.0 or later)
or the Microsoft assembler (version 4.0 or later).
<p>
To create "<b><tt>makefile</tt></b>", give the command
<blockquote><b><tt>
echo !include "bcwin32.mak" >makefile
</tt></b></blockquote>
<p>
Besides the source files and the makefiles, you need:
<blockquote><table cellpadding=0 cellspacing=0>
<tr valign=top> <td><b><tt>turboc.cfg</tt></b>
<td>
<td>(the flags and switches for Turbo C)
<tr valign=top> <td><b><tt>gs.tr</tt></b>
<td>
<td>(the linker commands for the interpreter)
<tr valign=top> <td>*<b><tt>.bat</tt></b>
<td>
<td>(a variety of batch files used in the build process)
</table></blockquote>
<p>
Comments in the makefiles describe the configuration parameters. If your
configuration is different from the following, you should definitely read
those comments and see if you want or need to change any of this:
<ul>
<li>The compiler files are in <b><tt>C:\BC</tt></b> and its subdirectories.
<li>You are using the Borland assembler <b><tt>tasm</tt></b>.
<li>You want an executable that will run on any 32-bit PC-compatible,
regardless of processor type (80386, 80486, Pentium, or compatible) and
regardless of whether a math coprocessor (80x87) is present -- an issue only
with 80386 processors.
</ul>
<p>
<b>Notes</b>
<ul>
<li>A user reports that the Borland C++ 4.00 with patch 1-6 doesn't
produce a working executable of Ghostscript 5.03. We can't test this,
since we no longer have this compiler.
<li>Borland C++ 4.5 has a bug or bugs that cause(s) the 32-bit Windows
executable to crash if you give any @-files on the command line. Among
other things, this makes the uniprint driver unusable, because it references
the .upp configuration files this way. This problem may possibly be fixed
by one or more of the patch files on
<blockquote>
<a href="ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/">ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/</a>
</blockquote>
<li>Borland C++ 4.52 has a bug that causes the 32-bit Windows executable to
fail during startup. Borland (now Inprise) provides a patch for this bug
in
<blockquote>
<a href="ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/bc45xp1.zip">ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/bc45xp1.zip</a>
</blockquote>
<li>Borland C++ 5.0 and 5.01 have a code generator bug that generates
incorrect code for the construct <b><tt>!file_is_valid()</tt></b>. Do not
attempt to compile Ghostscript with these compilers. If you want to report
this bug to Borland, send them the result of compiling
<b><tt>ziodev.c</tt></b> and tell them to look at the code generated for
<b><tt>file_is_valid()</tt></b> and <b><tt>!file_is_valid()</tt></b>. We
don't know whether Borland C++ 5.02 still has this problem.
<li>Building for the MS Windows Win32s environment, you need
<b><tt>bcc32.cfg</tt></b> instead of <b><tt>turboc.cfg</tt></b>. The make
process will stop after it has created <b><tt>genarch.exe</tt></b>. You
should then run "<b><tt>win genarch arch.h</tt></b>", wait until
<b><tt>genarch</tt></b> has finished and then exit MS Windows. Then type
"<b><tt>make</tt></b>" again to restart the make process.
<li>Building for MS Windows NT, you also need <b><tt>bcc32.cfg</tt></b>
instead of <b><tt>turboc.cfg</tt></b>, but the make process runs to
completion automatically.
</ul>
<h2><a name="Microsoft_build"></a>Microsoft environment</h2>
<p>
To compile Ghostscript with the Microsoft environment, you need Microsoft
Visual C++ 4.0 or later with its associated "<b><tt>nmake</tt></b>" utility
and linker. If you're using version 4.x, before building, in
<b><tt>msvc32.mak</tt></b> find the line
"<b><tt>MSVC_VERSION = 5</tt></b>" and change it to
"<b><tt>MSVC_VERSION = 4</tt></b>".
<p>
To create "<b><tt>makefile</tt></b>", give the command
<blockquote><b><tt>
echo !include msvc32.mak >makefile
</tt></b></blockquote>
<p>
You may get error messages during compilation about <b><tt>/QI0f</tt></b>
being an undefined switch, or the message "dwmain32.def: EXETYPE not
supported for platform; ignored" during linking. Ignore them.
<p>
The Microsoft VC++ 5.0 compiler locks up when compiling
<b><tt>gxi12bit.c</tt></b> with <b><tt>/O2</tt></b>. Compile this file
without <b><tt>/O2</tt></b>.
<p>
The Microsoft VC++ 5.0 compiler produces a non-working executable if
compiling without stack checking. Don't change the setting
<b><tt>TDEBUG=1</tt></b> in <b><tt>msvc32.mak</tt></b>.
<h2><a name="Watcom_build"></a>Watcom environment</h2>
<p>
<b>NOTE:</b> The Watcom compiler is unusable, because Watcom's
<b><tt>wmake</tt></b> and <b><tt>wmakel</tt></b> programs have severe size
limitations that cause them to run out of memory when processing the
Ghostscript makefiles. If enough people call Watcom (now PowerSoft)
technical support, maybe they will do something about this. If you have
suggestions for how to get around this limitation, please let us know.
<p>
On DOS or MS Windows with the Watcom compiler, add to
<b><tt>C:\AUTOEXEC.BAT</tt></b> the line
"<b><tt>set DOS4G=quiet</tt></b>". Then to create
"<b><tt>makefile</tt></b>":
<blockquote><table cellpadding=0 cellspacing=0>
<tr> <th align=left>Under
<td>
<th align=left>Give the command
<tr> <td colspan=3><hr>
<tr> <td>DOS
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -