History log of /ndk/build/core/build-binary.mk
Revision Date Author Comments
b9239fd616cee2585e32b8c7119a938f7ff1e4b3 20-Aug-2012 David 'Digit' Turner <digit@android.com> Make ndk-build recognize more C++ file extensions by default.

Since LOCAL_CPP_EXTENSION now supports listing several extensions,
let ndk-build auto-detect .cc, .c++ and others as C++ by default.

Change-Id: I59881634c3691e7c8b12e055c241b97214e20e1b
19c0e0ecefd43a3e24a4b13eddea8303cc75c4ec 07-Aug-2012 Jason Lin <sh.lin@mediatek.com> Fix wrong build commands when using multiple ABIs.

The build commands must use lazy assignment, because these
commands may be redefined in setup.mk for different ABI and
toolchain. Without this change, NDK alway uses the commands
defined in the last included setup.mk but not the correct ones.
544ecbef57ecf42fbe8a99a1a6cd6816a347f587 06-Aug-2012 David 'Digit' Turner <digit@android.com> Fix windows parallel builds

This patch fixes Windows parallel builds that sometimes
failed due to timing issues in the host-mkdir implementation.
http://code.google.com/p/android/issues/detail?id=25875

+ Optimize the creation of output directories.

Instead of invoking host-mkdir for every output file,
we now introduce a single rule and appropriate dependencies
to ensure that this operation is only done once.

+ Remove obsolete cmd-install-file definition
(use host-install instead).

Change-Id: I64a090a50c5b26cdaf8d989b55a8bbe68e9149d9
0136e5405c99a3fbe1be109ee8ff186475c0d99a 03-Jul-2012 Andrew Hsieh <andrewhsieh@google.com> Change default GCC to 4.6; Build separate gnu-libstdc++ for GCC 4.4.3 and GCC 4.6

All target prebuilt will be built with GCC 4.6.

GNU libstdc++ is GCC dependent. GCC 4.6 seems to take header/libraries
built by GCC 4.4.3, but the reverse isnĘžt true. With this CL GCC will
now use its own version of libstdc++.

make-standalone-toolchain by default install GCC 4.6. Use --toolchain to
select GCC 4.4.3.

Change-Id: I2f4042501989fbfce94a521e6c24e1102d95a3aa
2723aa406bd0474c26f3ce5dbcc7a233d1b83357 28-Jun-2012 Andrew Hsieh <andrewhsieh@google.com> Remove *LDSCRIPT_X and *LDSCRIPT_XSC

*LDSCRIPT_X[SC] are no longer needed since MIPS patches of linker
scripts are merged into toolchain repo.

Change-Id: I2007476a8e37334b28a37d1666a16b343cb41d4b
ed5bc4dd6c325a8f2193763161b1fc84250efa39 25-May-2012 Andrew Hsieh <andrewhsieh@google.com> Revise LOCAL_DISABLE_NO_EXECUTE and LOCAL_DISABLE_RELRO implementations

Revise implementations after toolchain is patched to provides NX
and relro protections by default.

See
https://android-review.googlesource.com/#/c/36682/
https://android-review.googlesource.com/#/c/37040/

Change-Id: Ic9daed89c78c25ad46d66ced5a2e534ec8ca83ae
f74c373729bcd1519debe03cda90ef3fd3366848 17-May-2012 Nick Kralevich <nnk@google.com> ndk: compile third party apps with relro support.

Enable relro / bind_now when compiling NDK applications.
This marks certain regions of memory as read-only after linking,
making memory corruption security vulnerabilities harder
to exploit.

See:
* http://www.akkadia.org/drepper/nonselsec.pdf (section 6)
* http://tk-blog.blogspot.com/2009/02/relro-not-so-well-known-memory.html

Change-Id: I52ebddca857845145d5192341d0343183b56843d
488e22a37f47c49be48a0f2f877298dd5fd0d1c9 16-May-2012 Andrew Hsieh <andrewhsieh@google.com> More fix to LOCAL/APP_SHORT_COMMANDS

