Artistic Style Install Information

 

Contents

Artistic Style Versions

Linux Version

GCC Compiler

Clang Compiler

Intel Compiler

Other Makefile Targets

Mac OS Version

Xcode

Makefile

Windows Version

Precompiled Executable

Visual C++ Compiler

Other Compilers

Compiler Options

Artistic Style Versions

astyle_x.x_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.x_macos.tar.gz is the Mac OS version of Artistic Style. It contains the source code, documentation, Xcode project files, and a makefile. The Mac OS Version compile instructions below give information for compiling the source code.

astyle_x.x_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.

The build has no autoconf dependency. To build the Artistic Style configurations, use the makefile located in the astyle/build/gcc directory. The executables will be in the astyle/build/gcc/bin directory. To build the command line configuration, enter the following:

cd astyle/build/gcc
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:

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

cd astyle/build/gcc
make release shared static

The Other Makefile Targets section contains additional target options.

Clang Compiler

Clang has a static analyzer that finds potential bugs in C/C++ and Objective-C programs. It can be run as a standalone tool from the command-line, and runs in tandem with a build. There is a script file, analyze.sh, that will run the analysis on Artistic Style.

The build has no autoconf dependency. To build the Artistic Style configurations use the makefile located in the astyle/build/clang directory. The executables will be in the astyle/build/clang/bin directory. To build the command line configuration, enter the following:

cd astyle/build/clang
make

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

cd astyle/build/clang
make release shared static

The Other Makefile Targets section contains additional target options.

Intel Compiler

These procedures and the makefile are for recent versions of the compiler. They may not work for earlier versions. Instructions for your compiler are in the compiler documentation file "get_started_lc.htm".

To compile the source there are environment variables that must be set by running the compiler environment script compilervars.sh (or compilervars.csh) with an argument that specifies the target architecture. If this has not been done already enter: "source  <install-dir>/bin/compilervars.sh <arg>", where <install-dir> is the directory where the compiler is installed and <arg> is ia32 or intel64. If this is not done "make" will display an error message "*** The compiler environment variables are not set." On an Intel x64 platform installed in the default directory the instruction would be

source /opt/intel/bin/compilervars.sh intel64

The build has no autoconf dependency. To build the Artistic Style configurations use the makefile located in the astyle/build/intel directory. The output executables will be in the astyle/build/intel/bin directory. To build the command line configuration, enter the following:

cd astyle/build/intel
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 the entire debug configurations enter:

cd astyle/build/intel
make debug shareddebug staticdebug

The Other Makefile Targets section contains additional target options.

Other Makefile Targets

The following makefile targets are available for GCC, Clang, Intel, and Mac.

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 astyle executable and documentation files. The default is /usr/bin for the executable and /usr/share/doc/astyle for the documentation. You must have the appropriate permissions to use install.

To install the astyle to the default directories:

sudo make install

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

sudo make prefix=$HOME install
uninstall

Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall.

To uninstall astyle from the default directories:

sudo make uninstall

To uninstall the files from a different directory set a value for the macro $(prefix). For example, to uninstall the files from a user's home directory (/home/user):

 sudo 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 Version

Xcode

Artistic Style workspace and project files for the Xcode development environment are available in the "build/xcode" directory. A workspace can be used to build a single project or all the projects. The project files have Debug and Release configurations. The following projects are available.

install

Only the astyle executable is installed. The library project installs are sent to UninstalledProjects in the Build directory. The following instructions are for the astyle executable and documentation files. The default install directory is /usr/bin for the executable and /usr/share/doc/astyle for the documentation. You must have the appropriate permissions to use install. If sudo is not used for the install, an error will occur during the build.

To install the astyle executable in the default directory:

cd astyle/build/xcode
sudo xcodebuild install -project AStyle.xcodeproj

A script is used to install the documentation from the same directory.

sudo bash install.sh
uninstall

Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall.

A script is used to uninstall astyle and the documentation:

sudo bash uninstall.sh

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

Makefile

The Artistic Style makefile compile uses the Mac OS "Command Line Tools". If you have Xcode 4.3 or newer the command line tools, such as "make", are NOT installed by default. They must be downloaded and installed separately. Once everything is successfully installed, you should see "make" and other command line developer tools in /usr/bin.

The build has no autoconf dependency. To build the Artistic Style configurations use the makefile located in the astyle/build/mac directory. The executables will be in the astyle/build/mac/bin directory. To build the command line configuration, enter the following:

cd astyle/build/mac
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 the release configurations enter:

cd astyle/build/mac
make release shared static

The Other Makefile Targets section contains additional target options.

Windows Version

Precompiled Executable

In addition to the source files, the Windows distribution package contains an Artistic Style Win32 executable (AStyle.exe). If you prefer to compile the executable yourself, pursue the following instructions.

Visual C++ Compiler

There are solution and project files for several versions of the Visual C compiler. Open an Artistic Style solution file in the appropriate "build" directory. All projects have Debug, Release and Static configurations. Debug file output will be in the "debug" directory. Release file output will be in the "bin" directory. Static file output will be in the "binstatic" directory. The following solution files are available.

Other Compilers

To use other compilers a project file must be built using a development environment.

Compiler Options

No macro definitions are required to compile the executable. 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. The option ASTYLE_NO_EXPORTS is sometimes needed for static libraries to prevent compiler error and warning messages. Use the appropriate compiler and linker options to compile the static or shared library. Add debug options to compile the debug versions.

Artistic Style is a small program and it is best to optimize for speed. The debug configurations are not usually optimized. To optimize for speed in the release configurations, use the macro NDEBUG to remove asserts. If necessary, use an option to activate the C++11 standards (--std=c++0x on GCC and MinGW). Use an option that allows inline function expansion. Runtime Type Information (RTTI) is NOT needed. Exceptions are NOT used. Use whole program optimization if your compiler supports it. There may be other options you can use depending on the compiler.