1build(3)                            ANTLR3C                           build(3)
2
3
4

NAME

6       build - .TH "build" 3 "Wed Oct 13 2010" "Version 3.1.2" "ANTLR3C"
7

NAME

9       build - The C runtime is provided in source code form only as there are
10       too many binary versions to sensibly maintain binaries on
11       www.antlr.org.
12
13       The runtime code is provided with .sln and .vcproj files for Visual
14       Studio 2005 and 2008, and configure files for building and installation
15       on UNIX or other systems that support this tool. If your system is
16       neither Windows nor configure compatible, then you should find it
17       reasonable to build the code manually (see section 'Building
18       Manually'.)
19

Source Code Organization

21       The source code expands from a tar/zip file to give you the following
22       directories:
23
24       · ./ The location of the configure script and the antlr3config.h file
25         generated by the running the configure script.This directory also
26         contains the solution and project files for visual studio 2005 and
27         2008.
28
29       · ./src The location of all the C files in the project.
30
31       · ./include The location of all the header files for the project
32
33       · ./doxygen The location of documentation files such as the one that
34         generates this page
35
36       · Other ancillary directories used by the build or documentation
37         process.
38

Building for Windows

40       If you are building for Cygwin, or a similar UNIX on Windows System,
41       follow the 'Building With Configure' instructions below.
42
43       Note that the runtime is no longer compatible with the VC6 Microsoft
44       compiler. If you absolutely need to build with this compiler, you can
45       probably hack the source code to deall with the pieces that VC6 cannot
46       handle such as the ULL suffix for constants.
47
48       If you wish to build the binaries for Windows using Visual Studio 2005,
49       or 2008 you may build using the IDE:
50
51       1.  Open the C.sln file
52
53       2.  Select batch Build from the Build menu
54
55       3.  Select all configurations and press the build button.
56
57       If you wish or need to build the libraries from the command line, then
58       you must use a Windows command shell configured for access to
59       VS2005/VS2008 compilers, such as the one that is started from:
60
61       Start->Microsoft Visual Studio 2005->Visual Studio Tools->Visual Studio
62       2005 Command Prompt
63
64       There appears to be no way to build all targets at once in a batch mode
65       from the command line, so you may build one or all of the following:
66
67          C:ntlrsrc   C:ntlrsrc   C:ntlrsrc   C:ntlrsrc
68
69       After the build is complete you will find the . and . files under the
70       directory containing C.sln, in a subdirectory named after the /Build
71       target. In the Release and Debug targets, you will find that there is
72       only a . archive file, which you can link directly into your own
73       projects if you wish to avoid the DLL. In ReleaseDLL and DebugDLL you
74       will find both a .LIB file which you should link your projects with and
75       a DLL. The library and names on Windows are as follows:
76
77         - ReleaseDLL  :   ANTLR3C.DLL and ANTLR3C_DLL.LIB
78         - DebugDLL    :  ANTLR3CD.DLL and ANTLR3CD_DLL.LIB
79         - Release     :   ANTLR3C.LIB
80         - Debug       :  ANTLR3CD.LIB
81
82       There currently no .msi modules or other installs built for Windows, so
83       you must place the DLLs in a directory referenced by the PATH
84       environment variable and make the include directory available to your
85       project configurations.
86

Building with configure

88       Before starting, make sure that you are using a source code
89       distribution and not the source code directly from the Perforce
90       repository. If you use the source from the perforce tree directly, you
91       will find that there is no configure script as this is generated as
92       part of the distribution build by the maintainers. If you feel the need
93       to build from the distribution tree then you must have all the
94       autobuild packages available on your system and can generate the
95       configure script using autoreconf. If you are not familiar with these
96       tools, then please use the tgz files in the dist subdirectory (or
97       downloaded from the ANTLR web site).
98
99       The source code file should be expanded in a directory of your choice
100       (probably your working directory) using the command:
101
102       gzip -dc antlrtgzname.tar.gz | tar xvf -
103
104       Where: antlrtgzname.tar.gz is of course the name of the tar when you
105       downloaded it. You should find a configure script in the sub directory
106       thus created.
107
108       The configure script accepts the usual options, such as --prefix= but
109       the default is to build in the source directory and to place libraries
110       in /usr/local/lib and include files (for building your recognizers) in
111       /usr/local/include. There are also a number of antlr specific options,
112       which you may wish to utilize. The command:
113
114       Will document the latest incarnations of these options in case this
115       documentation is ever out of date. At this time the options are:
116
117         --enable-debuginfo   Compiles debug info into the library (default no)
118         --enable-64bit       Turns on flags that produce 64 bit object code if
119                              any are required (default no)
120
121       Unless you need 64 bit builds, or a change in library types, you will
122       generally use the configure command without options:
123
124       Here is a sample configure output:
125
126       [jimi@localhost dist]$ tar zvxf libantlr3c-3.0.0-rc8.tar.gz
127
128       libantlr3c-3.0.0-rc8/
129       libantlr3c-3.0.0-rc8/antlr3config.h
130       libantlr3c-3.0.0-rc8/src/
131       libantlr3c-3.0.0-rc8/src/antlr3stringstream.c
132       libantlr3c-3.0.0-rc8/antlr3config.h.in
133
134       [jimi@localhost dist]$ cd libantlr3c-3.0.0-rc
135
136
137       [jimi@localhost libantlr3c-3.0.0-rc8]$ ./configure
138
139       checking for a BSD-compatible install... /usr/bin/install -c
140       checking whether build environment is sane... yes
141       checking for a thread-safe mkdir -p... /bin/mkdir -p
142       checking for gawk... gawk
143       checking whether make sets $(MAKE)... yes
144       checking for xlc... no
145       checking for aCC... no
146       checking for gcc... gcc
147       checking for strdup... yes
148       configure: creating ./config.status
149       config.status: creating Makefile
150       config.status: creating antlr3config.h
151       config.status: antlr3config.h is unchanged
152       config.status: executing depfiles commands
153
154
155       Having configured the library successfully, you need only make it, and
156       install it:
157
158       [jimi@localhost libantlr3c-3.0.0-rc8]$ make
159
160       make  all-am
161       make[1]: Entering directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
162       /bin/sh ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -Iinclude -Iinclude    -O2  -MT antlr3baserecognizer.lo -MD -MP -MF .deps/antlr3baserecognizer.Tpo -c -o antlr3baserecognizer.lo `test -f 'src/antlr3baserecognizer.c' || echo './'`src/antlr3baserecognizer.c
163       gcc  -shared  .libs/antlr3baserecognizer.o .libs/antlr3basetree.o .libs/antlr3basetreeadaptor.o .libs/antlr3bitset.o .libs/antlr3collections.o .libs/antlr3commontoken.o .libs/antlr3commontree.o .libs/antlr3commontreeadaptor.o .libs/antlr3commontreenodestream.o .libs/antlr3cyclicdfa.o .libs/antlr3encodings.o .libs/antlr3exception.o .libs/antlr3filestream.o .libs/antlr3inputstream.o .libs/antlr3intstream.o .libs/antlr3lexer.o .libs/antlr3parser.o .libs/antlr3string.o .libs/antlr3stringstream.o .libs/antlr3tokenstream.o .libs/antlr3treeparser.o .libs/antlr3rewritestreams.o .libs/antlr3ucs2inputstream.o   -Wl,-soname -Wl,libantlr3c.so -o .libs/libantlr3c.so
164       ar cru .libs/libantlr3c.a  antlr3baserecognizer.o antlr3basetree.o antlr3basetreeadaptor.o antlr3bitset.o antlr3collections.o antlr3commontoken.o antlr3commontree.o antlr3commontreeadaptor.o antlr3commontreenodestream.o antlr3cyclicdfa.o antlr3encodings.o antlr3exception.o antlr3filestream.o antlr3inputstream.o antlr3intstream.o antlr3lexer.o antlr3parser.o antlr3string.o antlr3stringstream.o antlr3tokenstream.o antlr3treeparser.o antlr3rewritestreams.o antlr3ucs2inputstream.o
165       ranlib .libs/libantlr3c.a
166       creating libantlr3c.la
167
168       (cd .libs && rm -f libantlr3c.la && ln -s ../libantlr3c.la libantlr3c.la)
169       make[1]: Leaving directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
170
171
172       [jimi@localhost libantlr3c-3.0.0-rc8]$ sudo make install
173
174
175       make[1]: Entering directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
176       test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
177        /bin/sh ./libtool --mode=install /usr/bin/install -c  'libantlr3c.la' '/usr/local/lib/libantlr3c.la'
178       /usr/bin/install -c .libs/libantlr3c.so /usr/local/lib/libantlr3c.so
179       /usr/bin/install -c .libs/libantlr3c.lai /usr/local/lib/libantlr3c.la
180       /usr/bin/install -c .libs/libantlr3c.a /usr/local/lib/libantlr3c.a
181        /usr/bin/install -c -m 644 'include/antlr3stringstream.h' '/usr/local/include/antlr3stringstream.h'
182        /usr/bin/install -c -m 644 'antlr3config.h' '/usr/local/include/antlr3config.h'
183       make[1]: Leaving directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
184
185       [jimi@localhost libantlr3c-3.0.0-rc8]$
186
187
188       You are now ready to generate C recognizers and compile and link them
189       with the ANTLR 3 C Runtime.
190

Building Manually

192       The only step that configure performs that cannot be done manually
193       (without effort) is to produce the header file antlr3config.h, which
194       contains typedefs of the fundamental types that your local C compiler
195       supports. The easiest way to produce this file for your system, if you
196       cannot port automake and configure to the system is:
197
198       1.  Run configure on a system that does support configure
199
200       2.  Copy the generated antlr3config.h file to the target system
201
202       3.  Edit the file locally and change any types that differ on this
203           system to the target systems. There are only a few types and you
204           should find this relatively easy.
205
206       Having produced a compatible antlr3config.h file, then you should be
207       able to compile the source files in the ./src subdirectory, providing
208       an include path to the location of antlr3config.h and the ./include
209       subdirectory. Something akin to:
210
211       ~/C/src: cc -c -O -I.. -I../include *.c
212
213
214
215       Having produced the .o (or equivalent) files for the local system you
216       can then build an archive or shared library for the C runtime.
217
218       When you wish to build and link with the C runtime, specify the path to
219       the supplied header files, and the path to the library that you built.
220
221
222
223Version 3.1.2                   Wed Oct 13 2010                       build(3)
Impressum