Handling dependencies in managed builds, How managed makefiles create dependency files, Layout of simple project – HP Integrity NonStop J-Series User Manual
Page 52

This table lists the three automatically-generated makefiles that are written to the top-level build
directory:
Purpose
Makefile
The primary makefile for a build configuration. It contains the build rules for "all", "clean",
and "deploy".
makefile
Contains definitions of USER_OBJS and LIBS, two build macros that are set to
out-of-project object files and libraries, respectively, that are passed to the linker for the
final link step.
objects.mk
Defines a list of source macros, such as C_SRCS, and all of the subdirectories that
contribute source code to the build.
sources.mk
NSDEE also creates a makefile for each source directory containing sources to be built. The source
directory names and hierarchy are mirrored under a Debug or Release folder (depending on the
build configuration). For each such mirrored directory, NSDEE creates a subdir.mk file which
contains the rules for building the sources in the containing directory. Mirrored directories also
contain the build output of source built from the original source directory.
shows
the layout of a simple project with one source directory named src and one top-level build directory
named Debug.
Figure 8 Layout of simple project
Handling dependencies in managed builds
To ensure C and C++ objects are rebuilt when dependent header files are changed, NSDEE adds
build-rules commands to generate dependency files.
How managed makefiles create dependency files
For C and C++, NSDEE-generated makefiles generate header file dependencies for objects by
re-running the compiler invocation with the addition of the -WM option (so the compiler lists
dependencies). The second compiler invocation is part of the same build rule that builds the object
file. This ensures that every time a particular object file is built, the header file dependencies for
that file are regenerated.
Example 3 “Sample build rule for Door.o in subdir.mk”
shows an example of a build rule for an
object file named Door.o in a subdir.mk file for a project named CarParts.
52
Concepts