# Artistic Style Install Information

### Contents

Artistic Style Versions

Linux Version

GCC Compiler

Intel Compiler

Other Makefile Options

Mac OS X Version

OpenVMS Version

Windows Version

Precompiled Executable

Visual C++ Compiler

Other Compilers

Compiler Options

### Artistic Style Versions

astyle_x.y_linux.tar.gz is the Linux version of Artistic Style. It contains the source code, documentation, and makefiles. The Linux Version compile instructions below give information for compiling the source code.

astyle_x.y_macosx.tar.gz is the Mac OS X version of Artistic Style. It contains the source code, documentation, and a makefile. The Mac OS X Version compile instructions below give information for compiling the source code.

astyle_x_y_openvms.zip is the OpenVMS version of Artistic Style. It contains the source code, documentation, object files, build files, and executables. The OpenVMS Version compile instructions below give information for compiling the source code. Object code is included for people that don't have the Hewlett-Packard C++ compiler.

astyle_x.y_windows.zip is the Windows version of Artistic Style. It contains the source code, documentation, Visual C project files, and an executable. The Windows Version compile instructions below give information for compiling the source code.

Only one platform is supported in each distribution package. If you use Artistic Style on more than one platform you will need to download packages for each platform. The main difference in platforms is the build directories and the line endings. Most compilers and development packages will accept any type of line ending. The source code and documentation are the same for all distributions.

### Linux Version

#### GCC Compiler

To compile using the GCC compiler you must have GCC (3.1 or better) installed. To build the Artistic Style configurations use the makefile located in the astyle/buildgcc directory. The executables will be in the astyle/bin directory. To build the command line configuration enter the following:

     cd astyle/buildgcc
     make

To build the other astyle configurations you can enter the file name or a symbolic name. Entering "make astyle" or "make release" will build the command line configuration. Following are the symbolic names and file names (in parens) of the various configurations:

- release builds the Artistic Style command line program (astyle). This is the default option.
- shared builds the Artistic Style program as a shared library (libastyle.so).
- static builds the Artistic Style program as a static library (libastyle.a).
- debug builds the Artistic Style command line program with debugging information (astyled).
- shareddebug builds the Artistic Style program as a shared library with debugging information (libastyled.so).
- staticdebug builds the Artistic Style program as a static library with debugging information (libastyled.a).
- all builds all of the above configurations.

  The following Java shared library builds are separate from the above. They include the Java Native Interface (JNI) and require that the Java Development Kit (JDK) be installed. The environment variable JAVA_HOME should be defined. It defines the install directory for the JDK. The makefile also has default install directories for Java 5 and 6. If the compile cannot find the file jni.h, either set the variable or change the value in the makefile.

- java builds the Artistic Style program as a shared library which includes the Java Native Interface (libastylej.so).
- javadebug builds the Artistic Style program as a shared library which includes the Java Native Interface and debugging information (libastylejd.so).
- javaall builds all of the above java configurations.

More than one configuration can be built at the same time. For example, to build all of the release configurations enter:

     cd astyle/build
     make release shared static

#### Intel Compiler

To build the Artistic Style configurations use the makefile located in the astyle/buildintel directory. The executables will be in the astyle/bin directory. To build the command line configuration enter the following:

     cd astyle/buildintel
     make

To build the other astyle configurations you can enter the file name or a symbolic name. The configuration names for Intel are the same as for the GCC compiler. More than one configuration can be built at the same time. For example, to build all of the debug configurations enter:

     cd astyle/buildintel
     make debug shareddebug staticdebug

#### Other Makefile Options

The following makefile options are also available for GCC and Intel.

##### clean

Removes the object and executable files for all configurations.

To remove the files for all configurations:

     make clean

##### cleanobj

Removes the object files for all configurations. The executables will not be removed.

To remove only the object files for all configurations:

     make cleanobj

##### install

Installs the executable. The default is /usr/bin. You must have the appropriate permissions to use install.

To install the astyle executable to /usr/bin:

     make install

To install the executable to a different bin directory set a value for the macro $(prefix). For example to install the executable to a users home directory (/home/user/bin):

     make prefix=$HOME install

##### uninstall

Uninstalls the executable. The default is /usr/bin.

You must have the appropriate permissions to use uninstall. To uninstall the astyle executable from /usr/bin:

     make uninstall

To uninstall the executable from a different "bin" directory set a value for the macro $(prefix). For example to uninstall the executable from a users home directory (/home/user/bin):

     make prefix=$HOME uninstall

NOTE: The uninstall option will NOT remove the .astylerc files from the users home directories. The files must be removed individually for each user.

### Mac OS X Version

