beautypg.com

How nsdee adds rules to handle deleted headers – HP Integrity NonStop H-Series User Manual

Page 49

background image

NSDEE writes build rules such that the dependency list the compiler generates is piped to grep to
remove system headers (-v -e '$(NSDEE_SYS_INCLUDE_PATH_ESC)') and the source file itself (-v
-e

'Door.cpp'), as that dependency is specified for the .o file at the top of the build rule

("src/Door.o: ../src/Door.cpp").

NSDEE writes build rules such that the dependency list the compiler generates is piped to grep
to remove system headers:

(-e $(NSDEE_RVU)) and the source file itself (-e Door.cpp), as that dependency is specified for
the .o file at the top of the build rule:
(src/Door.o: ../src/Door.cpp).

Following the grep command, the dependency list is then piped to a sed command that converts
full paths generated by the compiler to relative paths, but only if those paths were passed to the
compiler as relative paths. (This is only important if your make program does not support Windows
paths as dependencies.) It's easy to spot relative paths that the compiler has changed to absolute
paths by the presence of "../" or "../.." in the path.

For example, if you were to add this include path to your project settings for a project named Car:

-I../../CarParts/src

The compiler would emit a rule similar to the following for an object file (CarTest.o) that depends
on Door.h in CarParts/src:

CarTest.o:

C:\Examples\MultiProjectCarApp\Car\Debug\src\../../CarParts/src/Door.h

The sed command would convert the path to:

CarTest.o: ../../CarParts/src/Door.h

Whereas if you specified the full path, as in:

-IC:\Examples\MultiProjectCarApp\CarParts\src

the compiler would emit this rule:

CarTest.o: C:\Examples\MultiProjectCarApp\Car\Debug\src\Door.h

and the sed command would not change it.

NOTE:

The make program provided by Msys already provides a make program that handles

Windows paths. Cygwin does not. However, the NSDEE installation media contains a version of
make

you can use with Cygwin that will work with Windows paths.

Finally, in

Example 3 “Sample build rule for Door.o in subdir.mk”

, the remaining output from sed

is written to Debug/src/Door.d, the same directory as Door.o is written to, and the dependency
file path is written to Debug/src/subdir.mk in the form:

CPP_DEPS += \
./src/Door.d

The top-level makefile includes such dependency files using this statement:

-include $(CPP_DEPS)

How NSDEE adds rules to handle deleted headers

By default, NSDEE makes a final adjustment to dependency files after they are generated by the
compiler and piped through grep and sed. These adjustments ensure that removing header files
does not result in build failures.

For example, if CarTest.o has these dependencies:

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

Handling dependencies in managed builds

49

This manual is related to the following products: