Table of Contents Previous Chapter Chapter 8: Build Internals

Chapter 8: Build Internals

1. Configuration Files

It is not often necessary to understand the "internals" of EPICS configuration files if you merely want to develop or build EPICS code. However, an understanding is required if you are porting to a new architecture, for example.

This section describes the files contained within $EPICS/config, with the exception of the "SITE" configuration files that were described earlier in Chapter 3 Section 3 "Config Sub-Tree" on page 12.

The low-level extension and base Makefiles directly include what are called the "EPICS top-level include files." They define the directories that make will traverse through when base and extensions are being built. Targets are built in the order that they appear in the DIRS variables.

CONFIG_EXTENSIONS and CONFIG_BASE both include the CONFIG include file which in turn includes the following files (in this order):

The CONFIG file may be edited either by individual developers or the EPICS system manager. It provides a centralized, convenient place to override configuration variables.

The BUILD_TYPE variable is set to either "Vx" or "Unix," depending on the architecture being built. Sun workstations (sun4) have a BUILD_TYPE of "Unix", whereas the mv167 has a build type of "Vx". The ARCH_CLASS variable provides a logical way of organizing compiler flags that are reused by different architectures. For instance, mv167, hkv2f, and mv147 targets share much of the same configuration. Once defined in CONFIG_ARCH.*, BUILD_TYPE and ARCH_CLASS are used to control what files are subsequently included in CONFIG.

The CONFIG.*.* files contain definitions that are shared by every architecture in a specific architecture class. It creates the compile and link lines based on variable settings in CONFIG_SITE and variable overrides in CONFIG.

A RULES.* file is included near the bottom of every low-level Makefile. RULES.* files contain default rules that simplify dependency definitions. Rules are provided for building objects, installing objects, and generating source files with lex and yacc.

RULES.Vx and RULES.Unix in turn include the .DEPENDS file in the O.ARCH directories. .DEPENDS consists of automatically generated header file dependencies that are created when "gmake depends" is invoked. When the O.ARCH directories are first created, an empty .DEPENDS file is created so that initially make will work. It is the responsibility of the EPICS developer to manually run "gmake depends".

2. Adding a New Architecture

To add support for an architecture in the EPICS build, follow these steps: ($ARCH is the architecture being added):

  1. Create CONFIG_ARCH.$ARCH. Set BUILD_TYPE, ARCH_CLASS, and the architecture
    1. Set BUILD_TYPE. If this is an IOC architecture, set to Vx. If this is a host architecture, set this to Unix.
    2. Set ARCH_CLASS. If this architecture is 680X0 based, set to 68k. If it is a host architecture, set this variable to $ARCH.
    3. Set architecture dependent variables:
              #  Architecture dependent C flags.
              ARCH_DEP_CFLAGS=
              #  Architecture dependent C++ flags.  Probably doesn't make sense.
              ARCH_DEP_CCFLAGS=
              #  Architecture dependent LD flags.
              ARCH_DEP_LDFLAGS=
              #  Architecture dependent libraries.  These include
              $  compatibility libraries, for example.
              ARCH_DEP_LDLIBS=
      
  2. Create CONFIG.$BUILD_TYPE.$ARCH_CLASS if it doesn't already exist.
    1. Copy either CONFIG.Unix.sun4 or CONFIG.Vx.68k as a beginning.
    2. Add support for local compilers. Add choices for both ANSI C and standard compilers specific to that platform. In addition, GNU CC should always be supported in addition to the vendor supplied compilers. For instance, sun4 host architectures have the following choices for ANSI compilation:
      • ACC - Sun's unbundled compiler product (acc).
      • GCC - GNU CC (gcc -traditional).
        And the following choices for standard C compilation:
      • SUNCC - Sun's traditional compiler (cc).
      • ACC - Sun's unbundled compiler product (acc -Xs).
      • GCC - GNU CC (gcc -ansi).
        (Note: These Compiler choices are provided to the local system manager in the CONFIG_SITE file).
    3. Add support for warning generation, dependency generation, and static build flags. To properly generate these header file dependencies, a macro must be added to the file CONFIG.<BUILD_TYPE>.<ARCH> for DEPENDS_RULE.c (C sources) and DEPENDS_RULE.cc (c++ sources). For example the file CONFIG.Vx.68k contains the statements:
              DEPENDS_RULE.c = -$(COMPILE.c) -M $(SRCS.c) >> .DEPENDS
              DEPENDS_RULE.cc = @echo no DEPENDS_RULE.cc defined in CONFIG.Vx.68k
      
      Note that a double arrow is used to direct output to .DEPENDS
    4. If this is a UNIX build type add support for the compilation types (OLD, ANSI, and STRICT).
  3. Create CONFIG_SITE.$BUILD_TYPE.$ARCH_CLASS if it doesn't already exist. Copying either CONFIG_SITE.Unix.sun4 or CONFIG_SITE.Vx.68k is probably sufficient.
 
Table of Contents Next Chapter