CAPD RedHom Library
How to add new files and directories to CAPD

When adding new files or directories to automated build system it is very important to modify only configure.ac and Makefile.am files. After each modification we need to generate new configure scripts and Makefile.in by

autoreconf -i

and then new Makefiles using

./configure [parameters]

A list of last used parameters can be obtained by running

./config.status --config

New header files

After adding new header file to some subfolder of include directory one needs to add its name to the list of files in the file include/Makefile.am of corresponding package. Without this header file will not be copied during installation.

File Makefile.am containing list of all header files in the package capdXXX can be created using script listHeaderFiles.sh. It needs to be called from the include directory.

cd capdXXX/include
../../capdMake/utils/listHeaderFiles.sh > Makefile.am

To correct lists of header files in all packages use

cd capdMake/utils
./generateMakefiles.sh

It generates new Makefile.am only if there are some changes.

New source files

To add new source file to the existing folder in

  • src directory
    to add source.cpp to folder src/capd/moduleName one needs to add in src/capd/moduleName/Makefile.am the name source.cpp to the list of files stored in variable libmoduleName_a_SOURCES
  • examples, programs and test directory
    assume that executable XXXX will be created from source files XXXX.cpp and ZZZZ.cpp and will be linked with module or package YYYY (e.g. YYYY=capdintervals or YYYY=capdDynSys).
    • Add the following to the file Makefile.am:
      XXXX_SOURCES=XXXX.cpp ZZZZ.cpp
      XXXX_libs=${YYYY_LIBS}
      XXXX_LDADD=${XXXX_libs}
      XXXX_DEPENDENCIES=${XXXX_libs:-%=}
      XXXX_CXXFLAGS=${YYYY_CFLAGS}
    • Add XXXX to the list
      • noinst_PROGRAMS in case of examples directory, (they will be compiled by calling make for library)
      • bin_PROGRAMS in case of programs directory, (they will be compiled by make and installed to bin directory by make install)
      • check_PROGRAMS in case of tests directory (they are compiled and executed by make check).

New module

Assume we want to add new module XXXX to package YYYY:

  • create directories YYYY/src/capd/XXXX and YYYY/src/capd/XXXX
  • in the directory YYYY/src/capd/XXXX create (or copy from other module)
    • Makefile.am
    • capdXXXX-dev.pc.in - description of module for pkg-config (dependencies, compilation flags, directories) for developer version of library
    • capdXXXX-install.pc.in - description of module for pkg-config for version of library that will be installed.
  • to YYYY/src/capd/Makefile.am add XXXX to SUBDIRS list
    SUBDIRS = modul1 modul2 XXXX
  • to YYYY/configure.ac add
    AC_CONFIG_FILES([src/capd/XXXX/Makefile])
    AC_SUBST(capdXXXX_CFLAGS, ["compilation flags for XXXX module"])
    AC_SUBST(capdXXXX_LIBS)
    AC_CONFIG_FILES([${top_capd_build}/lib/pkgconfig-dev/capdXXXX.pc:src/capd/XXXX/capdXXXX-dev.pc.in])
    AC_CONFIG_FILES([src/capd/XXXX/capdXXXX.pc:src/capd/XXXX/capdXXXX-install.pc.in])