Related bug entries:
http://code.google.com/p/android/issues/detail?id=29682
http://code.google.com/p/android/issues/detail?id=29896

Related fix:
https://android-review.googlesource.com/#/c/36494

Change-Id: I80975491f0d2dbe1741b324ccd6c788c89c2243f
616aae78295c7618af87d0b3f53335c358945460 10-May-2012 David 'Digit' Turner <digit@google.com> Fix LOCAL/APP_SHORT_COMMANDS

See http://code.google.com/p/android/issues/detail?id=29896

This also speeds up the generation of the list file
through a small bisection algorithm. We now support up
to 6000 parameters per command-line :-)

Change-Id: Ic7f466346acee06fd390756e4384c2765df8c7ac
097812d190ebd3539c82c9c2b24161ae5e75cbb8 30-Mar-2012 Chao-Ying Fu <fu@mips.com> [MIPS] Support to ndk scripts to build MIPS NDK

Change-Id: I36e85a57d409d3f56c37737713bbeb9953b24eaa
7a06c124be094134d81920a8f9fe363f6f30abd1 25-Nov-2011 David 'Digit' Turner <digit@google.com> Build modules with hundreds or thousands of sources.

This patch adds the support for LOCAL_SHORT_COMMANDS in Android.mk
and APP_SHORT_COMMANDS in Application.mk. Setting these variable to
'true' will force the use of a linker/archiver list file when building
your NDK modules.

This is mainly useful when you have a very large number of source
files and/or libraries on Windows, which has a limited
command-line length of 8191 characters.

Fixes http://code.google.com/p/android/issues/detail?id=25359

Change-Id: I6f4824e91231e92c0aa83631b89c462ff25ed1cc
2c18eab92c3f08841f46ac47d1ae207c9384e7af 13-Dec-2011 David 'Digit' Turner <digit@google.com> Fix C++ linking under cygwin.

This fixes a minor issue when trying to link C++ sources that do not
use any of the C++ runtimes through APP_STL would fail on Cygwin because
we didn't translate the hard-coded path to libsupc++ properly.

Change-Id: I63ef1c519cf5c5d750ca5d1d006d687123b26d55
151a2c81c79166122ae88d803de36e151c39b2cf 10-Nov-2011 David 'Digit' Turner <digit@google.com> Fix ndk-build arm/thumb target instruction selection.

Due to a small bug, ndk-build would fail to properly select
the thumb or ARM target instruction set when building a file
(either with or without LOCAL_ARM_MODE).

The problem occured in the following circumstances:

- your project has two modules, which use different
thumb/arm modes

- each of these projects try to build the same source
file, but in different modes.

Due to a bug, the mode selection of the first module was
applied when compiling the second one.

+ Added unit test to check that everything works correctly
for all ABIs and compilation modes (including NEON)

Change-Id: Ibcb9ac95b4b06e4c3f72e0a987926cf02f165bb9
ad1afc5e66ab40201947a3178eba975515b0d73c 14-Oct-2011 David 'Digit' Turner <digit@google.com> Add win32 native build support

This patch is adds support to "native" (i.e. Cygwin-less) Windows
NDK build through the new 'ndk-build.cmd' Windows shell script.

Just call it from the cmd.exe command-line, when in your project
path. The script takes the same arguments than 'ndk-build'.

+ Adds the source of a new tiny Windows-specific command-line
"echo" program. The reason for this is that the 'echo' that
comes with cmd.exe is too weird and will not work properly
when invoked from make (e.g. it can't deal with double-quoted
strings properly: it will print the double-quotes in the
output).

+ build/tools/build-host-toolbox.sh: new script to rebuild the
'echo' program on Windows. The idea is that the 'toolbox' may
contain other command-line programs like "cp" or "mkdir" in
the future, to avoid relying on the not-so-robust cmd.exe
versions of these commands (del, md, xcopy), if necessary.

+ Make build-host-prebuilts.sh call build-host-toolbox.sh
when generating Windows binaries, and package-release.sh
unpack the corresponding archive when generating the
Windows packages.

+ build-funcs.sh can now be used to build host binaries too.

+ docs/CHANGES.html: document new native win32 build support.

Change-Id: I4d30f6c6532ae84deb95e7e5f595af76b97d9257
f2c6c623ae6aae0b9b82a4433326a01c95da6f4c 10-Oct-2011 David 'Digit' Turner <digit@google.com> gnu-libstdc++: Fix rebuild script and NDK build system

Change-Id: Id0c2ce8f7c8a95f8633db9161e73d61249962c08
c6faf8bffb4884b59265aadcbaa22c8026c41649 22-Sep-2011 David 'Digit' Turner <digit@google.com> Support several C++ source file extensions

This patch modifies the build system to allow one to
list several C++ source file extensions in LOCAL_CPP_EXTENSION.

+ Check the value of LOCAL_CPP_EXTENSION and warn about values
that do not start with a dot (and ignore them).

Note that this doesn't change the default (which is to use '.cpp')

Change-Id: I0b5dfe8699f90955560cd0dbf9f52336970aaabd
c55bfcf671107b1b678f5a66a3ec74cbeb3927cb 15-Sep-2011 David 'Digit' Turner <digit@google.com> Add LOCAL_CPP_FEATURES support to Android.mk

This is a new variable that can be used to specify that a
given module relies on C++ exceptions or RTTI.

This is done for several reasons:

- First, we want to avoid always linking GNU libsupc++
to every final binary, because we're soon going to
provide an alternative.

- Second, it is useful to declare prebuilt binaries that
have been compiled with these features. It allows the
final link to work correctly.

Note that the change is backwards-compatible. You can still
use -frtti or -fexceptions in your compiler flags to enable
the features too.

Change-Id: I24b28935e4446c55b169d35990ec2a379ac08500
1208fe621223ae853a954fd0e0aaf0b0ed46ecda 15-Sep-2011 David 'Digit' Turner <digit@google.com> Fix transitive static library imports

Ensure that if 'foo' imports static library 'bar' which
imports static library 'zoo', then libfoo.so will be linked
against both libbar.a and libzoo.a

Before this patch, only libbar.a was used, which resulted
in a link error.

Change-Id: Icabb2d8eaa4c09b12d00b71919b4c3723d4f90e6
d7ea04d2f4b44b72732ecadbb14ae0e866cd5465 14-Jul-2011 David 'Digit' Turner <digit@android.com> Fix multi-abi build.

This patch fixes multi-ABI builds, i.e. when using something like:

APP_ABI := armeabi x86

In your Application.mk or even the command-line when calling ndk-build.

+ Fix missing libgcc in the toolchain setup scripts. This is required to ensure
that the generated shared library / binary includes all libgcc symbols it
depends on.

Change-Id: I19bb26c8b59901f46af1bb27a1ec4fba62b1dbcc
7848118177898e00e54c0cbb8eb27e91997a4a9c 11-Mar-2011 David 'Digit' Turner <digit@android.com> Fix a typo that broke LOCAL_ARM_NEON := true

See http://code.google.com/p/android/issues/detail?id=12657

Change-Id: If432472bd37c4911cf8e27f91873e4dc5ce73497
93acba5133ede31bc20a2fb5e48ac68dc8b10ed5 21-Feb-2011 David 'Digit' Turner <digit@android.com> Fix object order at link time.

This patch ensures that objects are linked in the same order than
they appear in the LOCAL_SRC_FILES declaration. Previously, the objects
were grouped by source file extension.

This fixes http://code.google.com/p/android/issues/detail?id=14176

Change-Id: Id503284380a4690d29c6cc0eacfa6f6bce1910a2
25fc114e97e8e31af9c8a47f80ca4fbd134bf912 19-Nov-2010 David 'Digit' Turner <digit@google.com> Add support for prebuilt STLport binaries.

This patch allows the NDK to be redistributed with prebuilt
STLport binaries, since rebuilding the library from sources
is quite slow, and its implementation should not change.

Note that the binaries are not added to the NDK git repository.
Instead:

