blob: 3d23061f5f87395e3d3fead717546733f0af2a8c [file] [log] [blame]
Build System for Native Client SDK examples
The examples and libraries that ship with the Native Client SDK use a
build system based on GNU Make.
Each example or library is contained in its own directory along with a
Makefile. The Makefiles are capable of building Native Client
applications and libraries using any of the available toolchains as well
as building host applications with the host's toolchain. In order to
keep the top-level Makefiles simple, most of actual build rules are
specified in as set of shared rules files in the $NACL_SDK_ROOT/tools
This document describes some of the variables and macros used by in the
build system. For more details please see the .mk files in the tools
Using the build system for new projects
It is perfectly possible to use the included build system for projects
outside of the Native Client SDK. A good starting point for doing this
would be to copy the Makefile from the hello_world example. In most
simple cases the only changes needed are to update the SOURCES and
TARGET variables.
User Variables
This variable holds the name of your project. Normally this is the
basename of the library or executable which is the final target.
The list of sources to be built. In most cases this list is passed to
the compile and link macros.
This variable can be used to control which toolchains are supported by
the project. Valid entries for this list are: newlib, glibc, pnacl,
linux, mac, win. The default value is: "newlib glibc pnacl".
Optionally force the build system to use a certain location for the
Native Client SDK. If not set within the Makefile the $NACL_SDK_ROOT
environment variable will by used. It is an error if this variable is
neither set within the Makefile nor in the environment.
Macros / Rules
The following macros can be used in the Makefiles to generate the rules
for building the various kinds types of target. These are designed to
be used via the 'call' macro. e.g. $(call COMPILE_RULE,$(SOURCES))
This rule is used to build object files from a list of sources.
Used to build shared objects from a list of sources.
Used to build static libraries from a list of sources.
Used to build nmf metadata file from a native client executable (or
set of executables). This is needed in order to run the executable in
Used to build both html and nmf files from a native client executable
(or set of executables) which will allow the executable to be run
in chrome.
For more information on how to use these rules in your Makefile see
the shared Makefiles in the tools folders:
Top level shared rules file that include the toolchain specific
Rules for building using the gcc-based NaCl toolchains.
Rules for building using the llvm-based PNaCl toolchains.
Rules for building using the linux/mac host gcc toolchain.
Rules for building using the windows Visual Studio toolchain.
.. vim: ft=rst tw=72