Ninja doesn't need the phony make targets, in fact, the parser doesn't
handle them correctly and ends up duplicating the dependencies. This
shrinks a `m native` deps file from 54M -> 35M on AOSP.
Test: Compare out/build-aosp_angler.ninja before/after
Test: wrote a tool to dump the .ninja_deps, added dedup feature, files
identical after dedup.
Change-Id: Iec7a9a0739e8678c1f4db79c68e423a39b9aad4b
There are some source files in our tree that use some text processing to
find source files, and end up with source file names that look like:
/../../dir/file.c
This isn't fixed by our dotdot workarounds because the filename doesn't
start with '../', so strip the initial '/' from any source files, since
they are all relative to $(LOCAL_PATH) anyways.
Bug: 32514380
Test: Build internal source with this problem
Test: Compare build-aosp_angler.ninja before/after
Change-Id: If869419c3d3ba35d55f6e19d9332515695e47d24
Host builds were compiling without -Wl,--no-undefined because of an ASAN
issue. Pass -Wl,--no-undefined for host builds unless sanitzers are
enabled. Also fix LOCAL_ALLOW_UNDEFINED_SYMBOLS on darwin, where
disallowing undefined symbols is the default.
Test: m -j host
Test: m -j SANITIZE_HOST=address host
Bug: 32305815
Change-Id: I0344c321610c55eb8b2092b01e50e4a93a0e85df
Change COVERAGE_PATHS to access a comma-separated list of paths
instead of a space-separated list to make for easier escaping in
configuration files.
Test: tested using local bullhead build with coverage on lights and nfc
Change-Id: Iec014c8b4fbefcbcc5d865e6acba92bf6364ee3a
Fix a whitespace bug causing coverage to be enabled on all modules
whenever more than one module is specified. This is caused by
comparing whitespace to the empty string, which are not equal. Fix
by stripping the output to check for path matches.
Test: tested using local build with coverage enabled on NFC, lights
Change-Id: I61a775cfd135f94ea1e1ee9fdbed3c64c5bb1a2e
* Add -Werror if LOCAL_PATH is in the WARNING_DISALLOWED project list,
or not in the WARNING_ALLOWED project list.
Test: Build for major targets.
Change-Id: I12235ee1ca1c1837530693699e705e1955275565
The toc optimization had been disabled for host builds to ensure that
the timestamp of the final binary changed whenever its implementation
changed, in order to support rerunning host tools that were modified
during incremental builds. However, only the final install rule must be
re-run to update the timestamp, and not the link rule.
Update the shared library install dependencies to use normal
dependencies instead of order-only dependencies for host modules, and
then enable the the toc optimization for host modules. If the
implementation of a library changes it will be reinstalled, and
libraries or binaries that depend on it will also be reinstalled.
Bug: 26015464
Test: m -j; touch art/disassembler/disassembler_x86.cc; m -j, verify
out/host/linux-x86/bin/oatdump is updated
Change-Id: I0a14decc1994eb55ad269d841943aef66e320c63
$(shell) isn't particularly fast in Kati, and they have to be executed
both when reading the makefiles and determining whether the ninja file
needs to be regenerated.
Right now, the regen time is mostly hidden because we run them in
parallel. We've also configured it to ignore any commands that contain
"echo", "date", or the output directory. That happens to remove most
commands that contain side effects, so running them in parallel is fine.
But the side effects contain some important things, like the clean up
necessary when switching products. So I'm removing those filters, and
then we'll need to run the shell commands in sequence, since there will
be side-effects. That makes regen take longer though, so use pure-Make
implementations instead of $(shell) where possible.
This set of changes reduces aosp/master aosp_arm64-eng build $(shell)
usage and time by 2/3:
*kati*: func shell time: 3.135095 / 709
*kati*: func shell time: 1.067331 / 236
Bug: 30947985
Test: Manual test lines for math functions
Test: Compare build-aosp_arm64.ninja before/after
Change-Id: I4fc9d6318957992921972994f277c17918e7e1eb
This shouldn't be necessary for most makefiles, since we add
$(LOCAL_GENERATED_SOURCES) to this already included, but for prebuilts
that aren't actually prebuilts (Soong modules), we need to pass
dependencies so that the generated headers are built before being used.
Bug: 31742855
Test: Use, inspect build-*.ninja
Change-Id: I8d9f675af639d3f40780d48a016fc079a82531c2
This was printing "error:", but not actually triggering an error.
Instead of trying to write a single line bash script to handle this,
move the actual check into python. This allows us to print all of the
errors for a single module before triggering the failure.
Also updates the warning format and the warn.py script to properly parse
these warning. Many of the java:sdk -> java:platform warnings are false
positives due to the lack of LOCAL_SDK_VERSION markings on prebuilts.
Individual tags can be marked as warnings now, which lets us check for
system libraries linking against vendor libraries (which won't work on
AOSP). I'm not sure this is a completely valid check, which one reason
that it's just a warning.
Test: m all_link_types (with some missing libs commented out)
Change-Id: I333e418c9a4511b7c7e826891ae481da08fbf6f9
We want to build things in CTS (things built against the NDK) with
integer overflow checks. Some projects in the tree also make explicit
calls to the overflow checked builtins, and those projects need to be
built with the NDK (external/dng_sdk is the specific example that
brought this up).
Test: make checkbuild tests
Bug: None
Change-Id: Iab27dd0d931f723140de242049fa72f3b1ce0fb8
BUILD_HOST_static has been broken because I was stripping
-Wl,--start-group/-Wl,--end-group into a separate set of ldflags instead
of keeping them wrapped around some of the ldlibs. So don't pass some of
the build system flags through the ldlibs checker.
Bug: 30898128
Change-Id: I332b42679695cdc5da3cb0036290b6a3544699c0
Native coverage is enabled by setting NATIVE_COVERAGE to true
and specifying a list of paths in the COVERAGE_PATHS
environment variable. Files are exported to a zip file in the
target out directory.
Change-Id: I66a2ddd88e849bec1cc0cdae1b51fe18a007e2c3
Let clang-tidy report warnings in header files in the
system and current directories but not the external
and vendor directories.
Test: build with WITH_TIDY=1
Change-Id: I1723b8eb95948961fb7164a19989e0a926e5bf8a
The output will be in the `m dist` results as soong_to_convert.txt, or
can be built using:
$ m $OUT/soong_to_convert.txt
The output is a list of modules that are probably ready to convert to
Soong:
# Blocked on Module (potential problems)
283 libEGL (srcs_dotarm)
246 libicuuc (dotdot_incs dotdot_srcs)
221 libspeexresampler
215 libcamera_metadata
...
0 zram-perf (dotdot_incs)
The number at the beginning of the line shows how many native modules
depend on that module.
All of their dependencies have been satisfied, and any potential
problems that Make can detect are listed in parenthesis after the
module:
dotdot_srcs: LOCAL_SRC_FILES contains paths outside $(LOCAL_PATH)
dotdot_incs: LOCAL_C_INCLUDES contains paths include '..'
srcs_dotarm: LOCAL_SRC_FILES contains source files like <...>.c.arm
aidl: LOCAL_SRC_FILES contains .aidl sources
dbus: LOCAL_SRC_FILES contains .dbus-xml sources
objc: LOCAL_SRC_FILES contains Objective-C sources
proto: LOCAL_SRC_FILES contains .proto sources
rs: LOCAL_SRC_FILES contains renderscript sources
vts: LOCAL_SRC_FILES contains .vts sources
Not all problems can be discovered, but this is a starting point.
Change-Id: I45674fe93fd267d4d1fb0bc3bc9aa025e20c5ac6
Traditionally this has come from android/api-level.h, but with the
libc headers unified it must be set by the build system since we don't
have per-API level copies of that header now.
Test: make checkbuild with other libc ndk_library patches
Change-Id: Idf6cbba131f065b048b1b412e992c55e3d17e701
Only projects in LOCAL_CLANG_EXCEPTION_PROJECTS can set LOCAL_CLANG to false.
Add external/gentoo/integration to this white list.
Bug: 30575506
Change-Id: Icd508686bc2eb8b9d400200166df80115af20da1
Test: build and find new warning in build.log
Any NDK shared libraries not in LOCAL_SYSTEM_SHARED_LIBRARIES weren't
being pulled from the generated libs before since we were only
filtering my_system_shared_libraries and even if we had filtered
my_shared_libraries they would have been rewritten to my_ldlibs.
* Filter my_shared_libraries for NDK generated libs as well.
* Stop rewriting NDK LOCAL_SHARED_LIBRARIES to my_ldlibs. Instead,
rewrite in the opposite direction just like we do for the platform.
* Move shared libs/ldlibs rewriting to before we filter NDK
libraries out of shared libs/system shared libs.
Test: make checkbuild
Bug: http://b/27533932
Change-Id: If1860d9638de77089a46884f406766edaf362216
* LOCAL_CLANG_EXCEPTION_PROJECTS is the list of project prefixes.
* New warning message is detected by warn.py as high severity.
Bug: 30575506
Change-Id: I87a38b2ba6bab1d2e5e7a9d5ec9557f0e609727c
Test: build and find new warning in build.log
AUX is a new class, similar to TARGET
While TARGET defines toolchain for Application Processors
AUX is defining toolchains for arbitrary utility cores (DSPs, GPUs,
MCUs, etc). This allows building of non-android sources as part
of Android tree and avoid using prebuilts if source code is avaliable
Bug: 29635686
Change-Id: Ie755ea054b16c3e86369f5fb2ba6eb0b384af77f
Signed-off-by: Alexey Polyudov <apolyudov@google.com>
introduce LOCAL_NO_LIBCOMPILER_RT
embedded targets do not necessarily want to have it
Bug: 29635686
Change-Id: Ieb04f7ea7237ae01a067dedfa2fb13571e9a789c
Signed-off-by: Alexey Polyudov <apolyudov@google.com>
When overriding toolchain with LOCAL_CC, LOCAL_CXX
build system shall not assume that this custom toolchain
is CLANG.
Bug: 29635686
Change-Id: I9712d098216740c4ff20bd2a4749f489af85b50e
Signed-off-by: Alexey Polyudov <apolyudov@google.com>
on some toolchains and architectures building non-PIC
code renders more efficient assembly
Bug: 29635686
Change-Id: I6274f40d24e1bb43f03b45c60b5487abed02b7fc
Signed-off-by: Alexey Polyudov <apolyudov@google.com>
The list of libraries is currently empty. Will add migrated libraries
in a follow up patch.
Test: Still builds.
Bug: http://b/27533932
Change-Id: Ibd9750620ca2ae86fe888a8a993bd26493bc1c8a
Split the variables that contain header directories into ones that
should be prefixed with -isystem and ones that should be prefixed with
-I in preparation for moving some headers from -isystem to -I.
Add $(wildcard) around SRC_HEADERS to match the soong behavior, and move
users of SRC_HEADERS from config.mk to binary.mk so that the exported
soong value is present.
Test: no changes to build.ninja compile rules
Change-Id: Iadecbbf4351a01e53cb57e721d31f4f836bb82d9