beautypg.com

HP Integrity NonStop H-Series User Manual

Page 50

background image

and you remove the file Wheel.h, the next build of CarTest.o will fail because make will be
unable to locate Wheel.h. This is because dependency files are generated after object files are
built.

So NSDEE does a final pass over dependency files to address this issue by adding dummy rules
for header files that resolve to nothing. At the same time, NSDEE cleans up the list of object files.
The result on the above example would look like this:

CarTest.o: ../src/Car.h ../../CarParts/src/Wheel.h ../../CarParts/src/Door.h \ ../../CarParts/src/Window.h
../../CarParts/src/Engine.h
../src/Car.h:
../../CarParts/src/Wheel.h:
../../CarParts/src/Door.h:
../../CarParts/src/Window.h:

../../CarParts/src/Engine.h:

NOTE:

If you invoke make outside of NSDEE, the updates NSDEE makes to dependency files

will not occur. This will not be a problem unless you remove a header file. You can work around
this issue when doing builds outside of NSDEE by invoking make clean and then rebuilding, or
by editing out the dependencies on non-existent headers.

How SQL/MX preprocessor file header dependencies are handled

For SQL/MX preprocessor files (files ending with .ec, .eC, and so on), the SQL/MX preprocessor
generates an initial dependency file that replaces the source file's extension with .dep (to
differentiate SQL/MX header dependencies from C/C++ header dependencies, which are written
to files with the extension, .d). By default, the SQL/MX preprocessor processes only
SQL/MX-specific header files using the .mxh extension, and this is the model that NSDEE supports.

NSDEE directs the SQL/MX preprocessor to write the dependency file to the output directory by
specifying the -V option to the SQL/MX preprocessor invocation. However, the dependency file
generated by the SQL/MX preprocessor is not in a form the make program can parse. To put the
dependency file into a format that make can parse, the build rule pipes the content of the file
through a series of sed commands to change original output that looks something like this (where
testmx.ec

is a source file and testmx.mxh and testmx2.mxh are files included by

testmx.ec

):

C:\Users\doon\workspace\mxprog\src\testmx.ec
testmx.mxh
testmx2.mxh

The series of sed commands then transforms the SQL/MX dependency output to the following
form:

testmx.ec: "testmx.mxh" "testmx2.mxh"

Because the SQL/MX preprocessor does not specify the locations of header files, NSDEE does a
final pass over the dependency file to add paths to the dependencies (via -I directives specified
in the invocation of the compiler).

Example 4 “Sample build rule for testmx.c ”

shows an example of the contents of a subdir.mk

file with a rule for building testmx.c using the source testmx.ec which has dependencies on
SQL/MX header files in mxprog/mxheaders.

50

Concepts

This manual is related to the following products: