Commit graph

74 commits

Author SHA1 Message Date
Dan Willemsen
87b17d1ff4 Use SRCDIR as a working directory
The existing behavior of using the build directory as the working
directory is useful if you want to move/copy the output directory around
and SRCDIR still refers the the source. But, it's more useful to have
the source directory be the working directory. Tools like cpp(__FILE__)
and other debug prints embed relative paths from the working directory.
We also have tools that expect the working directory to be $TOP.

Change-Id: Ia0f1d3c6b7df72d61cf5628efa2baa98bd19775b
2015-09-17 23:42:25 -07:00
Colin Cross
6002e056fd Make Test_per_src a property on all binaries
Change-Id: I36b84807cac3d8fd7ef50c8ffb8e2a85ddc10509
2015-09-17 15:21:42 -07:00
Dan Willemsen
9e0cb35c29 Allow 'sanitize' to be arch-specific.
The usecase here is system/core/liblog, which wants to turn off
sanitizer only for the target module, since the target sanitizers depend
on liblog.

Change-Id: I99141574a1c4c4847aa8a72bdcc88901fd9b01cd
2015-09-16 15:41:55 -07:00
Dan Willemsen
d67be22400 Port LOCAL_NO_LIBGCC from make
Change-Id: Iba400de882547654b2a5184d420e38113d7545ee
2015-09-16 15:20:36 -07:00
Colin Cross
b43a159c13 Replace asan with sanitize
LOCAL_ADDRESS_SANITIZER has been replaced with LOCAL_SANITIZE.

Change-Id: I81fe7e0c9135cfd4a222fae4012ab5082cc58f29
2015-09-16 14:19:55 -07:00
Dan Willemsen
f8e98b0804 Add libbenchmark's new dependency on libbase.
See https://android-review.googlesource.com/150583

Change-Id: I6f9700b3e51a3b681d3d91b88103eed31764f61e
2015-09-15 22:21:47 +00:00
Dan Willemsen
fa3924e480 Disallow using stlport.
See https://android-review.googlesource.com/149486

Change-Id: I577a16c8c52e2c7d939c3b5026e18ad90e4b9f26
2015-09-15 22:21:16 +00:00
Dan Willemsen
3bf6b47229 Update flags to match make
Change-Id: I8ba24723d5b507fa178255c124b11356719700cb
2015-09-15 22:20:03 +00:00
Colin Cross
39d97f2a56 Add support for include_files
Support include_files and local_include_files to pass -include arguments
to gcc.

Change-Id: Ie3f03218fcbc9732741da91671b20e240f3de3a6
2015-09-14 16:09:36 -07:00
Colin Cross
6e18ca49f8 Fix java resource glob file list location
The source path was being appended to the module out directory
to create the file list file, which was resulting in .. in the
source path moving the file list file up the directory tree.
Use SrcDirRelPath to convert the globbed resource directories
to be relatiave to $srcDir before appending them.

Also do the same fix to generated aidl, logtags, yacc, and lex
files.

Change-Id: I2e636bd30abf03bc1d80a897951a9812cc3e09ef
2015-08-24 16:19:43 -07:00
Dan Willemsen
f5a959c99f Fix arm cflags
-mthumb-interwork was missing from the beginning.

The Clang cflags copy was only a shallow copy, so our clang-specific
fixups were affecting the GCC cflags as well.

The cortex-a15 replacement was removed from build/core with this change:
https://android-review.googlesource.com/#/c/143851

Change-Id: Ib6300e064f6ec4f6a7174d5e2aeacad1c359f7ea
2015-07-13 13:52:30 -07:00
Colin Cross
463a90e587 use init functions to register module types, etc.
Instead of putting all the blueprint registrations in soong_build,
put them all in init() functions.  This puts the registration next
to the implementation.

Change-Id: Ide1a749518f5e9d1367a18ab3bb1d91da3310c76
2015-07-09 17:57:18 -07:00
Dan Willemsen
edc385f5eb Fix libgcc/libatomic link order
This is the equivalent commit to https://android-review.googlesource.com/144749

Change-Id: I79374f33766fa307fd031ffd0cbd9e9d37848324
2015-07-08 18:10:14 -07:00
Colin Cross
aee540a439 Add version_script property
Add version_script property to cc_library to pass a file to
the linker with --version-script.