- build/tools/build-stlport.sh is a new script that can be used
to rebuild the binaries and package/copy them appropriately.
It requires a valid NDK installation (i.e. with working toolchain
binaries)

- rebuild-all-prebuilt.sh and package-release.sh are also modified
to rebuild STLport and unpack the prebuilt tarballs when necessary.

- tests/build/prebuild-stlport is a fake project that is used
by build/tools/build-stlport.sh to force the rebuild of the
libraries with the NDK (the script later copies/packages the
libs to the appropriate location).

- sources/android/stlport/Android.mk is modified to auto-detect
whether the binaries are installed under the libs/<abi>/ subdir.
If not, the library will be rebuilt from sources.

Rebuilding from sources can be forced by setting STLPORT_FORCE_REBUILD
to 'true' in your environment. That can be useful for debugging purpose.

+ improve 'pretty-dir' function to recognize the NDK path as a prefix
and replace it in the output by '<NDK>'

+ improve formatting of NDK build messages for prebuilt binaries.
Now it looks like:

Prebuilt : <libname> <= <source-directory>/

Change-Id: I5158b9d7f13e0f6252d89f82b6fd2960e4a2ab1f
b1a60f32cc6b482c1209e1d53e773add926dc520 15-Nov-2010 David 'Digit' Turner <digit@google.com> Add support for LOCAL_WHOLE_STATIC_LIBRARIES.

These libraries are linked to the final binary with the help of
-Wl,--whole-archive .. -Wl,--no-whole-archive. The main difference
is the following:

Consider the following link command:

gcc -o libfoo.o libfoo.a libbar.a libzoo.a

The default Unix linker behaviour is the following:
- undefined symbols in libfoo.a will be searched in libbar.a and libzoo.a
(in this specific order)
- undefined symbols in libbar.a will only be searched in libzoo.a
- undefined symbols in libzoo.a will create an error.

Now consider:

gcc -o libfoo.so -Wl,--whole-archive libfoo.a -Wl,--no-whole-archive libbar.a libzoo.a

Then:

- undefined symbols in libfoo.a are still search in the same way
- undefined symbols in libbar.a are searched in libfoo.a then in libzoo.a
- undefined symbols in libzoo.a are searched in libfoo.a

LOCAL_WHOLE_STATIC_LIBRARIES is a way to group static libraries in the
"whole" category when linking final binaries. This is normally only used
when there are weird circular dependencies in your libraries.

Technically, it's not required, one could instead do:

gcc -o libfoo.o libfoo.a libbar.a libzoo.a libfoo.a

But this does not translate well with the NDK build system's definition of
LOCAL_STATIC_LIBRARIES, and forces the use of LOCAL_LDLIBS := libfoo.a which
is less elegant.

Change-Id: I4b90cad004280a78d596388911482d90bd0755f3
d49e5db44f5a514683ef600db88f8be0b40c3bfd 25-Oct-2010 David 'Digit' Turner <digit@google.com> Fix automatic dependency computation of imported modules.

Before this change, the build system would build any shared library
module that is listed in an imported Android.mk, even if the project
does not need it.

With this change, only the imported modules that are actually needed
by the project will be built.

+ update docs/IMPORT_MODULE.TXT

Change-Id: Iea2ee30dd73be5f9f55ebb1e5658b5368ecbbe31
c2cb1cc7609843440140c4e8794b76321f64cc40 08-Oct-2010 David 'Digit' Turner <digit@google.com> Fix duplicate LOCAL_LDFLAGS at link time.

Change-Id: I278aeb75c9db15807bb3a583996068ed671912ee
1579cd933a0e3a1bdd494a312fb5b9e75a03be87 07-Oct-2010 David 'Digit' Turner <digit@google.com> Fix cygwin build on Windows.

This introduces changes to the build system to deal
with the fact that our Windows toolchain binaries are
not Cygwin programs anymore. As a consequence, they
don't understand paths like /cygdrive/c/stuff.

Essentially, this forces path conversions whenever we're
sending a path to the toolchain binaries, through the new
'host-path' and 'host-c-includes' helper functions.

