|
|
|
|
|
*_The skinny on building Cloudy with make*_
|
|
|
*The skinny on building Cloudy with make*
|
|
|
If you are using g++ on Linux, a Mac, or Cygwin then building the code is trivial since everything is
|
|
|
already set up.
|
|
|
Open a command prompt window, cd into the source directory, and type _make_.
|
... | ... | @@ -8,7 +8,7 @@ _make -j <n>_ to do a parallel build, where <n> is the number of cores you want |
|
|
|
|
|
*This rest of this page* outlines how to use the makefile for Cloudy that is supplied in the
|
|
|
source directory. It requires GNU _make_ (which may be called _gmake_ on your system) and is set up for g++, but will also
|
|
|
work for other compilers. It is based on experiences of Peter van Hoof and
|
|
|
work for other compilers. It is based on the experiences of Peter van Hoof and
|
|
|
Robin Williams in building the code.
|
|
|
|
|
|
|
... | ... | @@ -19,7 +19,7 @@ Robin Williams in building the code. |
|
|
|
|
|
Before you compile Cloudy, first you need to decide which compiler you want
|
|
|
to use. The Makefile in the source directory has been set up for an optimized
|
|
|
compilation with g++. For most platforms this is the best choice, provided you
|
|
|
compilation with g++. For most platforms, this is the best choice, provided you
|
|
|
have a working version of the compiler (see the CompileCode page for more details
|
|
|
on this point). You may however choose to use another compiler and/or different
|
|
|
compiler options. The easiest way to do this is to use (and possibly edit)
|
... | ... | @@ -29,23 +29,23 @@ versions of Cloudy are further down). They are located in |
|
|
directories called sys_xxx under the source directory. Here "xxx" is the name
|
|
|
of your compiler, e.g. sys_icc.
|
|
|
|
|
|
You can now do two things. You can change directory into the sys_xxx directory
|
|
|
You can now do two things. You can change the directory into the sys_xxx directory
|
|
|
and type make there, or you can copy the Makefile.conf file into the source
|
|
|
directory and run make there. Both methods are completely equivalent (except that
|
|
|
the resulting object files and binary are in a different place of course), and it is
|
|
|
up to you which one you prefer. However, note that some older debuggers require the
|
|
|
source and object files to be in the same directory.
|
|
|
|
|
|
If you want to use different compiler options, or a compiler that is not covered
|
|
|
If you want to use different compiler options or a compiler that is not covered
|
|
|
by us, an existing Makefile.conf file can be altered for other compilers or compiler
|
|
|
options by editing the CXX, CXXFLAGS, LDFLAGS, and LDLIBS fields in the file.
|
|
|
Users of releases before C08 should edit the
|
|
|
Makefile itself and alter the CXX, CXXFLAGS, LDFLAGS, and LDLIBS fields in that file,
|
|
|
but otherwise the instructions below apply to them as well.
|
|
|
Alternatively you can set environment variables with the same name in your
|
|
|
but otherwise, the instructions below apply to them as well.
|
|
|
Alternatively, you can set environment variables with the same name in your
|
|
|
shell, these will override the default settings in the makefile if you replace
|
|
|
_make_ with _make -e_ everywhere below. How to set variables depends on the
|
|
|
shell you are using. Here is an example for some commonly used shells:
|
|
|
shell you are using. Here is an example of some commonly used shells:
|
|
|
|
|
|
csh/tcsh:
|
|
|
''setenv CXX pgCC''
|
... | ... | @@ -67,7 +67,7 @@ simply typing: |
|
|
|
|
|
''make OPT=-O0''
|
|
|
|
|
|
Alternatively you can achieve the same thing by typing (only for releases after C08):
|
|
|
Alternatively, you can achieve the same thing by typing (only for releases after C08):
|
|
|
|
|
|
''make debug''
|
|
|
|
... | ... | @@ -81,7 +81,7 @@ The makefile will automatically set the path to the data files for you, so the s |
|
|
|
|
|
''export CLOUDY_DATA_PATH="/path/to/cloudy/data"''
|
|
|
|
|
|
In case you don't do this, the makefile will assume a standard directory layout and assume that the data reside in "/path/to/cloudy/source/../data/". For most people this default will be fine.
|
|
|
In case you don't do this, the makefile will assume a standard directory layout and assume that the data reside in "/path/to/cloudy/source/../data/". For most people, this default will be fine.
|
|
|
|
|
|
Starting with C08, you can supply multiple directories on the search path,
|
|
|
separated by colons (semicolons for Windows users). This is convenient for storing locally produced data files, such as grain opacity and stellar atmosphere files. This described in detail on the EditPath page.
|
... | ... | @@ -123,7 +123,7 @@ where <n> is the number of cores you want to use. |
|
|
|
|
|
### Setting macros
|
|
|
|
|
|
If you build in source you can edit `Makefile` and add macros to the end of this line:
|
|
|
If you build in the source you can edit `Makefile` and add macros to the end of this line:
|
|
|
```
|
|
|
OPT = -O3 -ftrapping-math -fno-math-errno -DMACRO
|
|
|
```
|
... | ... | @@ -141,7 +141,7 @@ make -j <n> EXTRA=-DMACRO |
|
|
In order for _make_ to work correctly, it needs to know how each of the source files
|
|
|
depends on the various header files. In versions C10 and older this is defined in the file Makefile.dep.
|
|
|
When you have downloaded a fresh version of Cloudy, this file will not be present.
|
|
|
The first time you execute the _make_ command, the compiler will automatically
|
|
|
The first time you execute the *make* command, the compiler will automatically
|
|
|
create the Makefile.dep file for you. It will use the g++ compiler to do this,
|
|
|
irrespective of the compiler you chose to create the Cloudy binary. This is because
|
|
|
the compiler you chose may not be able to do this.
|
... | ... | @@ -150,7 +150,7 @@ If you modify Cloudy and add new source files, or add new #include statements in |
|
|
|
|
|
''make depend''
|
|
|
|
|
|
Starting with C13, the dependencies are no longer kept in a single dependencies file, but are distributed over many small files ending in ".d". These are kept up to date automatically every time you invoke make. Hence there should never be a need anymore to type _make depend_, though the command is still recognized. In C13 and later the dependencies can be built in parallel.
|
|
|
Starting with C13, the dependencies are no longer kept in a single dependencies file, but are distributed over many small files ending in ".d". These are kept up to date automatically every time you invoke make. Hence there should never be a need anymore to type `make depend`, though the command is still recognized. In C13 and later the dependencies can be built in parallel.
|
|
|
|
|
|
|
|
|
## Building the Data
|
... | ... | |