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_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_x_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.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.
To compile using the GCC compiler you must have GCC (3.1 or better) installed. There is 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:
The following Java shared library builds are separate from the above. They include a 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.
More than one configuration can be built at the same time. For example, to build all of the release configurations enter:
cd astyle/build/gcc
make release shared static
There is no autoconf dependency. To use the Intel makefile the files icc and icpc should be copied to /usr/sbin. If the compiler release is 11.1 or higher the file iccvars.sh should also be copied to /usr/sbin. These files are located in the installed directories of the compiler.
Beginning with compiler release 11.1 there are environment variables that should be set before the make. To set the variables enter "source iccvars.sh arg" where arg is ia32, intel64, or ia64. If this is not done the make will display an error message "*** No rule to make target `obj/astyle_main.o', needed by `astyle'." Instructions for the options are in the compiler documentation file "getting_started_c.pdf" in the section "Starting the Compiler from the Command Line". To build the Artistic Style configurations use the makefile located in the astyle/build/intel directory. The 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 all of the debug configurations enter:
cd astyle/build/intel
make debug shareddebug staticdebug
The following makefile options are available for GCC, Intel, and Mac. With Intel use the script file make.sh.
Removes the object and executable files for all configurations.
To remove the files for all configurations:
make clean
Removes the object files for all configurations. The executables will not be removed.
To remove only the object files for all configurations:
make cleanobj
Installs the executable and documentation files. The default is /usr/bin for the executable and /usr/share/astyle for the documentation. You must have the appropriate permissions to use install.
To install the astyle to the default directories:
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):
make prefix=$HOME install
Uninstalls the executable and documentation. You must have the appropriate permissions to use uninstall.
To uninstall astyle from the default directories:
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):
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.
There is 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:
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 of the release configurations enter:
cd astyle/build/mac
make release shared static
The Other Makefile Options are the same as for the Linux compilers.
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
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 follow the following instructions.
There are configuration and project files for 4 versions of the Visual C compiler; build/vs2005 (Visual Studio 2005), build/vs2008 (Visual Studio 2008) and build/vs2010 (Visual Studio 2010). Open the AStyle configuration file in the appropriate "build" directory. All project files have Release and Debug configurations. Release file output will be in the "bin" directory. Debug file output will be in the "debug" directory. The following solution files are available.
To use other compilers a project file must be built using a development environment.
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. Then 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. 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.