Also, it reformats the auto-generated dependency files
in order for them to be properly parsed by Cygwin's
GNU Make (see build/awk/convert-deps-to-cygwin.awk for
examples).

As a bonus, this change also simplifies the setup of
each toolchain by grouping common definitions under
build/tools/default-build-commands.mk

Change-Id: I5af99b63cb53b3fcb5e1008dfb764e1e934623e5
7a6b17ae18e87e522a4449eff37800421a8bb6ab 22-Sep-2010 David 'Digit' Turner <digit@google.com> Add prebuilt static library support.

This is done with the new PREBUILT_STATIC_LIBRARY include script.

+ Simplify prebuilts dependencies by removing LOCAL_PREBUILTS.
You can now simply list your prebuilts into LOCAL_STATIC_LIBRARIES
and/or LOCAL_SHARED_LIBRARIES.

+ pretty-print paths during install build commands.

Change-Id: I4aca605fc6f818d9669343c6aefc419a78ee0df2
5171bb2f0f68965677f11da882a956c59c8b9c72 21-Sep-2010 David 'Digit' Turner <digit@google.com> Fix bad automatic dependency tracking when using multiple source subdirectories.

Change-Id: I01848efe60107782efeb2211690a62c8a7d4f2cb
d9851e70410ee5b14f5e9b772dd015e44a558c89 17-Jul-2010 David 'Digit' Turner <digit@google.com> Simplify module database definitions.

Introduce the LOCAL_MODULE_CLASS field, and use it.

Change-Id: I7103a78f801fa4fdd2080088a4ae81249ce011cf
d0ac7ca653627ffe4f38973034c93bc53a66adec 16-Jul-2010 David 'Digit' Turner <digit@google.com> Get rid of (nearly obsolete) build/core/build-module.mk

Change-Id: I50f565b4cbaf84a4b13ea047fd52f7f38fc54f21
bb9dc1a386532db74f47dd0af1930b27e8402926 09-Jul-2010 David 'Digit' Turner <digit@google.com> Add support for LOCAL_MODULE_FILENAME, that allows renaming generated files.

Change-Id: I228732001af7786f31439a8462310e8ffe67dc19
4013467963a9051585d23d6a0b157685605d2aa6 09-Jul-2010 David 'Digit' Turner <digit@google.com> Add support for prebuilt shared libraries.

Change-Id: I56de52c9206741c8300fb84e92602f75765f44a4
e7943289cc2df73a99668615639c97ffe6240fce 17-Jun-2010 David 'Digit' Turner <digit@google.com> Fix BUILD_EXECUTABLE. For some reason, module-is-executable didn't work properly.

Change-Id: I657106ca09b4669bd02e9128af869602d83a865c
a5501b02c2f2a9e1bf9fce42a3faf601adc070e9 03-Jun-2010 David 'Digit' Turner <digit@google.com> Implement module exports + update docs + add a sample.

Change-Id: Ib892ca7d46b69599ce4569d5929f0149bdea8e3f
8700ca93c26e2908670a9982c68f4b8a2bf7dce4 10-Jun-2010 David 'Digit' Turner <digit@google.com> Implement two-pass script parsing.

In preparation of future work. The NDK build script will now parse all
Android.mk and record LOCAL_XXX variables in the modules database.

After all parsing is done, it will populate the dependency graph with
targets and commands. This will allow us to implement "exported" module
variables like LOCAL_EXPORT_CFLAGS and others in a reliable way.

Change-Id: If1eb4ce68b62b5dfa146520a77cbcad401272428
f2f883c9f5d1057b585f2490ffb12800d166e9f4 02-Jun-2010 David 'Digit' Turner <digit@google.com> Warn about unsupported source file extensions in LOCAL_SRC_FILES.

The previous behaviour was to silently ignore these source files, which
confused several NDK users.

Change-Id: I0decb18af9ee6d1c210813d2046e7d3f71c20763
9c3e39c876850d29a4078e2cd9ba6926f55bd69d 04-May-2010 David 'Digit' Turner <digit@google.com> Enable the NX (No Execute) security feature for all NDK-generated machine code on ARM.

