PSCF v1.1
Out-of-Source and In-Source Builds

Setup Script (Prev)         Optional Features (Next)

Intermediate Files and Build Directories

All C++ and CUDA header and source files for PSCF are contained in within the pscfpp/src/ directory tree. When the PSCF build system is used to compile a program or set of programs, it generates a large number of intermediate files that are used to construct the executable files, and that left in place after the executable files have been installed in their final locations. These intermediate files are placed in a directory that we will refer as the "build" directory. The build directory used by PSCF may either be the same as the src/ directory, if the package is built "in-source", or the build directory may be a separate directory, if PSCF is built "out-of-source"

The types of intermediate files that are created when any part of PSCF is compiled include:

  • An object file with a file extension *.o that is associated with each compilable source file. Source files are files with filename extension *.cpp for C++ files or *.cu for files that contain CUDA code. Each such object file is created by compiling the associated source file, and has the same base name as the corresponding source file.
  • A dependency file with file extension *.d that is associated with each source file. This file is created by the build system by analyzing which header (*.h and *.tpp) files are included directly or indirectly into that source file.
  • Static library files with extension *.a. Each such library file contains all of the object code generated by compiling the source files in a single subdirectory of pscfpp/src.

When PSCF is built "in-source", each *.o and *.d file that is created by compiling a source file (extension *.cpp or *.cu) is placed in the same directory as the corresponding source file. When PSCF is built "out-of-source", these *.o and *.d intermediate files are instead placed in an equivalent location in a separate build directory tree with the same directory structure. By default, the directory pscfpp/bld is used as the build directory tree for out-of-source builds.

We refer to the two directories src/ and bld/ in what follows as standard build directories. The bld/ directory has a directory structure analogous to that of the src/ directory. Both src/ and bld/ contain a set of subdirectories named util/, pscf/, fd1d/, pspc/, and pspg/, which we refer to in what follows as namespace level directories.

By default, all executable program files are installed in the pscfpp/bin directory. This is true for both in-source or out-of-source compilation.

Out-of-Source Builds

We recommend that most users of PSCF who are not working on modifying or extending the code build the package out-of source. The overview of instructions given in a previous page gives instructions for an out-of-source build. An out-of-source build will be performed if "make all" is entered either from within either the root pscfpp/ directory (as recommended in those instructions) or from within the pscfpp/bld directory.

In-Source Builds

Users who are actively working on development or modification of the PSCF source code may find it more convenient to build PSCF in-source during development. To build PSCF in-source, one simply invokes the make utility from within the pscfpp/src/ directory, rather than from within the pscfpp/ or pscfpp/bld/ directory. The names of the makefile targets used for this purpose are the same as those used to build out-of-source. Entering the command "make all" from the pscfpp/src directory will thus perform an in-source build all of relevant programs in the package, and install the resulting executable files in pscfpp/bin.

When PSCF is compiled in-source, the make command can also be invoked from any subdirectory of the src/ directory. Invoking "make all" from any subdirectory of src/ will generally compile all recently modified files in that subdirectory and its subdirectories, without attempting to compile any files outside that subdirectory, and without recompiling files that have not been touched since they were last compiled. This usage is discussed in more detail here.


Setup Script (Prev)         Installation (Up)         Optional Features (Next)