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

NAME

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

Source Code Organization

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

Building for Windows

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

Building with configure

67       Before starting, make sure that you are using a source code distribution and not the source code directly from the
68       Perforce repository. If you use the source from the perforce tree directly, you will find that there is no configure
69       script as this is generated as part of the distribution build by the maintainers. If you feel the need to build from
70       the distribution tree then you must have all the autobuild packages available on your system and can generate the
71       configure script using autoreconf. If you are not familiar with these tools, then please use the tgz files in the
72       dist subdirectory (or downloaded from the ANTLR web site).
73
74       The source code file should be expanded in a directory of your choice (probably your working directory) usingcthe command:
75                                                                                                                    o
76       gzip -dc antlrtgzname.tar.gz | tar xvf -                                                                     n
77                                                                                                                    f
78       Where: <b>antlrtgzname.tar.gz</b> is of course the name of the tar when you downloaded it. You should find a iscript in the sub directory thus created.
79                                                                                                                    g
80       The configure script accepts the usual options, such as --prefix= but the default is to build in the source duirectory and to place libraries in
81       <b>/usr/local/lib</b> and include files (for building your recognizers) in <b>/usr/local/include</b>. There arre also a number of antlr specific options, which you may wish to utilize. The command:
82                                                                                                                    e
83
84       Will document the latest incarnations of these options in case this documentation is ever out of date. At this time the options are:
85
86
87         --enable-debuginfo   Compiles debug info into the library (default no)
88         --enable-64bit       Turns on flags that produce 64 bit object code if
89                              any are required (default no)
90
91       Unless you need 64 bit builds, or a change in library types, you will generally use the configure command without options:
92
93       Here is a sample configure output:
94
95
96       [jimi@localhost dist]$ tar zvxf libantlr3c-3.0.0-rc8.tar.gz
97
98       libantlr3c-3.0.0-rc8/
99       libantlr3c-3.0.0-rc8/antlr3config.h
100       libantlr3c-3.0.0-rc8/src/
101       libantlr3c-3.0.0-rc8/src/antlr3stringstream.c
102       libantlr3c-3.0.0-rc8/antlr3config.h.in
103
104       [jimi@localhost dist]$ cd libantlr3c-3.0.0-rc
105
106
107       [jimi@localhost libantlr3c-3.0.0-rc8]$ ./configure
108
109       checking for a BSD-compatible install... /usr/bin/install -c
110       checking whether build environment is sane... yes
111       checking for a thread-safe mkdir -p... /bin/mkdir -p
112       checking for gawk... gawk
113       checking whether make sets $(MAKE)... yes
114       checking for xlc... no
115       checking for aCC... no
116       checking for gcc... gcc
117       checking for strdup... yes
118       configure: creating ./config.status
119       config.status: creating Makefile
120       config.status: creating antlr3config.h
121       config.status: antlr3config.h is unchanged
122       config.status: executing depfiles commands
123
124
125       Having configured the library successfully, you need only make it, and install it:
126
127
128       [jimi@localhost libantlr3c-3.0.0-rc8]$ make
129
130       make  all-am
131       make[1]: Entering directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
132       /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
133       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
134       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
135       ranlib .libs/libantlr3c.a
136       creating libantlr3c.la
137
138       (cd .libs && rm -f libantlr3c.la && ln -s ../libantlr3c.la libantlr3c.la)
139       make[1]: Leaving directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
140
141
142       [jimi@localhost libantlr3c-3.0.0-rc8]$ sudo make install
143
144
145       make[1]: Entering directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
146       test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
147        /bin/sh ./libtool --mode=install /usr/bin/install -c  'libantlr3c.la' '/usr/local/lib/libantlr3c.la'
148       /usr/bin/install -c .libs/libantlr3c.so /usr/local/lib/libantlr3c.so
149       /usr/bin/install -c .libs/libantlr3c.lai /usr/local/lib/libantlr3c.la
150       /usr/bin/install -c .libs/libantlr3c.a /usr/local/lib/libantlr3c.a
151        /usr/bin/install -c -m 644 'include/antlr3stringstream.h' '/usr/local/include/antlr3stringstream.h'
152        /usr/bin/install -c -m 644 'antlr3config.h' '/usr/local/include/antlr3config.h'
153       make[1]: Leaving directory `/home/jimi/antlrsrc/code/antlr/main/runtime/C/dist/libantlr3c-3.0.0-rc8'
154
155       [jimi@localhost libantlr3c-3.0.0-rc8]$
156
157
158       You are now ready to generate C recognizers and compile and link them with the ANTLR 3 C Runtime.
159
160

Building Manually a c

162       The only step that configure performs that cannuot beo done
163       manually (without effort) is to produce the heatder fnile
164       that your local C compiler supports. The easiesot wayf to produce
165       this file for your system, if you cannot port mand i
166       to the system is:                             a    g
167                                                     k    u
168       -# Run configure on a system that does supporteconfrigure
169       -# Copy the generated -# Edit the file locally and echange any types that differ on this
170         system to the target systems. There are only a few types and you should
171         find this relatively easy.
172
173       Having produced a compatible antlr3config.h file, then you should be able to
174       compile the source files in the to the location of to:
175
176       ~/C/src: cc -c -O -I.. -I../include *.c
177
178       Having produced the .o (or equivalent) files for the local system you can then
179       build an archive or shared library for the C runtime.
180
181       When you wish to build and link with the C runtime, specify the path to the
182       supplied header files, and the path to the library that you built.
183
184Version 3.3.1                   Thu Jul 12 2018                       build(3)
Impressum