Change-Id: Ic25be4e8a83e741040c7944251688dcdcc97838b
Question: shall we enable it for x86 too?
1672f577d45f3f52e02811e399232f78160934cb 27-Apr-2010 David 'Digit' Turner <digit@google.com> Support .s raw assembly source files in LOCAL_SRC_FILES too.

Change-Id: Id17875ebc6dd4e9719b7ad179921e44a5246f596
419390feceb0c39fd3cad8ec6e5253fb74c946a5 09-Apr-2010 David 'Digit' Turner <digit@google.com> Make APP_MODULES optional in Application.mk.

If APP_MODULES is defined, now computes the transitive closure of module dependencies automatically.

+ cleanup some of the build scripts
+ add module database management functions for future work

Change-Id: I4ae14d8a3cbd2240e1efec27c55f8314b618c4d9
a1d764b5d215601e007e01186de0be0db51df900 09-Apr-2010 The Android Open Source Project <initial-contribution@android.com> NDK snapshot from development/ndk/

Change-Id: I154f2fd3828ffd937c82410f5f9995402d7be15e
5bc892834ff140ef11625fdf7602d09e229f73dc 09-Feb-2010 David 'Digit' Turner <digit@google.com> Add NEON support to the NDK build system + docs

You can now define LOCAL_ARM_NEON to 'true' in your Android.mk
to indicate that a whole module must be compiled with NEON support.

Alternatively, use the .neon suffix when listing source files in
LOCAL_SRC_FILES to indicate that they should be built with NEON
support. E.g.:

LOCAL_SRC_FILES := foo.c.neon bar.c zoo.c.arm.neon

Note that .arm.neon is supported, but .neon.arm is NOT.

Also added documentation in docs/CPU-ARM-NEON.TXT

Another patch will provide one or more sample applications
to demonstrate all of this.
0e3db4dad04bba1a6aed5ad15489999078d0361d 29-Jun-2009 David 'Digit' Turner <digit@google.com> Add support for LOCAL_ARM_MODE and .arm source file name suffix.
Also update docs/INSTALL.TXT to explain that MSys is not supported under Windows.
f5107032a58fc88cea9a2bb1211b1f7d9e9eeccb 29-Jun-2009 David 'Digit' Turner <digit@google.com> Fix several typos in the NDK build system that caused quite a few bugs:

- generate thumb code by default (type forced ARM generation)

- make the generation of unoptimized binaries with APP_OPTIM := debug actually work
(the -O0 -g flags were placed before the -Os -mthumb flags for thumb binaries)

- factor common code from build-executable/shared-library/static-library into build-binary.mk
and install-binary.mk

- properly add a -L$(SYSROOT)/usr/lib line to make LOCAL_LDLIBS := -lz work as advertized
(in build-binary.mk)

- add a few missing variables from clear-vars.mk
ce42f422169554ab5f646b9b3491ad9d632605e1 20-May-2009 David 'Digit' Turner <digit@google.com> This fixes the build to always define the ANDROID macro, and remove an empty -I from the compiler options.

The latter had the effect of removing the benefit of optimization settings, i.e. a typical compiler
command would look like:

<toolchain-compiler> .... -Isources/<module-path> -I -O2 -g

The "-I -O2" was interpreted literally as "search in '-O2' directory, and the optimization was
never set to 2 (or 0 in case of debug mode).
494598ad04b57a4e1dbaf6e529c5a8df1fe01c79 19-May-2009 David 'Digit' Turner <digit@google.com> Force --no-undefined at link time to generate an error when trying to generate a shared library that references undefined symbols.
This can be overriden by defining LOCAL_ALLOW_UNDEFINED_SYMBOLS in your Android.mk to 'true'
a85825c5a2b3427e0361c5bf42e9df5c50f58b66 14-May-2009 David 'Digit' Turner <digit@google.com> Fix bad automatic dependency computations
48ef1859ef0bb25547e5aceeedb9b175c6193bc5 07-May-2009 David 'Digit' Turner <digit@google.com> Initial import of new NDK into donut tree