To build the Artistic Style configurations use the makefile located in the astyle/buildmac directory. The executables will be in the astyle/bin directory. To build the command line configuration enter the following:

     cd astyle/buildmac
     make

To build the other astyle configurations you can enter the file name or a symbolic name. The configurations for Mac are the same as for the Linux GCC compiler. More than one configuration can be built at the same time. For example, to build all of the release configurations enter:

     cd astyle/buildmac
     make release shared static

The Other Makefile Options are the same as for the Linux compilers.

### OpenVMS Version

To build Artistic Style on an OpenVMS system, you will need Hewlett-Packard's C++ compiler installed. To build the code, use the OpenVMS specific build file located in the astyle/build/vms directory. The executables will be in the astyle/bin directory. To build the standalone executable, enter the following:

     set def [.astyle.build.vms]
     @vmsbuild

To run Artistic Style, you should move the standalone executable to an appropriate directory, and create a foreign symbol for it. For example:

     create/dir my_disk:[astyle.exe]
     set def [--.bin]
     copy astyle_main.exe my_disk:[astyle.exe]
     ast*yle :== $my_disk:[astyle.exe]astyle_main.exe

The build command procedure also includes a method to build a sharable image version of the program, which can be linked and called from other executable modules.

Additionally, if you have a Java Development Kit installed, you can build a Java Native Interface version of the program, which can be called from Java code.

To build either of these versions, please see the comments located at the end of the VMSBUILD.COM command procedure.

If you use Artistic Style on ODS-2 disks, you will need to specify a different suffix for file renaming, as the default is .orig, and multi-dot filenames are not supported on ODS-2 disks. Add the --suffix=_orig switch to either the command line or your Artistic Style initialization file.

To set up an initialization file on OpenVMS, create a file and define a logical to point to it. For example:

     create my_disk:[astyle]astyle.ini
     --suffix=_orig
     ^Z
     define artistic_style_options my_disk:[astyle]astyle.ini

### Windows Version

#### Precompiled Executable

In addition to the source files, the Windows version contains an astyle executable (AStyle.exe).

#### Visual C++ Compiler

There is a project file for 3 versions of the Visual C compiler; build/vs2003 (Visual Studio 2003), build/vs2005 (Visual Studio 2005), and build/vs2008 (Visual Studio 2008). Open the AStyle project file in the appropriate AStyle/build directory. Select the Release configuration to compile the command line version. All output files will be in the AStyle/bin directory. The project has the following configurations.

- Release builds the Artistic Style command line program (AStyle.exe).
- Release Static builds the Artistic Style command line program (AStyle.exe). This is the same as the Release build except that it links wth the static run-time library instead of the dll. This build must be used if the program is to execute on a machine that does not have Visual Studio installed.
- Release Dll builds the Artistic Style program as a Dynamic Link Library (AStyle.dll). This will also produce the exports library and the static library for linking the dll.
- Release Lib builds the Artistic Style program as a Static Library (AStyleLib.lib).
- Debug builds the Artistic Style command line program with debugging information (AStyled.exe).
- Debug Dll builds the Artistic Style program as a Dynamic Link Library with debugging information (AStyled.dll). This will also produce the exports library and the static library for linking the dll.
- Debug Lib builds the Artistic Style program as a Static Library with debugging information (AStyleLibd.lib).

  The following Java shared library builds include the Java Native Interface (JNI) and require that the Java Development Kit (JDK) be installed. The Project Properties must have an include path to the JDK include and include\win32 directories. This is set in Project > Properties > C/C++ > General > Additional Include Directories. The default setting is for the JDK to be installed in the default directory, but it may not be the most current release.

- Release Java builds the Artistic Style program as a Dynamic Link Library which includes the Java Native Interface (AStylej.dll).
- Debug Java builds the Artistic Style program as a Dynamic Link Library which includes the Java Native Interface and debugging information (AStylejd.dll).

#### Other Compilers

To use other compilers a project file must be built using the compiler's development environment.

- Create a project using the compiler's development environment
- Add to the project all the .cpp and .h files in the src directory.
- The Compiler Options section discusses the compiler options to use.
- Compile.

### Compiler Options

To compile as a static or shared (dynamic) library define the macro ASTYLE_LIB. To compile a Java shared (dynamic) library define the macro ASTYLE_JNI. Then use the appropriate compiler and linker options to compile the static or shared library.

Artistic Style is a small program and it is best to optimize for speed. The debug configuration is not usually optimized. To optimize for speed in the release configurations use the macro NDEBUG to remove asserts. Use an option that allows inline function expansion. Runtime Type Information (RTTI) is NOT needed. Use whole program optimization if your compiler supports it. There may be other options you can use depending on the compiler.