A pragma addendum file is a simple text file that lets you easily add pragmas (using
#pragma ) to a build without modifying makefiles or other files, such as when you do not “own” those files. A pragma addendum file uses a subset of make syntax to declare pragmas on targets within the build. This syntax lets you use existing makefiles or other files unmodified while avoiding inconvenient makefile syntax such as tabs versus spaces, dollar-sign escapes, and eval.
The pragma addendum file format is similar to the make format. You must specify the pragmas and then the target to which they apply. All text content is treated as literal strings.
Using pragmas for builds with the eMake Ninja emulation mode enabled (
--emake-emulation=ninja ) requires a pragma addendum file. Pragma addendum files are optional with any other emulation mode.
emake allows only comments,
#pragmadeclarations, and target names to the left of colons. Commands and prereqs are not allowed.
You cannot use make-instance-level pragmas such as
#pragma jobcache parse.
You cannot use variables. Instead, you must use path names that are absolute or relative to the current working directory (instead of using
The supported pragmas are:
Enables the JobCache feature, which can substantially reduce compilation time.
Disables the eDepend (autodep) feature. For details, see CloudBees Accelerator eDepend.
Enables directory-read conflicts on a per-job basis. You can apply it to targets or rules. This pragma incurs less overhead than the
Runs jobs locally on the host build machine instead of on an Agent in the cluster. For details, see Running a Local Job on the Make Machine.
runlocal -repopulate <dir1> [… -repopulate <dirN> ]
Tells eMake where to find files created by jobs instead of looking in the current working directory by default. For details, see Running a Local Job on the Make Machine.
Causes all jobs after a certain point in the build to run locally. For details, see Running a Local Job on the Make Machine.
You can include gmake-style patterns in target names in the pragma addendum file so that you do not need to specify explicit target names. This includes “match anything” patterns such as
For example, to match all
.o files, use:
#pragma jobcache gcc %.o:
Also for example, to match everything, use:
#pragma noautodep ./out/build_number.txt %:
Only the first
% in the target name is treated as a wildcard. This means that you cannot specify a literal
% in target names (in other words, you cannot escape the
% so that it is not treated as a wildcard in this context).
Following is an example pragma addendum file:
# system.img targets are runlocal because they do lots of I/O. # #pragma runlocal out/target/product/generic/system.img: #pragma runlocal out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img: #pragma jobcache javadoc out/target/common/docs/api-stubs-timestamp:
Following is an example pragma addendum file for Android 7.0.0:
#pragma runlocal out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img: #pragma runlocal out/target/product/generic/system.img: #pragma jobcache kati out/build-aosp_arm.ninja: #pragma noautodep ./out/build_number.txt out/target/common/docs/api-stubs-timestamp: #pragma noautodep ./out/build_number.txt out/target/common/docs/system-api-stubs-timestamp: #pragma noautodep ./out/build_number.txt out/target/common/docs/test-api-stubs-timestamp: #pragma noautodep ./out/build_number.txt out/target/product/generic/obj/ETC/system_build_prop_intermediates/build.prop: #pragma noautodep ./out/build_number.txt out/target/common/docs/apache-http-stubs-gen-timestamp: #pragma noautodep ./out/build_number.txt out/host/common/obj/JAVA_LIBRARIES/cts-tradefed_intermediates/com/android/compatibility/SuiteInfo.java:
This example sets the
runlocal pragma on
system.img This pragma lets you avoid the heavy I/O required to run it on the remote Agent. The
jobcache pragma enables kati job caching for
noautodep pragmas prevent unnecessary rebuilds just because the build number changed.