Skip to content

Makefile Structure

ramirezfranciscof edited this page Sep 26, 2018 · 9 revisions

(EDIT: better to sumarize this as a section of the code structure...)

This page describes how the compilation instructions for each part of the program are scattered among the different makefiles. In order to ensure consistency, we will organize information in the following way: for each standalone Makefile, there will be a section with a copy of its header-comment and copy of each of the header-comments of the main included Makefile.xxx files. This comments/instructions should be designed so that they make sense both isolated in their respective files and put together here in this page.

We also include a last section with more concise and short instructions on how to do the most simple modifications to this structure.

/Makefile

/lioamber/Makefile

Makefile

# The following makefile coordinates the compilation of the liblio library.
# This is a general purpose makefile, with generic rules that use generic
# variables. Please instead of modifying it directly, customize the process
# through the provided variables in the corresponding extra makefiles:
#
#
# (*) Makefile.depends contains information about which objects should be
#     compiled, how objects depend on one another, and where to look for the 
#     files to be compiled. Check this file when you are adding new objects.
#     This is where the variables OBJECTS and SRCDIRS are filled.
#
# (*) Makefile.options: contains information on the aplication of the
#     different compilation options. Check this file when you are customizing
#     how an object should be compiled.
#     This is where the variables FC, FFLAGS, LC, LIBS, LFLAGS are filled.
#
# (*) Makefile.optchck: script-like section to create and check a log on
#     how the code is being compiled. This allows to keep a record and keep
#     compilations consistent. Should not be modified frequently.

Makefile.depends

# objects that make up liblio. The list "OBJECTS" contains ALL the objects
# to be linked for making the library, including both free subroutines and
# modules (or rather their corresponding '.o' files).
#
# When adding new content, you should:
# 
#  (1) Include in the list OBJECTS the object file to be included.
#
#  (2) Specify the dependencies related to this object, preferably adding
#      it to the list of the objects it depends upon and adding the objects
#      that would depend on it to his own list.
#
#  (3) If your object's code is in a single file, you should be done now.
#      If you have the code split in many files that are included in a main
#      file, you should create a "filename.mk", include it here, and specify
#      there the dependency on all these files (please check the other ".mk"
#      files to see an example of this).
#
# PAY ATTENTION to how the OBJPATH is explicitly set in each case; vpath can't
# be trusted with handling files generated DURING compation.

Makefile.options

# options ("make target opt1=n opt2=m ...") into definitions and flags passed
# to the compiler, libraries included during linking, etc. All customization
# involving options should be included here. The following is the list and
# brief description of currently available options.
#
# cuda : Enables the use of nvidia gpu-boards.
#    0 = GPU disabled.
#    1 = Uses gpu specific kernels.
#    2 = Uses gpu kernels and cublas library.
#    3 = Uses gpu kernels and cublas and magma libraries.
#
# intel : Enables the use of intel compilers.
#    0 = no intel compilers; use gnu fortran compiler and libraries.
#    1 = use the intel compilers instead of the GNU ones.
#    2 = use the intel compilers and the MKL library for lapack.
#
# parallel : Option not enabled yet. Will be reserved for activating the use
# of openmp and mpi.
#
# precision : Increase the precision of some of the internal variables of the
# program.
#    0 = Use lowest real precision whenever possible.
#    1 = Increase precision in ... (TODO).
#
# analytics : Enables profiling or debugging information and flags.
#    0 = No extra information is provided.
#    1 = Profiling information is enabled.
#    2 = Basic debugging information is enabled.
#    3 = Detailed debugging information is enabled.

Makefile.optchck

# The following makefile is a companion to the "Makefile.options": it records
# the options used during the current compilation in two places. The first is
# "Makefile.log", which can be read when recompilation is requested in order
# to check for option consistency. The second is the build_info module of the
# liblio library, where compilation information can be accessed by the code and
# shown in the outputs to facilitate reproducibility of results.

/g2g/Makefile

Summary: How to use the Makefiles

Sources