Change-Id: Ieefb04e15c8dfa72c2eb63b4349f8860222662b2
2015-07-07 10:34:19 -07:00
Dan Willemsen
2ef08f4458 Add exclude_* and remove arch_subtract / "-file"
To align with the current make build system, add exclude_srcs and
exclude_java_resource_dirs. These replace the functionality of
arch_subtract and glob exclusions that use "-file" to exclude a file.

Change-Id: I91c23d5e3c9409f2d9f7921f950153a03a68ad61
2015-07-01 20:59:39 +00:00
Colin Cross
7d5136f033 Improve property comments for docs
Improve the comments associated with properties to work better with
Blueprint's auto-documenting feature.

Make all properties structs into named types so that thet types can be
found using reflection and cross-referenced to the source code to
auto-extract docs.

Remove the leading <property>: text from properties, the documentation
will include the lowercased name of the property.

Add filter tags to the nested arch properties.

Change-Id: I4ef5db86358886fe61456c24eb2dbe6f7b876115
2015-06-29 10:36:02 -07:00
Colin Cross
8f101b45fc Allow common.Glob to be called by singletons
Make common.Glob take an interface that is the intersection of
blueprint.ModuleContext and blueprint.SingletonContext used by
Glob and GlobRule, allowing it to be called on either.  Also
move ExpandSources and Glob into AndroidModuleContext.

Change-Id: I8d1a3160c5dd201033afdb37210e82d8065b137d
2015-06-17 15:36:48 -07:00
Colin Cross
d81496084b Fix repeated ccCmd dependencies on object files
ccCmd was being added as a dependency each time through the object
file loop, tripling the size of the build.ninja file.  Create a
new slice for dependencies on each object file.

Change-Id: Id768d8ea6e5300c15f0f1a5fac5fcbdfdf5e6b0a
2015-05-13 00:50:25 +00:00
Colin Cross
f22982707d Check that local, top level, and exported include paths exist
Require directories listed in the include_dirs, local_include_dirs, and
exported_include_dirs properties to exist.

Change-Id: I5b079bd2c607839bb28dae43801cd7345bde2299
2015-05-12 11:36:53 -07:00
Colin Cross
d3ba039f74 Separate HostOrDevice out of Arch
Take HostOrDevice out of Arch, and put it into AndroidModuleBase
instead.  Also separate out the host vs. device mutator from
ArchMutator.  This will make it possible for genrules to depend
on a host tool, regardless of which host arches it is compiled
for.

Change-Id: I22bbfd28b65c3eebdfa101a712f90dd615148dc8
2015-05-09 00:10:19 +00:00
Colin Cross
2ba19d90c3 Add cc_benchmark module type
Change-Id: I83bed375fa77518baaab4260e714a9368761f0bc
2015-05-07 16:09:34 -07:00
Colin Cross
0af4b8468b Add support for building on Darwin hosts
Add toolchain and build rules for building on Darwin.

Change-Id: I78e21f4051b2941182121b28c9ddfa24396ada41
2015-05-07 14:09:48 -07:00
Colin Cross
74d1ec0c2c Build rule updates for aosp
Various build rule changes to match AOSP:
Add libunwind_llvm and libdl as dependencies for libc++ on device
Always add libcompiler_rt-extras as a dependency
Add libm, libc, and libdl as depnendencies for libc++ static binaries
Disable some clang warnings, and add some clang filtered cflags
Add -fstack-protector to host linux builds
Add jack_flags property to java modules (currently ignored)

Change-Id: Ic0da617bdeaf25f58cb8298dd9ea91b7d6509151
2015-05-04 17:02:18 -07:00
Colin Cross
6bedfaaeea cc: remove incorrect arch cflags
arm and host builds both got some extra global cflags from arm64,
remove them.

Change-Id: Ie4dcbb114714f4ae8b45304755978d66e13e889c
2015-04-30 16:35:03 -07:00
Colin Cross
d8e780df69 cc: make static or shared cflags apply to all source files
Make static or shared cflags properties apply to all source files,
not just the source files defined in the static or shared block.
Needed for libunwind, which passes -DUNW_ADDITIONAL_PREFIX to source
files for the static library, but not for the shared library.

Change-Id: I3cd88cc1099e505eeee077c697db00de22a8b03a
2015-04-29 14:59:23 -07:00
Colin Cross
d350ecd102 Add support for genrule
Add genrule, which uses a host executable (possibly built by the
build system) to generate a single source file.  This differs slightly
from gensrcs, which takes a list of sources and translates them through
a host executable to individual source files.

Change-Id: I94bda62c4c53fb3f3817def190e6a7561508d297
2015-04-29 14:58:16 -07:00
Dan Albert
c3144b1553 ndk: Use prebuilt NDK CRT objects.
Change-Id: Ie8d58fa7c4ef2a62338c20c3078603ac98be0f9c
2015-04-29 10:27:00 -07:00
Colin Cross
a8a93d3769 cc: fix native tests
Add libgtest to native test dependencies before adding stl
dependencies to resolve link errors between libgtest and
libc++_static.

Install device native tests to /dava/nativetest32 and
/data/nativetest64.

Change-Id: I6d9ddba8d5cdbacaa86cae0833fd7e656657e4d9
2015-04-28 15:34:08 -07:00
Colin Cross
2732e9a43f cc: improve combined static/shared libraries
Allow combined static/shared libraries to specify separate dependencies,
and recompile objects if static or shared cflags are set.

Change-Id: I9fd71d8debd5ade5637389ee38e793082d6d18bb
2015-04-28 15:34:01 -07:00
Colin Cross
18b6dc5d25 cc: fix host gcc libraries
Host gcc libraries should only apply to static binaries, not all
static libraries.  Add c.staticBinary(), and rework everything
else to use c.static(), removing c.shared().

Change-Id: I8addae9b6848010cef94d873f48e7e358e4f5059
2015-04-28 14:12:00 -07:00
Colin Cross
c1e814dbf1 cc: remove --fix-cortex-a8 from non-Cortex A8 devcies
Pass --fix-cortex-a8 only on Cortex A8 and generic ARM builds, and
pass --no-fix-cortex-a8 on everything else.

Change-Id: I4b12afee4de443b5d55df66be3c6a05251715e31
2015-04-28 14:11:56 -07:00
Colin Cross
e11befc4e4 cc: finish unexporting DepNames and Flags
gorename missed DepNames and Flags on CCBase and CCLinked

Change-Id: I926227eef51fdbe10f22b743bf3e2265cdc6a9ad
2015-04-28 14:11:53 -07:00
Colin Cross
712fc026df Fix gcc libraries for host targets with platform libc++
Targeting the platform-provided libc++ on the host requires passing
-nodefautlibs to gcc, and then re-adding all the default libs except
libc++.

Change-Id: I5a42375bcc819b07f6ee02e9d76e7f5088fa00e0
2015-04-27 11:18:21 -07:00
Colin Cross
9ffb4f5295 cc: export CCTest
export CCTest so it can be overriden by artCCTest

Change-Id: I027c7fb392ff7fa55e5ecb635fbf31a7662d8e22
2015-04-27 11:18:21 -07:00
Colin Cross
0676e2d1d6 cc: unexport Flags and DepNames
Flags and DepNames are no longer needed outside of cc, they are
replaced by ModifyProperties.

Change-Id: I84ff0dc180cb3459d6181a83fc67c6158987c1ae
2015-04-27 11:18:21 -07:00
Colin Cross
fa1387916f cc: export structs and add ModifyProperties
Instead of the complicated Flags and DepNames system used now
for overriding CC modules, export all the main structs and the
properties structs so that module types that override them can
modify properties before build rule generation starts.

Change-Id: I6d71550def1ef07798b27d5fec40739ef3ac8165
2015-04-27 11:18:21 -07:00
Colin Cross
28344528cf Simplify flags in c compiling, fix NDK build warnings
Reduce the number of flags variables when compiling C by getting
rid of the separately-tracked IncludeDirs variables, and putting
them directly in GlobalFlags.  Also changes exportedIncludeDirs
to exportedFlags, which will allow exporting flags besides -I.

Also fixes a bug when building a module with the NDK and -Werror
by passing NDK exported include directories with -isystem instead
of -I, which will ignore warnings from those includes.

Also fixes a bug where the default includes were being inserted
into all cflags by the arm and arm64 toolchain modules.

Change-Id: Ice97f84e637b21d20c38c85b881afa315f9f92ae
2015-04-22 14:08:45 -07:00
Colin Cross
56b4d45341 Remove global include paths for modules built against NDK
Modules built against the NDK shouldn't get the global or arch-specific
include paths, all headers will be provided by depenendencies or the
NDK.

Change-Id: I13b9530a365e11e9cf6bd2b99b756b36944e0a9e
2015-04-21 17:38:44 -07:00
Colin Cross
41c187b3d4 Support relative_install_path for cc modules
Support specifying an install path relative to the default install
path for cc libraries and binaries.

Change-Id: I47a97de9beaedde27d99c498c3f26c9d36358d94
2015-04-21 17:37:37 -07:00
Colin Cross
c0b06f191f Add aidl file support to java builds
Add support for aidl files listed in srcs for java builds, and
an aidl_preprocess module type for framework and sdk aidls.

Change-Id: I3aa537f4483822e5b534c74d0b35f13a938f8947
2015-04-08 16:37:31 -07:00
Colin Cross
fce532760f Support subtracting sources from globs
Support -file or -path/glob in file lists that contain globs to
subtract files from the resulting glob.  Also move source file
prefixing and handling into a common function.

Change-Id: Ib6d74ce22f53cae7348c4ba35b779976d90359a6
2015-04-08 15:19:30 -07:00
Colin Cross
1332b0035c Move config into common and provide helper
Using ctx.Config().(Config) everywhere is a mouthful, and it is
inefficient to do the type assertion.  Put the Config interface into
the context, and provide an AConfig() to return the Config already
converted to the right type.

Change-Id: I301a1fd7d2a005580aabca7866a37c5d42ad8c69
2015-04-08 15:19:24 -07:00
Colin Cross
8df14ac3f0 Add rpath to host executables
Host executables need rpath set so they can find their shared
libraries.

Change-Id: I297682d3266bb436af0f594e8164ee4b9e7ab234
2015-04-08 15:17:45 -07:00
Colin Cross
581c189988 Add yacc and lex support
Add support for yacc (.y or .yy) and lex (.l or .ll) files.  Also
tweak locations of .o files for normal and generated sources to
makes sure they don't collide.

Change-Id: I03172cddbdc022525bf392a81d72050406b8cdb3
2015-04-08 15:17:45 -07:00
Colin Cross
7d21c4430d Use @files for ld and ar
ld and ar command lines often end up larger than ARG_MAX, use Ninja's
rsp file support to automatically write the object files to a temporary
file and pass it in using @file support.

This isn't going to work on Darwin host builds, where the host
toolchains don't support @.

Change-Id: Ida2f4e114ab02df6967e863577fa324e197827d5
2015-04-02 14:48:55 -07:00
Colin Cross
577f6e4baf Fix ndk and stl compiling
Move ndk linking against libc and libm out of system shared libraries
so that static libraries that link against the ndk can depend on
libc and libm, which is required to get the ndk sysroot include path.
Also make ndk stl versions only apply to the device variant of
multi-target builds.

Change-Id: I6926541da17b9baf3aa7f811a839c3b65c5d804d
2015-03-27 18:24:14 -07:00
Colin Cross
28d76590f1 Use ContainsProperty to support default values
Instead of setting a string property to magic default value and then
checking for it later, call ctx.ContainsProperty to determine if it
was set.  Use the same method on the clang bool property, which
couldn't be set to a magic value.

blueprint's ModuleContext.ContainsProperty only works on a single
property, not on all arch variant properties -
ModuleContext.ContainsProperty("clang") will return false if
clang was not set but arch.arm.clang was set - so track which
properties were extended inside extendProperties, and override
ModuleContext.ContainsProperty in AndroidModuleContext to also
check the extended properties.

Change-Id: I03cbe71dc69344972e23d6c794da9be05e720c45
2015-03-27 17:54:50 -07:00
Colin Cross
1f8f234c33 Support cc_test_host
Support cc_test_host for gtest tests compiled for the host.

Change-Id: I632d2c211075ba9391d934609f1bf368459397e1
2015-03-27 15:58:24 -07:00
Colin Cross
4ae185c7ec Support for suffix property on binaries
The suffix property will modify the name of the resulting binary
by adding its value to the module name.

Change-Id: I188e97d4c88f26c060ba2ffbd37f832d701fe0cb
2015-03-27 15:58:24 -07:00
Colin Cross
bfae8859f2 Support prefix_symbols for linker
The linker needs to add __dl_ to the beginning of all of its symbols
to avoid conflicts.  Add support for a prefix_symbols property, and
insert an objcopy --prefix_symbols build step to produce the final
binary.

Change-Id: I70de7c830cd64305e5900c6de53efecea2e17c75
2015-03-27 15:58:24 -07:00