diff options
author | noelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-17 05:17:15 +0000 |
---|---|---|
committer | noelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-17 05:17:15 +0000 |
commit | d3661dc6dd05665debc799b4999f5b5888b943ef (patch) | |
tree | a57cff16b3ef222a2733436bcf9f55e65cbbe01a /native_client_sdk | |
parent | 6abb205bf9865a2413081afc6a4e2b6580f91bb3 (diff) | |
download | chromium_src-d3661dc6dd05665debc799b4999f5b5888b943ef.zip chromium_src-d3661dc6dd05665debc799b4999f5b5888b943ef.tar.gz chromium_src-d3661dc6dd05665debc799b4999f5b5888b943ef.tar.bz2 |
Convert all project to use common.mk
The current Makefiles are extremely large and complex.
This change puts the complexity into common.mk, nacl.mk and host.mk
so that Makefile pretty much becomes a list of sources and targets.
BUG=169044
R=binji@chromium.org
Review URL: https://codereview.chromium.org/11882012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177356 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
64 files changed, 2421 insertions, 218 deletions
diff --git a/native_client_sdk/src/build_tools/build_examples.py b/native_client_sdk/src/build_tools/build_examples.py index f358e20..0e98521 100755 --- a/native_client_sdk/src/build_tools/build_examples.py +++ b/native_client_sdk/src/build_tools/build_examples.py @@ -17,6 +17,9 @@ import getos def main(args): parser = optparse.OptionParser() + parser.add_option('--copy', + help='Only copy the files, don\'t build.', + action='store_true' ) parser.add_option('--clobber-examples', help='Don\'t examples directory before copying new files', action='store_true' ) @@ -48,13 +51,17 @@ def main(args): build_sdk.options = options + build_sdk.BuildStepCopyBuildHelpers(pepperdir, platform) build_sdk.BuildStepCopyExamples(pepperdir, toolchains, options.experimental, options.clobber_examples) + test_sdk.BuildStepCopyTests(pepperdir, toolchains, options.experimental, + options.clobber_examples) + if options.copy: + return 0 + # False = don't clean after building the libraries directory. build_sdk.BuildStepBuildLibraries(pepperdir, platform, 'src', False) test_sdk.BuildStepBuildExamples(pepperdir, platform) - test_sdk.BuildStepCopyTests(pepperdir, toolchains, options.experimental, - options.clobber_examples) test_sdk.BuildStepBuildTests(pepperdir, platform) if options.test_examples: test_sdk.BuildStepRunPyautoTests(pepperdir, platform, pepper_ver) diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py index 94b632e..abf8710 100755 --- a/native_client_sdk/src/build_tools/build_sdk.py +++ b/native_client_sdk/src/build_tools/build_sdk.py @@ -586,6 +586,8 @@ def BuildStepCopyBuildHelpers(pepperdir, platform): buildbot_common.BuildStep('Copy build helpers') buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), os.path.join(pepperdir, 'tools')) + buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'), + os.path.join(pepperdir, 'tools')) if platform == 'win': buildbot_common.BuildStep('Add MAKE') http_download.HttpDownload(GSTORE + MAKE, @@ -732,7 +734,8 @@ def GetWindowsEnvironment(): return dict(line.split('=') for line in stdout.split('\r\n')[:-1]) -def BuildStepMakeAll(pepperdir, platform, directory, step_name, clean=False): +def BuildStepMakeAll(pepperdir, platform, directory, step_name, + clean=False, deps=True): buildbot_common.BuildStep(step_name) make_dir = os.path.join(pepperdir, directory) makefile = os.path.join(make_dir, 'Makefile') @@ -746,11 +749,15 @@ def BuildStepMakeAll(pepperdir, platform, directory, step_name, clean=False): env = os.environ make = 'make' - buildbot_common.Run([make, '-j8'], + extra_args = [] + if not deps: + extra_args += 'IGNORE_DEPS=1' + + buildbot_common.Run([make, '-j8', 'all_versions'] + extra_args, cwd=os.path.abspath(make_dir), env=env) if clean: # Clean to remove temporary files but keep the built libraries. - buildbot_common.Run([make, '-j8', 'clean'], + buildbot_common.Run([make, '-j8', 'clean'] + extra_args, cwd=os.path.abspath(make_dir)) diff --git a/native_client_sdk/src/build_tools/generate_make.py b/native_client_sdk/src/build_tools/generate_make.py index 5b6fd37..bcaf33ff 100755 --- a/native_client_sdk/src/build_tools/generate_make.py +++ b/native_client_sdk/src/build_tools/generate_make.py @@ -174,7 +174,7 @@ def GenerateRules(desc, tools): rules += GenerateNMFRules(tc, executable, dlls, cfg, arches) rules += GenerateCleanRules(tools, configs) - rules += '\nall: $(ALL_TARGETS)\n' + rules += '\nall: $(ALL_TARGETS)\n\nall_versions: all\n' return '', rules diff --git a/native_client_sdk/src/examples/Makefile b/native_client_sdk/src/examples/Makefile index 2bbcaf6..e89a7f9 100644 --- a/native_client_sdk/src/examples/Makefile +++ b/native_client_sdk/src/examples/Makefile @@ -24,6 +24,11 @@ TARGET_LIST+=$(1)_TARGET $(1)_TARGET: +$(MAKE) -C $(1) +VERSIONS_LIST+=$(1)_VERSIONS +.PHONY: $(1)_VERSIONS +$(1)_VERSIONS: + +$(MAKE) -C $(1) all_versions + CLEAN_LIST+=$(1)_CLEAN .PHONY: $(1)_CLEAN $(1)_CLEAN: @@ -39,6 +44,9 @@ __DEPENDENCIES__ all: $(TARGET_LIST) echo "Done building targets." +all_versions: $(VERSIONS_LIST) + echo "Done building all versions." + clean: $(CLEAN_LIST) echo "Done cleaning targets." diff --git a/native_client_sdk/src/examples/debugging/Makefile b/native_client_sdk/src/examples/debugging/Makefile new file mode 100644 index 0000000..a506238 --- /dev/null +++ b/native_client_sdk/src/examples/debugging/Makefile @@ -0,0 +1,91 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib + + +# +# Set Chrome Arguments and Environment Variables to support development +# only feature. +# +CHROME_ARGS+=--no-sandbox +CHROME_ENV:=NACL_DANGEROUS_ENABLE_FILE_ACCESS=1 +CHROME_ENV+=NACL_SECURITY_DISABLE=1 +CHROME_ENV+=NACL_UNTRUSTED_EXCEPTION_HANDLING=1 + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=debugging + +# +# List of sources to compile +# +SOURCES=hello_world.c string_stream.c untrusted_crash_dump.c + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),-fno-omit-frame-pointer))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/debugging/example.dsc b/native_client_sdk/src/examples/debugging/example.dsc index 9f62127..8e5e749 100644 --- a/native_client_sdk/src/examples/debugging/example.dsc +++ b/native_client_sdk/src/examples/debugging/example.dsc @@ -1,12 +1,17 @@ { 'TOOLS': ['newlib'], + 'SEARCH': [ + '.', + '..', + '../../tools', + ], 'TARGETS': [ { 'NAME' : 'debugging', 'TYPE' : 'main', 'SOURCES' : [ - 'hello_world.c', - 'string_stream.c', + 'hello_world.c', + 'string_stream.c', 'string_stream.h', 'untrusted_crash_dump.c', 'untrusted_crash_dump.h' @@ -25,7 +30,11 @@ CHROME_ENV+=NACL_SECURITY_DISABLE=1 CHROME_ENV+=NACL_UNTRUSTED_EXCEPTION_HANDLING=1 """, - 'DATA': ['handler.py', 'example.js'], + 'DATA': [ + 'Makefile', + 'example.js', + 'handler.py' + ], 'DEST': 'examples', 'NAME': 'debugging', 'TITLE': 'Debugging', diff --git a/native_client_sdk/src/examples/debugging/hello_world.c b/native_client_sdk/src/examples/debugging/hello_world.c index b081062..a5dd333 100644 --- a/native_client_sdk/src/examples/debugging/hello_world.c +++ b/native_client_sdk/src/examples/debugging/hello_world.c @@ -90,7 +90,8 @@ static struct PP_Var CStrToVar(const char* str) { static void PostCompletionCallback(void* user_data, int32_t result) { - ppb_messaging_interface->PostMessage(g_Instance, CStrToVar(user_data)); + const char *str = (const char *) user_data; + ppb_messaging_interface->PostMessage(g_Instance, CStrToVar(str)); free(user_data); } @@ -229,7 +230,7 @@ static PP_Bool Instance_HandleDocumentLoad(PP_Instance instance, /** * Handles message from JavaScript. - * + * * Any message from JS is a request to cause the main thread to crash. */ static void Messaging_HandleMessage(PP_Instance instance, diff --git a/native_client_sdk/src/examples/dlopen/Makefile b/native_client_sdk/src/examples/dlopen/Makefile new file mode 100644 index 0000000..29a08a8 --- /dev/null +++ b/native_client_sdk/src/examples/dlopen/Makefile @@ -0,0 +1,85 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC glibc toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=glibc + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=dlopen + +# +# List of sources to compile +# +DLOPEN_SRCS=dlopen.cc +EIGHTBALL_SRCS=eightball.cc + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) dl ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(DLOPEN_SRCS),$(eval $(call COMPILE_RULE,$(src)))) +$(foreach src,$(EIGHTBALL_SRCS),$(eval $(call COMPILE_RULE,$(src),-fPIC))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call SO_RULE,libeightball,$(EIGHTBALL_SRCS))) +$(eval $(call LINK_RULE,$(TARGET),$(DLOPEN_SRCS),$(LIBS),$(DEPS))) + + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/dlopen/example.dsc b/native_client_sdk/src/examples/dlopen/example.dsc index d1b7207..cd66e0c 100644 --- a/native_client_sdk/src/examples/dlopen/example.dsc +++ b/native_client_sdk/src/examples/dlopen/example.dsc @@ -15,7 +15,10 @@ 'LIBS' : ['ppapi_cpp', 'ppapi', 'pthread'] } ], - 'DATA': ['example.js'], + 'DATA': [ + 'Makefile', + 'example.js', + ], 'DEST': 'examples', 'NAME': 'dlopen', 'TITLE': 'Dynamic Library Open', diff --git a/native_client_sdk/src/examples/file_histogram/Makefile b/native_client_sdk/src/examples/file_histogram/Makefile new file mode 100644 index 0000000..4d6c124 --- /dev/null +++ b/native_client_sdk/src/examples/file_histogram/Makefile @@ -0,0 +1,81 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=file_histogram + +# +# List of sources to compile +# +SOURCES=file_histogram.cc + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/file_histogram/example.dsc b/native_client_sdk/src/examples/file_histogram/example.dsc index 1092847..e6d409b 100644 --- a/native_client_sdk/src/examples/file_histogram/example.dsc +++ b/native_client_sdk/src/examples/file_histogram/example.dsc @@ -8,7 +8,10 @@ 'LIBS' : ['ppapi_cpp', 'ppapi', 'pthread'] } ], - 'DATA': ['example.js'], + 'DATA': [ + 'Makefile', + 'example.js', + ], 'DEST': 'examples', 'NAME': 'file_histogram', 'TITLE': 'File Histogram.', @@ -18,6 +21,6 @@ passing the file contents to NativeClient as a VarArrayBuffer, then drawing a histogram representing the contents of the file to a 2D square. """, 'FOCUS': 'VarArrayBuffer, 2D, File input.', - 'GROUP': 'API' + 'GROUP': 'API' } diff --git a/native_client_sdk/src/examples/file_io/Makefile b/native_client_sdk/src/examples/file_io/Makefile new file mode 100644 index 0000000..ec1e5a9 --- /dev/null +++ b/native_client_sdk/src/examples/file_io/Makefile @@ -0,0 +1,81 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=file_io + +# +# List of sources to compile +# +SOURCES=file_io.cc + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/file_io/example.dsc b/native_client_sdk/src/examples/file_io/example.dsc index b7c4c1a..5daf414 100644 --- a/native_client_sdk/src/examples/file_io/example.dsc +++ b/native_client_sdk/src/examples/file_io/example.dsc @@ -8,7 +8,10 @@ 'LIBS' : ['ppapi_cpp', 'ppapi', 'pthread'] } ], - 'DATA': ['example.js'], + 'DATA': [ + 'Makefile', + 'example.js', + ], 'DEST': 'examples', 'NAME': 'file_io', 'TITLE': 'File I/O', diff --git a/native_client_sdk/src/examples/gamepad/Makefile b/native_client_sdk/src/examples/gamepad/Makefile new file mode 100644 index 0000000..7b3ab61 --- /dev/null +++ b/native_client_sdk/src/examples/gamepad/Makefile @@ -0,0 +1,81 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=gamepad + +# +# List of sources to compile +# +SOURCES=gamepad.cc gamepad_module.cc + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/gamepad/example.dsc b/native_client_sdk/src/examples/gamepad/example.dsc index 2d6102e..0a499fb 100644 --- a/native_client_sdk/src/examples/gamepad/example.dsc +++ b/native_client_sdk/src/examples/gamepad/example.dsc @@ -8,6 +8,9 @@ 'LIBS': ['ppapi_cpp', 'ppapi', 'pthread'] } ], + 'DATA': [ + 'Makefile', + ], 'DEST': 'examples', 'NAME': 'gamepad', 'TITLE': 'Gamepad Example.', diff --git a/native_client_sdk/src/examples/geturl/Makefile b/native_client_sdk/src/examples/geturl/Makefile new file mode 100644 index 0000000..2469024 --- /dev/null +++ b/native_client_sdk/src/examples/geturl/Makefile @@ -0,0 +1,80 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=geturl + +# +# List of sources to compile +# +SOURCES=geturl.cc geturl_handler.cc + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/geturl/example.dsc b/native_client_sdk/src/examples/geturl/example.dsc index 7fdde7a..60d1d40 100644 --- a/native_client_sdk/src/examples/geturl/example.dsc +++ b/native_client_sdk/src/examples/geturl/example.dsc @@ -8,7 +8,11 @@ 'LIBS': ['ppapi_cpp', 'ppapi', 'pthread'] } ], - 'DATA': ['geturl_success.html', 'example.js'], + 'DATA': [ + 'Makefile', + 'example.js', + 'geturl_success.html', + ], 'DEST': 'examples', 'NAME': 'geturl', 'TITLE': 'Get URL', diff --git a/native_client_sdk/src/examples/hello_nacl_mounts/Makefile b/native_client_sdk/src/examples/hello_nacl_mounts/Makefile new file mode 100644 index 0000000..8a24b63 --- /dev/null +++ b/native_client_sdk/src/examples/hello_nacl_mounts/Makefile @@ -0,0 +1,81 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=hello_nacl_mounts + +# +# List of sources to compile +# +SOURCES=handlers.c hello_nacl_mounts.c queue.c + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS=nacl_mounts +LIBS=$(DEPS) ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/hello_nacl_mounts/example.dsc b/native_client_sdk/src/examples/hello_nacl_mounts/example.dsc index abffe26..ea55c44 100644 --- a/native_client_sdk/src/examples/hello_nacl_mounts/example.dsc +++ b/native_client_sdk/src/examples/hello_nacl_mounts/example.dsc @@ -16,15 +16,16 @@ } ], 'DATA': [ + 'Makefile', 'example.js' ], 'DEST': 'examples', 'NAME': 'hello_nacl_mounts', 'TITLE': 'Hello, Nacl Mounts!', 'DESC': """ -The NaCl Mounts example demonstrates mapping standard FILE such as fopen, +The NaCl Mounts example demonstrates mapping standard FILE such as fopen, fread, fwrite into mounts by linking in the nacl_mounts library. This allows -developers to wrap Pepper API such as the File IO API or URL Loader into +developers to wrap Pepper API such as the File IO API or URL Loader into standard blocking calls.""", 'FOCUS': 'Using NaCl Mounts.', 'GROUP': 'Concepts' diff --git a/native_client_sdk/src/examples/hello_world/Makefile b/native_client_sdk/src/examples/hello_world/Makefile index 1c20829..d7bebcb 100644 --- a/native_client_sdk/src/examples/hello_world/Makefile +++ b/native_client_sdk/src/examples/hello_world/Makefile @@ -14,9 +14,19 @@ # # By default we will build a Debug configuration using the GCC newlib toolcahin # to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on -# the make command-line or in this file prior to including common.mk +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. # -include common.mk +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk # @@ -63,7 +73,7 @@ $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) # # Use the link macro for this target on the list of sources. # -$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS))) +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) # # Specify the NMF to be created with no additional arugments. diff --git a/native_client_sdk/src/examples/hello_world/example.dsc b/native_client_sdk/src/examples/hello_world/example.dsc index dc1849a..b100ffb 100644 --- a/native_client_sdk/src/examples/hello_world/example.dsc +++ b/native_client_sdk/src/examples/hello_world/example.dsc @@ -1,10 +1,5 @@ { 'TOOLS': ['newlib', 'glibc', 'pnacl', 'win', 'linux'], - 'SEARCH': [ - '.', - '..', - '../../tools', - ], 'TARGETS': [ { 'NAME' : 'hello_world', @@ -15,7 +10,6 @@ ], 'DATA': [ 'Makefile', - 'common.mk', 'example.js', ], 'DEST': 'examples', diff --git a/native_client_sdk/src/examples/hello_world_gles/Makefile b/native_client_sdk/src/examples/hello_world_gles/Makefile index 154b132..07294e6 100644 --- a/native_client_sdk/src/examples/hello_world_gles/Makefile +++ b/native_client_sdk/src/examples/hello_world_gles/Makefile @@ -14,9 +14,19 @@ # # By default we will build a Debug configuration using the GCC newlib toolcahin # to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on -# the make command-line or in this file prior to including common.mk +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. # -include common.mk +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk # @@ -63,7 +73,7 @@ $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) # # Use the link macro for this target on the list of sources. # -$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS))) +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) # # Specify the NMF to be created with no additional arugments. diff --git a/native_client_sdk/src/examples/hello_world_gles/example.dsc b/native_client_sdk/src/examples/hello_world_gles/example.dsc index 9da28d6..70dc010 100644 --- a/native_client_sdk/src/examples/hello_world_gles/example.dsc +++ b/native_client_sdk/src/examples/hello_world_gles/example.dsc @@ -1,10 +1,5 @@ { 'TOOLS': ['newlib', 'glibc', 'pnacl', 'win', 'linux'], - 'SEARCH': [ - '.', - '..', - '../../tools', - ], 'TARGETS': [ { 'NAME' : 'hello_world_gles', @@ -19,7 +14,6 @@ ], 'DATA': [ 'Makefile', - 'common.mk', 'fragment_shader_es2.frag', 'hello.raw', 'vertex_shader_es2.vert' diff --git a/native_client_sdk/src/examples/hello_world_interactive/Makefile b/native_client_sdk/src/examples/hello_world_interactive/Makefile index 747d52c..cbf342e 100644 --- a/native_client_sdk/src/examples/hello_world_interactive/Makefile +++ b/native_client_sdk/src/examples/hello_world_interactive/Makefile @@ -14,9 +14,19 @@ # # By default we will build a Debug configuration using the GCC newlib toolcahin # to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on -# the make command-line or in this file prior to including common.mk +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. # -include common.mk +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk # @@ -45,7 +55,8 @@ SOURCES=hello_world.cc helper_functions.cc # We break this list down into two parts, the set we need to rebuild (DEPS) # and the set we do not. # -LIBS=ppapi_cpp ppapi pthread +DEPS=ppapi_cpp +LIBS=$(DEPS) ppapi pthread # @@ -61,7 +72,7 @@ $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) # # Use the link macro for this target on the list of sources. # -$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS))) +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) # # Specify the NMF to be created with no additional arugments. diff --git a/native_client_sdk/src/examples/hello_world_interactive/example.dsc b/native_client_sdk/src/examples/hello_world_interactive/example.dsc index ef275e8..35c15a8 100644 --- a/native_client_sdk/src/examples/hello_world_interactive/example.dsc +++ b/native_client_sdk/src/examples/hello_world_interactive/example.dsc @@ -1,10 +1,5 @@ { 'TOOLS': ['newlib', 'glibc', 'pnacl', 'win', 'linux'], - 'SEARCH': [ - '.', - '..', - '../../tools', - ], 'TARGETS': [ { 'NAME' : 'hello_world_interactive', @@ -20,7 +15,6 @@ 'DATA': [ 'example.js', 'Makefile', - 'common.mk', ], 'DEST': 'examples', 'NAME': 'hello_world_interactive', diff --git a/native_client_sdk/src/examples/hello_world_stdio/Makefile b/native_client_sdk/src/examples/hello_world_stdio/Makefile index ccc4997..31ce7dd 100644 --- a/native_client_sdk/src/examples/hello_world_stdio/Makefile +++ b/native_client_sdk/src/examples/hello_world_stdio/Makefile @@ -14,9 +14,19 @@ # # By default we will build a Debug configuration using the GCC newlib toolcahin # to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on -# the make command-line or in this file prior to including common.mk +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. # -include common.mk +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk # @@ -62,7 +72,7 @@ $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) # # Use the link macro for this target on the list of sources. # -$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS))) +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) # # Specify the NMF to be created with no additional arugments. diff --git a/native_client_sdk/src/examples/hello_world_stdio/example.dsc b/native_client_sdk/src/examples/hello_world_stdio/example.dsc index 3237944..aefce01 100644 --- a/native_client_sdk/src/examples/hello_world_stdio/example.dsc +++ b/native_client_sdk/src/examples/hello_world_stdio/example.dsc @@ -1,10 +1,5 @@ { - 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux'], - 'SEARCH': [ - '.', - '..', - '../../tools', - ], + 'TOOLS': ['newlib', 'glibc', 'win'], 'TARGETS': [ { 'NAME' : 'hello_world_stdio', @@ -15,7 +10,6 @@ ], 'DATA': [ 'Makefile', - 'common.mk', 'example.js', ], 'DEST': 'examples', diff --git a/native_client_sdk/src/examples/input_events/Makefile b/native_client_sdk/src/examples/input_events/Makefile new file mode 100644 index 0000000..53c2de3 --- /dev/null +++ b/native_client_sdk/src/examples/input_events/Makefile @@ -0,0 +1,81 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=input_events + +# +# List of sources to compile +# +SOURCES=custom_events.cc input_events.cc + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/input_events/example.dsc b/native_client_sdk/src/examples/input_events/example.dsc index 759d9e6a..1f5d20e 100644 --- a/native_client_sdk/src/examples/input_events/example.dsc +++ b/native_client_sdk/src/examples/input_events/example.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['newlib', 'glibc', 'pnacl'], + 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'win'], 'TARGETS': [ { 'NAME' : 'input_events', @@ -13,7 +13,10 @@ 'LIBS': ['ppapi_cpp', 'ppapi', 'pthread'] } ], - 'DATA': ['example.js'], + 'DATA': [ + 'Makefile', + 'example.js', + ], 'DEST': 'examples', 'NAME': 'input_events', 'TITLE': 'Input Events', diff --git a/native_client_sdk/src/examples/load_progress/Makefile b/native_client_sdk/src/examples/load_progress/Makefile new file mode 100644 index 0000000..2723136 --- /dev/null +++ b/native_client_sdk/src/examples/load_progress/Makefile @@ -0,0 +1,80 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=load_progress + +# +# List of sources to compile +# +SOURCES=load_progress.cc + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/load_progress/example.dsc b/native_client_sdk/src/examples/load_progress/example.dsc index b62d970..46cb541 100644 --- a/native_client_sdk/src/examples/load_progress/example.dsc +++ b/native_client_sdk/src/examples/load_progress/example.dsc @@ -8,12 +8,15 @@ 'LIBS': ['ppapi_cpp', 'ppapi', 'pthread'] } ], - 'DATA': ['check_browser.js', 'example.js'], + 'DATA': [ + 'Makefile', + 'example.js', + ], 'DEST': 'examples', 'NAME': 'load_progress', 'TITLE': 'Load Progress', 'DESC': """ -The Load Progress example demonstrates how to listen for and handle +The Load Progress example demonstrates how to listen for and handle events that occur while a NaCl module loads. This example listens for different load event types and dispatches different events to their respective handler. This example also checks for valid browser version and diff --git a/native_client_sdk/src/examples/mouselock/Makefile b/native_client_sdk/src/examples/mouselock/Makefile new file mode 100644 index 0000000..2d1d1b1 --- /dev/null +++ b/native_client_sdk/src/examples/mouselock/Makefile @@ -0,0 +1,81 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=mouselock + +# +# List of sources to compile +# +SOURCES=mouselock.cc + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/mouselock/example.dsc b/native_client_sdk/src/examples/mouselock/example.dsc index 133ecec..520cabb 100644 --- a/native_client_sdk/src/examples/mouselock/example.dsc +++ b/native_client_sdk/src/examples/mouselock/example.dsc @@ -8,7 +8,9 @@ 'LIBS': ['ppapi_cpp', 'ppapi', 'pthread'] } ], - 'DATA': ['check_browser.js'], + 'DATA': [ + 'Makefile', + ], 'DEST': 'examples', 'NAME': 'mouselock', 'TITLE': 'Mouse Lock', diff --git a/native_client_sdk/src/examples/pi_generator/Makefile b/native_client_sdk/src/examples/pi_generator/Makefile new file mode 100644 index 0000000..3d58035 --- /dev/null +++ b/native_client_sdk/src/examples/pi_generator/Makefile @@ -0,0 +1,81 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=pi_generator + +# +# List of sources to compile +# +SOURCES=pi_generator.cc pi_generator_module.cc + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/pi_generator/example.dsc b/native_client_sdk/src/examples/pi_generator/example.dsc index f1b78a8..4394b43 100644 --- a/native_client_sdk/src/examples/pi_generator/example.dsc +++ b/native_client_sdk/src/examples/pi_generator/example.dsc @@ -12,7 +12,10 @@ 'LIBS': ['ppapi_cpp', 'ppapi', 'pthread'] } ], - 'DATA': ['example.js'], + 'DATA': [ + 'Makefile', + 'example.js', + ], 'DEST': 'examples', 'NAME': 'pi_generator', 'TITLE': 'Monte Carlo Estimate for Pi', diff --git a/native_client_sdk/src/examples/sine_synth/Makefile b/native_client_sdk/src/examples/sine_synth/Makefile new file mode 100644 index 0000000..ee01cd69 --- /dev/null +++ b/native_client_sdk/src/examples/sine_synth/Makefile @@ -0,0 +1,81 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=sine_synth + +# +# List of sources to compile +# +SOURCES=sine_synth.cc + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/sine_synth/example.dsc b/native_client_sdk/src/examples/sine_synth/example.dsc index 45ba580..3aa2434 100644 --- a/native_client_sdk/src/examples/sine_synth/example.dsc +++ b/native_client_sdk/src/examples/sine_synth/example.dsc @@ -8,7 +8,10 @@ 'LIBS': ['ppapi_cpp', 'ppapi', 'pthread'] } ], - 'DATA': ['example.js'], + 'DATA': [ + 'Makefile', + 'example.js', + ], 'DEST': 'examples', 'NAME': 'sine_synth', 'TITLE': 'Sine Wave Synthesizer', diff --git a/native_client_sdk/src/examples/websocket/Makefile b/native_client_sdk/src/examples/websocket/Makefile new file mode 100644 index 0000000..a857719 --- /dev/null +++ b/native_client_sdk/src/examples/websocket/Makefile @@ -0,0 +1,81 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=websocket + +# +# List of sources to compile +# +SOURCES=websocket.cc + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. This example does not havea any additional library +# dependencies. +# +DEPS= +LIBS=$(DEPS) ppapi_cpp ppapi pthread + + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/native_client_sdk/src/examples/websocket/example.dsc b/native_client_sdk/src/examples/websocket/example.dsc index b3b583b..799340b 100644 --- a/native_client_sdk/src/examples/websocket/example.dsc +++ b/native_client_sdk/src/examples/websocket/example.dsc @@ -8,7 +8,10 @@ 'LIBS': ['ppapi_cpp', 'ppapi'] } ], - 'DATA': ['example.js'], + 'DATA': [ + 'Makefile', + 'example.js', + ], 'DEST': 'examples', 'NAME': 'websocket', 'TITLE': 'Websocket', diff --git a/native_client_sdk/src/libraries/gmock/Makefile b/native_client_sdk/src/libraries/gmock/Makefile new file mode 100644 index 0000000..d3150a8 --- /dev/null +++ b/native_client_sdk/src/libraries/gmock/Makefile @@ -0,0 +1,54 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final library, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=gmock + +# +# List of sources to compile +# +SOURCES:=gmock.cc gmock-matchers.cc gmock-cardinalities.cc +SOURCES+=gmock-internal-utils.cc gmock-spec-builders.cc + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),-Wno-switch-enum))) + +# +# Use the lib macro for this target on the list of sources. +# +$(eval $(call LIB_RULE,$(TARGET),$(SOURCES))) diff --git a/native_client_sdk/src/libraries/gmock/library.dsc b/native_client_sdk/src/libraries/gmock/library.dsc index a8feec2..c45ef63 100644 --- a/native_client_sdk/src/libraries/gmock/library.dsc +++ b/native_client_sdk/src/libraries/gmock/library.dsc @@ -1,6 +1,7 @@ { 'TOOLS': ['newlib', 'glibc', 'win', 'linux', 'pnacl'], 'SEARCH': [ + '.', '../../../../testing/gmock/include/gmock', '../../../../testing/gmock/include/gmock/internal', '../../../../testing/gmock/src', @@ -50,6 +51,9 @@ 'DEST': 'include/gmock/internal', }, ], + 'DATA': [ + 'Makefile' + ], 'DEST': 'testlibs', 'NAME': 'gmock', } diff --git a/native_client_sdk/src/libraries/gtest/Makefile b/native_client_sdk/src/libraries/gtest/Makefile new file mode 100644 index 0000000..cd3d7c9 --- /dev/null +++ b/native_client_sdk/src/libraries/gtest/Makefile @@ -0,0 +1,57 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +EXTRA_INC_PATHS=$(NACL_SDK_ROOT)/include/gtest/internal + +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final library, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=gtest + +# +# List of sources to compile +# +SOURCES:=gtest.cc gtest-death-test.cc gtest-filepath.cc gtest_main.cc +SOURCES+=gtest-port.cc gtest-printers.cc gtest-test-part.cc +SOURCES+=gtest-typed-test.cc nacl_gtest_dummy_sys.cc + + + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),-Wno-switch-enum -Wno-variadic-macros))) + +# +# Use the lib macro for this target on the list of sources. +# +$(eval $(call LIB_RULE,$(TARGET),$(SOURCES))) diff --git a/native_client_sdk/src/libraries/gtest/library.dsc b/native_client_sdk/src/libraries/gtest/library.dsc index 429f0e9..9755f60 100644 --- a/native_client_sdk/src/libraries/gtest/library.dsc +++ b/native_client_sdk/src/libraries/gtest/library.dsc @@ -82,6 +82,9 @@ 'DEST': 'include/gtest/internal/src', }, ], + 'DATA': [ + 'Makefile' + ], 'DEST': 'testlibs', 'NAME': 'gtest', } diff --git a/native_client_sdk/src/libraries/gtest_ppapi/Makefile b/native_client_sdk/src/libraries/gtest_ppapi/Makefile new file mode 100644 index 0000000..ea7a873 --- /dev/null +++ b/native_client_sdk/src/libraries/gtest_ppapi/Makefile @@ -0,0 +1,54 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final library, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=gtest_ppapi + +# +# List of sources to compile +# +SOURCES:=gtest_event_listener.cc gtest_instance.cc gtest_module.cc +SOURCES+=gtest_nacl_environment.cc gtest_runner.cc + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),-Wno-switch-enum -Wno-variadic-macros))) + +# +# Use the lib macro for this target on the list of sources. +# +$(eval $(call LIB_RULE,$(TARGET),$(SOURCES))) diff --git a/native_client_sdk/src/libraries/gtest_ppapi/library.dsc b/native_client_sdk/src/libraries/gtest_ppapi/library.dsc index 2b1c6f7..b4eaf41 100644 --- a/native_client_sdk/src/libraries/gtest_ppapi/library.dsc +++ b/native_client_sdk/src/libraries/gtest_ppapi/library.dsc @@ -28,6 +28,9 @@ 'DEST': 'include/gtest_ppapi', }, ], + 'DATA': [ + 'Makefile' + ], 'DEST': 'testlibs', 'NAME': 'gtest_ppapi', } diff --git a/native_client_sdk/src/libraries/nacl_mounts/Makefile b/native_client_sdk/src/libraries/nacl_mounts/Makefile new file mode 100644 index 0000000..d5963ea --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_mounts/Makefile @@ -0,0 +1,57 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final library, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=nacl_mounts + +# +# List of sources to compile +# +SOURCES:=kernel_handle.cc kernel_intercept.cc kernel_object.cc kernel_proxy.cc +SOURCES+=kernel_wrap_glibc.cc kernel_wrap_newlib.cc kernel_wrap_win.cc +SOURCES+=mount.cc mount_dev.cc mount_html5fs.cc mount_mem.cc +SOURCES+=mount_node.cc mount_node_dir.cc mount_node_html5fs.cc mount_node_mem.cc +SOURCES+=nacl_mounts.cc path.cc pepper_interface.cc real_pepper_interface.cc + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the lib macro for this target on the list of sources. +# +$(eval $(call LIB_RULE,$(TARGET),$(SOURCES))) diff --git a/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap.h b/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap.h index d09195d..08e342a 100644 --- a/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap.h +++ b/native_client_sdk/src/libraries/nacl_mounts/kernel_wrap.h @@ -45,6 +45,7 @@ int _fstat64(int fd, struct _stat64* buf); int _fstat32i64(int fd, struct _stat32i64* buf); int _fstat64i32(int fd, struct _stat64i32* buf); #else +struct stat; int fstat(int fd, struct stat* buf) NOTHROW; #endif int fsync(int fd); diff --git a/native_client_sdk/src/libraries/nacl_mounts/library.dsc b/native_client_sdk/src/libraries/nacl_mounts/library.dsc index e7f81ee..1d5ca15 100644 --- a/native_client_sdk/src/libraries/nacl_mounts/library.dsc +++ b/native_client_sdk/src/libraries/nacl_mounts/library.dsc @@ -1,7 +1,6 @@ { # Disabled pnacl for now because it warns on using the language extension # typeof(...) - #'TOOLS': ['newlib', 'glibc', 'pnacl', 'win'], 'TOOLS': ['newlib', 'glibc', 'win'], 'SEARCH': [ '.', @@ -78,6 +77,9 @@ 'DEST': 'include/utils', } ], + 'DATA': [ + 'Makefile', + ], 'DEST': 'src', 'NAME': 'nacl_mounts', } diff --git a/native_client_sdk/src/libraries/nacl_mounts/mount_node_html5fs.cc b/native_client_sdk/src/libraries/nacl_mounts/mount_node_html5fs.cc index 0859882..648b94b 100644 --- a/native_client_sdk/src/libraries/nacl_mounts/mount_node_html5fs.cc +++ b/native_client_sdk/src/libraries/nacl_mounts/mount_node_html5fs.cc @@ -116,7 +116,7 @@ int MountNodeHtml5Fs::GetDents(size_t offs, struct dirent* pdir, size_t size) { continue; file_name_length = std::min( - file_name_length, + static_cast<size_t>(file_name_length), sizeof(static_cast<struct dirent*>(0)->d_name) - 1); // -1 for NULL. dirents.push_back(dirent()); diff --git a/native_client_sdk/src/libraries/nacl_mounts/nacl_mounts.h b/native_client_sdk/src/libraries/nacl_mounts/nacl_mounts.h index da14ba4..6a09c429 100644 --- a/native_client_sdk/src/libraries/nacl_mounts/nacl_mounts.h +++ b/native_client_sdk/src/libraries/nacl_mounts/nacl_mounts.h @@ -7,6 +7,8 @@ #include <ppapi/c/pp_instance.h> #include <ppapi/c/ppb.h> + +#include "nacl_mounts/kernel_wrap.h" #include "utils/macros.h" EXTERN_C_BEGIN @@ -86,7 +88,7 @@ void nacl_mounts_init_ppapi(PP_Instance instance, * @return 0 on success, -1 on failure (with errno set). */ int mount(const char* source, const char* target, const char* filesystemtype, - unsigned long mountflags, const void *data); + unsigned long mountflags, const void *data) NOTHROW; EXTERN_C_END diff --git a/native_client_sdk/src/libraries/nacl_mounts_test/Makefile b/native_client_sdk/src/libraries/nacl_mounts_test/Makefile new file mode 100644 index 0000000..3f76a15 --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_mounts_test/Makefile @@ -0,0 +1,84 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc win +INCLUDES+=$(NACL_SDK_ROOT)/include/gtest/internal + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# List of libraries to link against. Unlike some tools, the GCC and LLVM +# based tools require libraries to be specified in the correct order. The +# order should be symbol reference followed by symbol definition, with direct +# sources to the link (object files) are left most. In this case: +# hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc +# Notice that libc is implied and come last through standard compiler/link +# switches. +# +# We break this list down into two parts, the set we need to rebuild (DEPS) +# and the set we do not. +# +DEPS=nacl_mounts ppapi_cpp +LIBS=gtest_ppapi gtest gmock $(DEPS) ppapi pthread + +# +# Use the library dependency macro for each dependency +# +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) + +# +# Target Name +# +# The base name of the final NEXE, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=nacl_mount_test + +# +# List of sources to compile +# +SOURCES:=kernel_object_test.cc kernel_proxy_mock.cc kernel_proxy_test.cc +SOURCES+=kernel_wrap_test.cc module.cc mount_node_test.cc +SOURCES+=mount_html5fs_test.cc mount_test.cc path_test.cc +SOURCES+=pepper_interface_mock.cc + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),-Wno-switch-enum -Wno-variadic-macros))) + +# +# Use the link macro for this target on the list of sources. +# +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) + +# +# Specify the NMF to be created with no additional arugments. +# +$(eval $(call NMF_RULE,$(TARGET),)) + + + diff --git a/native_client_sdk/src/libraries/nacl_mounts_test/example.dsc b/native_client_sdk/src/libraries/nacl_mounts_test/example.dsc index d7ef63a..8410b0f 100644 --- a/native_client_sdk/src/libraries/nacl_mounts_test/example.dsc +++ b/native_client_sdk/src/libraries/nacl_mounts_test/example.dsc @@ -26,6 +26,7 @@ } ], 'DATA': [ + 'Makefile', 'example.js' ], 'DEST': 'tests', diff --git a/native_client_sdk/src/libraries/ppapi_cpp/Makefile b/native_client_sdk/src/libraries/ppapi_cpp/Makefile new file mode 100644 index 0000000..7de331c --- /dev/null +++ b/native_client_sdk/src/libraries/ppapi_cpp/Makefile @@ -0,0 +1,65 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final library, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=ppapi_cpp + +# +# List of sources to compile +# +SOURCES:=ppp_entrypoints.cc +SOURCES+=array_output.cc audio.cc audio_config.cc core.cc +SOURCES+=file_io.cc file_ref.cc file_system.cc fullscreen.cc +SOURCES+=graphics_2d.cc graphics_3d.cc graphics_3d_client.cc +SOURCES+=image_data.cc input_event.cc instance.cc instance_handle.cc +SOURCES+=lock.cc message_loop.cc module.cc mouse_cursor.cc mouse_lock.cc +SOURCES+=rect.cc resource.cc +SOURCES+=url_loader.cc url_request_info.cc url_response_info.cc +SOURCES+=var.cc var_array_buffer.cc view.cc websocket.cc + +# Utility sources. +SOURCES+=paint_aggregator.cc paint_manager.cc simple_thread.cc +SOURCES+=websocket_api.cc + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),-Wno-switch-enum))) + +# +# Use the lib macro for this target on the list of sources. +# +$(eval $(call LIB_RULE,$(TARGET),$(SOURCES))) diff --git a/native_client_sdk/src/libraries/ppapi_cpp/library.dsc b/native_client_sdk/src/libraries/ppapi_cpp/library.dsc index 956f866..24c727b 100644 --- a/native_client_sdk/src/libraries/ppapi_cpp/library.dsc +++ b/native_client_sdk/src/libraries/ppapi_cpp/library.dsc @@ -1,6 +1,7 @@ { 'TOOLS': ['newlib', 'glibc', 'pnacl', 'win', 'linux'], - 'SEARCH' : [ + 'SEARCH': [ + '.', '../../../../ppapi/cpp', '../../../../ppapi/utility', '../../../../ppapi/utility/graphics', @@ -52,6 +53,9 @@ ], } ], + 'DATA': [ + 'Makefile', + ], 'DEST': 'src', 'NAME': 'ppapi_cpp', } diff --git a/native_client_sdk/src/libraries/ppapi_gles2/Makefile b/native_client_sdk/src/libraries/ppapi_gles2/Makefile new file mode 100644 index 0000000..2881627 --- /dev/null +++ b/native_client_sdk/src/libraries/ppapi_gles2/Makefile @@ -0,0 +1,56 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc pnacl linux win + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# Ignore warnings +NACL_WARNINGS:= + + +# Target Name +# +# The base name of the final library, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=ppapi_gles2 + +# +# List of sources to compile +# +SOURCES:=gl2ext_ppapi.c gles2.c + +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src)))) + +# +# Use the lib macro for this target on the list of sources. +# +$(eval $(call LIB_RULE,$(TARGET),$(SOURCES))) diff --git a/native_client_sdk/src/libraries/ppapi_gles2/library.dsc b/native_client_sdk/src/libraries/ppapi_gles2/library.dsc index 46a9cf3..0d9b465 100644 --- a/native_client_sdk/src/libraries/ppapi_gles2/library.dsc +++ b/native_client_sdk/src/libraries/ppapi_gles2/library.dsc @@ -1,6 +1,9 @@ { 'TOOLS': ['win', 'linux'], - 'SEARCH' : ['../../../../ppapi/lib/gl/gles2'], + 'SEARCH' : [ + '.', + '../../../../ppapi/lib/gl/gles2' + ], 'TARGETS': [ { 'NAME' : 'ppapi_gles2', @@ -11,6 +14,9 @@ ], } ], + 'DATA': [ + 'Makefile', + ], 'DEST': 'src', 'NAME': 'ppapi_gles2', } diff --git a/native_client_sdk/src/libraries/ppapi_main/Makefile b/native_client_sdk/src/libraries/ppapi_main/Makefile new file mode 100644 index 0000000..fb16a49 --- /dev/null +++ b/native_client_sdk/src/libraries/ppapi_main/Makefile @@ -0,0 +1,52 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default configuration +# +# By default we will build a Debug configuration using the GCC newlib toolcahin +# to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on +# the make command-line or in this file prior to including common.mk. The +# toolchain we use by default will be the first valid one listed +VALID_TOOLCHAINS:=newlib glibc + + +# +# Get pepper directory for toolchain and includes. +# +# If NACL_SDK_ROOT is not set, then assume it can be found relative to +# to this Makefile. +# +NACL_SDK_ROOT?=$(abspath $(CURDIR)/../..) +include $(NACL_SDK_ROOT)/tools/common.mk + + +# +# Target Name +# +# The base name of the final library, also the name of the NMF file containing +# the mapping between architecture and actual NEXE. +# +TARGET=ppapi_main + +# +# List of sources to compile +# +SOURCES:=ppapi_main.cc ppapi_instance.cc +# +# Use the compile macro for each source. +# +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),-Wno-switch-enum))) + +# +# Use the lib macro for this target on the list of sources. +# +$(eval $(call LIB_RULE,$(TARGET),$(SOURCES))) diff --git a/native_client_sdk/src/libraries/ppapi_main/library.dsc b/native_client_sdk/src/libraries/ppapi_main/library.dsc index fd55e2d..65e1c0f 100644 --- a/native_client_sdk/src/libraries/ppapi_main/library.dsc +++ b/native_client_sdk/src/libraries/ppapi_main/library.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['newlib', 'glibc', 'pnacl'], + 'TOOLS': ['newlib', 'glibc'], 'SEARCH': [ '.', ], @@ -22,6 +22,9 @@ 'DEST': 'include/ppapi_main', }, ], + 'DATA': [ + 'Makefile', + ], 'DEST': 'src', 'NAME': 'ppapi_main', } diff --git a/native_client_sdk/src/libraries/ppapi_main/ppapi_instance.cc b/native_client_sdk/src/libraries/ppapi_main/ppapi_instance.cc index 5389ca8..7f4c1d2 100644 --- a/native_client_sdk/src/libraries/ppapi_main/ppapi_instance.cc +++ b/native_client_sdk/src/libraries/ppapi_main/ppapi_instance.cc @@ -14,6 +14,7 @@ #include <string> #include <vector> +#include "nacl_mounts/kernel_wrap.h" #include "nacl_mounts/nacl_mounts.h" #include "ppapi/cpp/input_event.h" diff --git a/native_client_sdk/src/tools/common.mk b/native_client_sdk/src/tools/common.mk index 5797755..ad7d586 100644 --- a/native_client_sdk/src/tools/common.mk +++ b/native_client_sdk/src/tools/common.mk @@ -15,7 +15,24 @@ # currently supported by x86 and ARM. To switch to glibc, you would need # to drop support for ARM. # -TOOLCHAIN?=newlib +VALID_TOOLCHAINS?=newlib +TOOLCHAIN?=$(word 1,$(VALID_TOOLCHAINS)) + + +# +# Top Make file, which we want to trigger a rebuild on if it changes +# +TOP_MAKE:=$(word 1,$(MAKEFILE_LIST)) + + +# +# Verify we selected a valid toolchain for this example +# +ifeq (,$(findstring $(TOOLCHAIN),$(VALID_TOOLCHAINS))) +$(warning Availbile choices are: $(VALID_TOOLCHAINS)) +$(error Can not use TOOLCHAIN=$(TOOLCHAIN) on this example.) +endif + # # Build Configuration @@ -27,6 +44,7 @@ TOOLCHAIN?=newlib CONFIG?=Debug + # Note for Windows: # Both GCC and LLVM bases tools (include the version of Make.exe that comes # with the SDK) both expect and are capable of dealing with the '/' seperator. @@ -38,7 +56,6 @@ CONFIG?=Debug # is used. For Cygwin shells this can include automatic and incorrect expansion # of response files (files starting with '@'). # - # Disable DOS PATH warning when using Cygwin based NaCl tools on Windows. # CYGWIN?=nodosfilewarning @@ -46,40 +63,12 @@ export CYGWIN # -# Get pepper directory for toolchain and includes. -# -# If NACL_SDK_ROOT is not set, then assume it can be found a two directories up, -# from the default example directory location. -# -THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST))) -THIS_DIR:=$(abspath $(dir $(THIS_MAKEFILE))) -NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..) - - -# -# Defaults build flags -# -# Convert warnings to errors, and build with no optimization. -# -NACL_WARNINGS:=-Wno-long-long -Werror -OPT_FLAGS:=-g -O0 -CXX_FLAGS:=-pthread -I$(NACL_SDK_ROOT)/include -LD_FLAGS:=-pthread - - -# -# Library Paths -# -# Libraries are stored in different directories for each achitecture as well -# as different subdirectories for Debug vs Release configurations. This make -# only supports the Debug configuration for simplicity. -# -# By default for x86 32 bit this expands to: -# $(NACL_SDK_ROOT)/lib/newlib_x86_32/Debug +# Alias for standard POSIX file system commands # -LD_X86_32:=-L$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_x86_32/$(CONFIG) -LD_X86_64:=-L$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_x86_64/$(CONFIG) -LD_ARM:=-L$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_arm/$(CONFIG) +CP:=python $(NACL_SDK_ROOT)/tools/oshelpers.py cp +MKDIR:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mkdir +MV:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mv +RM:=python $(NACL_SDK_ROOT)/tools/oshelpers.py rm # @@ -89,13 +78,6 @@ OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain) -# -# Alias for standard POSIX file system commands -# -CP:=python $(NACL_SDK_ROOT)/tools/oshelpers.py cp -MKDIR:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mkdir -MV:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mv -RM:=python $(NACL_SDK_ROOT)/tools/oshelpers.py rm # @@ -109,6 +91,26 @@ all: # +# Target a toolchain +# +# $1 = Toolchain Name +# +define TOOLCHAIN_RULE +.PHONY: all_$(1) +all_$(1): + +$(MAKE) TOOLCHAIN=$(1) +TOOLCHAIN_LIST+=all_$(1) +endef + + +# +# The target for all versions +# +USABLE_TOOLCHAINS=$(filter $(OSNAME) newlib glibc pnacl,$(VALID_TOOLCHAINS)) +$(foreach tool,$(USABLE_TOOLCHAINS),$(eval $(call TOOLCHAIN_RULE,$(tool),$(dep)))) +all_versions: $(TOOLCHAIN_LIST) + +# # Target to remove temporary files # .PHONY: clean @@ -116,21 +118,6 @@ clean: $(RM) $(TARGET).nmf $(RM) -fr $(TOOLCHAIN) -# -# Macros for TOOLS -# -# We use the C++ compiler for everything and then use the -Wl,-as-needed flag -# in the linker to drop libc++ unless it's actually needed. -# -X86_CXX?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-g++ -X86_LINK?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-g++ -Wl,-as-needed - -ARM_CXX?=$(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-g++ -ARM_LINK?=$(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-g++ -Wl,-as-needed - -PNACL_CXX?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang++ -c -PNACL_LINK?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang++ - # # Rules for output directories. @@ -147,6 +134,7 @@ $(TOOLCHAIN)/$(CONFIG): | $(TOOLCHAIN) $(MKDIR) $(TOOLCHAIN)/$(CONFIG) OUTDIR:=$(TOOLCHAIN)/$(CONFIG) +-include $(OUTDIR)/*.d # @@ -157,116 +145,67 @@ OUTDIR:=$(TOOLCHAIN)/$(CONFIG) define DEPEND_RULE .PHONY: $(1) $(1): +ifeq (,$(IGNORE_DEPS)) + @echo "Checking library: $(1)" +$(MAKE) -C $(NACL_SDK_ROOT)/src/$(1) DEPS_LIST+=$(1) +else + @echo "Ignore DEPS: $(1)" +endif endef -# -# Compile Macro -# -# $1 = Source Name -# -# By default, if $(1) = source.c, this rule expands to: -# newlib/Debug/source_x86_32.o : souce.c Makefile | newlib/Debug -# -# Which means if 'source.c' or Makefile are newer than the object -# newlib/Debug/source_x86_32.o, then run the step: -# $(X86_CC) -o newlib/Debug/source_x86_32.o -c source.c .... -# -# We repeat this expansion for 64 bit X86 and conditionally for ARM if -# TOOLCHAIN=newlib -# -define COMPILE_RULE -$(OUTDIR)/$(basename $(1))_x86_32.o : $(1) $(THIS_MAKE) | $(OUTDIR) - $(X86_CXX) -o $$@ -c $$< -m32 $(OPT_FLAGS) $(CXX_FLAGS) $(NACL_WARNINGS) - -$(OUTDIR)/$(basename $(1))_x86_64.o : $(1) $(THIS_MAKE) | $(OUTDIR) - $(X86_CXX) -o $$@ -c $$< -m64 $(OPT_FLAGS) $(CXX_FLAGS) $(NACL_WARNINGS) - -$(OUTDIR)/$(basename $(1))_arm.o : $(1) $(THIS_MAKE) | $(OUTDIR) - $(ARM_CXX) -o $$@ -c $$< $(OPT_FLAGS) $(CXX_FLAGS) $(NACL_WARNINGS) -$(OUTDIR)/$(basename $(1))_pnacl.o : $(1) $(THIS_MAKE) | $(OUTDIR) - $(PNACL_CXX) -o $$@ -c $$< $(OPT_FLAGS) $(CXX_FLAGS) $(NACL_WARNINGS) -endef +ifeq ('win','$(TOOLCHAIN)') +HOST_EXT=.dll +else +HOST_EXT=.so +endif # -# Link Macro -# -# $1 = Target Name -# $2 = List of Sources -# -# By default, if $(1) = foo $(2) = A.c B.cc, this rule expands to: -# newlib/Debug/foo_x86_32.nexe : newlib/Debug/A_x86_32.o ... -# -# Which means if A_x86_32.o or sourceB_32.o is newer than the nexe then -# run the build step: -# $(X86_LINK) -o newlib/Debug/foo_x86_32.nexe newlib/Debug/A_x86_32.o ... +# Common Compile Options # -# Note: -# We expand each library as '-l<name>' which will look for lib<name> in the -# directory specified by $(LD_X86_32) -# -# We repeat this expansion for 64 bit X86 and conditionally for ARM if -# TOOLCHAIN=newlib -# -define LINK_RULE -NMF_TARGETS+=$(OUTDIR)/$(1)_x86_32.nexe -$(OUTDIR)/$(1)_x86_32.nexe : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_x86_32.o) - $(X86_LINK) -o $$@ $$^ -m32 $(LD_X86_32) $(LD_FLAGS) $(foreach lib,$(LIBS),-l$(lib)) - -NMF_TARGETS+=$(OUTDIR)/$(1)_x86_64.nexe -$(OUTDIR)/$(1)_x86_64.nexe : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_x86_64.o) - $(X86_LINK) -o $$@ $$^ -m64 $(LD_X86_64) $(LD_FLAGS) $(foreach lib,$(LIBS),-l$(lib)) - -NMF_TARGETS+=$(OUTDIR)/$(1)_arm.nexe -$(OUTDIR)/$(1)_arm.nexe : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_arm.o) - $(ARM_LINK) -o $$@ $$^ $(LD_ARM) $(LD_FLAGS) $(foreach lib,$(LIBS),-l$(lib)) - -NMF_TARGETS+=$(OUTDIR)/$(1).pexe -$(OUTDIR)/$(1).pexe : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_pnacl.o) - $(PNACL_LINK) -o $$@ $$^ $(LD_PNACL) $(LD_FLAGS) $(foreach lib,$(LIBS),-l$(lib)) -endef - +ifeq ('Release','$(CONFIG)') +POSIX_OPT_FLAGS?=-g -O2 -pthread +else +POSIX_OPT_FLAGS?=-g -O0 -pthread +endif +NACL_CFLAGS?=-Wno-long-long -Werror +NACL_CXXFLAGS?=-Wno-long-long -Werror # -# Generate NMF_TARGETS +# Default Paths # -ARCHES=x86_32 x86_64 -ifeq "newlib" "$(TOOLCHAIN)" -ARCHES+=arm +ifeq (,$(findstring $(TOOLCHAIN),linux mac win)) +INC_PATHS?=$(NACL_SDK_ROOT)/include $(EXTRA_INC_PATHS) +else +INC_PATHS?=$(NACL_SDK_ROOT)/include/$(OSNAME) $(NACL_SDK_ROOT)/include $(EXTRA_INC_PATHS) endif -NMF_ARCHES:=$(foreach arch,$(ARCHES),_$(arch).nexe) -ifeq "pnacl" "$(TOOLCHAIN)" -NMF_ARCHES:=.pexe -endif +LIB_PATHS?=$(NACL_SDK_ROOT)/lib $(EXTRA_LIB_PATHS) # -# NMF Manifiest generation +# If the requested toolchain is a NaCl or PNaCl toolchain, the use the +# macros and targets defined in nacl.mk, otherwise use the host sepecific +# macros and targets. # -# Use the python script create_nmf to scan the binaries for dependencies using -# objdump. Pass in the (-L) paths to the default library toolchains so that we -# can find those libraries and have it automatically copy the files (-s) to -# the target directory for us. -# -# $1 = Target Name (the basename of the nmf -# $2 = Additional create_nmf.py arguments -# -NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py -GLIBC_DUMP:=$(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/bin/objdump -GLIBC_PATHS:=-L $(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/lib32 -GLIBC_PATHS+=-L $(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/lib +ifneq (,$(findstring $(TOOLCHAIN),linux mac)) +include $(NACL_SDK_ROOT)/tools/host_gcc.mk +endif -define NMF_RULE -$(OUTDIR)/$(1).nmf : $(foreach arch,$(NMF_ARCHES),$(OUTDIR)/$(1)$(arch)) - $(NMF) -o $$@ $$^ -D $(GLIBC_DUMP) $(GLIBC_PATHS) -s $(OUTDIR) $(2) +ifneq (,$(findstring $(TOOLCHAIN),win)) +include $(NACL_SDK_ROOT)/tools/host_vc.mk +endif -all : $(DEPS_LIST) $(OUTDIR)/$(1).nmf -endef +ifneq (,$(findstring $(TOOLCHAIN),glibc newlib)) +include $(NACL_SDK_ROOT)/tools/nacl_gcc.mk +endif + +ifneq (,$(findstring $(TOOLCHAIN),pnacl)) +include $(NACL_SDK_ROOT)/tools/nacl_llvm.mk +endif # @@ -297,7 +236,13 @@ CHROME_ENV?= CHROME_ARGS+=--enable-nacl --enable-pnacl --incognito --ppapi-out-of-process -CONFIG?=Debug +# Paths to Debug and Release versions of the Host Pepper plugins +PPAPI_DEBUG=$(abspath $(OSNAME)/Debug/$(TARGET)$(HOST_EXT));application/x-ppapi-debug +PPAPI_RELEASE=$(abspath $(OSNAME)/Release/$(TARGET)$(HOST_EXT));application/x-ppapi-release + +info: + @echo "DEBUG=$(PPAPI_DEBUG)" + PAGE?=index_$(TOOLCHAIN)_$(CONFIG).html RUN: LAUNCH @@ -306,7 +251,7 @@ ifeq (,$(wildcard $(PAGE))) $(warning No valid HTML page found at $(PAGE)) $(error Make sure TOOLCHAIN and CONFIG are properly set) endif - $(RUN_PY) -C $(THIS_DIR) -P $(PAGE) $(addprefix -E ,$(CHROME_ENV)) -- \ + $(RUN_PY) -C $(CURDIR) -P $(PAGE) $(addprefix -E ,$(CHROME_ENV)) -- \ $(CHROME_PATH) $(CHROME_ARGS) \ --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" diff --git a/native_client_sdk/src/tools/host_gcc.mk b/native_client_sdk/src/tools/host_gcc.mk new file mode 100644 index 0000000..4f85a0c --- /dev/null +++ b/native_client_sdk/src/tools/host_gcc.mk @@ -0,0 +1,137 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Macros for TOOLS +# +# We use the C++ compiler for everything and then use the -Wl,-as-needed flag +# in the linker to drop libc++ unless it's actually needed. +# +HOST_CC?=gcc +HOST_CXX?=g++ +HOST_LINK?=g++ +HOST_LIB?=ar r + + +LINUX_WARNINGS?=-Wno-long-long +LINUX_CCFLAGS=-fPIC -MMD -pthread $(LINUX_WARNINGS) -I$(NACL_SDK_ROOT)/include -I$(NACL_SDK_ROOT)/include/linux + + +# +# Individual Macros +# +# $1 = Source Name +# $2 = Compile Flags +# +define C_COMPILER_RULE +$(OUTDIR)/$(basename $(1)).o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(HOST_CC) -o $$@ -c $$< -fPIC $(POSIX_OPT_FLAGS) $(2) $(LINUX_FLAGS) +endef + +define CXX_COMPILER_RULE +$(OUTDIR)/$(basename $(1)).o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(HOST_CXX) -o $$@ -c $$< -fPIC $(POSIX_OPT_FLAGS) $(2) $(LINUX_FLAGS) +endef + + +# $1 = Source Name +# $2 = POSIX Compile Flags +# $3 = VC Flags (unused) +# +define COMPILE_RULE +ifeq ('.c','$(suffix $(1))') +$(call C_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc))) +else +$(call CXX_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc))) +endif +endef + + +# +# SO Macro +# +# $1 = Target Name +# $2 = List of Sources +# +# +define SO_RULE +$(error 'Shared libraries not supported by Host') +endef + + +# +# LIB Macro +# +# $1 = Target Name +# $2 = List of Sources +# +# +define LIB_RULE +all:$(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/lib$(1).a +$(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(OUTDIR)/$(basename $(src)).o) + $(MKDIR) -p $(dir $$@) + $(HOST_LIB) $$@ $$^ +endef + + +# +# Link Macro +# +# $1 = Target Name +# $2 = List of inputs +# $3 = List of libs +# $4 = List of deps +# $5 = List of lib dirs +# $6 = Other Linker Args +# +define LINKER_RULE +all: $(1) +$(1) : $(2) $(4) + $(HOST_LINK) -shared -o $(1) $(2) $(foreach path,$(5),-L$(path)/$(OSNAME)_host)/$(CONFIG) $(foreach lib,$(3),-l$(lib)) $(6) +endef + + +# +# Link Macro +# +# $1 = Target Name +# $2 = List of Sources +# $3 = List of LIBS +# $4 = List of DEPS +# $5 = POSIX Linker Switches +# $6 = VC Linker Switches +# +define LINK_RULE +$(call LINKER_RULE,$(OUTDIR)/$(1)$(HOST_EXT),$(foreach src,$(2),$(OUTDIR)/$(basename $(src)).o),$(filter-out pthread,$(3)),$(4),$(LIB_PATHS),$(5)) +endef + + +# +# NMF Manifiest generation +# +# Use the python script create_nmf to scan the binaries for dependencies using +# objdump. Pass in the (-L) paths to the default library toolchains so that we +# can find those libraries and have it automatically copy the files (-s) to +# the target directory for us. +# +# $1 = Target Name (the basename of the nmf +# $2 = Additional create_nmf.py arguments +# +NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py + +define NMF_RULE +NMF_LIST+=$(OUTDIR)/$(1).nmf +$(OUTDIR)/$(1).nmf : $(OUTDIR)/$(1)$(HOST_EXT) + @echo "Host Toolchain" > $$@ +endef + +all : $(LIB_LIST) $(DEPS_LIST) $(NMF_LIST) + diff --git a/native_client_sdk/src/tools/host_vc.mk b/native_client_sdk/src/tools/host_vc.mk new file mode 100644 index 0000000..6413c09 --- /dev/null +++ b/native_client_sdk/src/tools/host_vc.mk @@ -0,0 +1,130 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Macros for TOOLS +# +# We use the C++ compiler for everything and then use the -Wl,-as-needed flag +# in the linker to drop libc++ unless it's actually needed. +# +HOST_CC?=cl.exe /nologo /WX +HOST_CXX?=cl.exe /nologo /EHsc /WX +HOST_LINK?=link.exe /nologo +HOST_LIB?=lib.exe /nologo + + +ifeq ('Debug','$(CONFIG)') +WIN_OPT_FLAGS?=/Od /MTd /Z7 +else +WIN_OPT_FLAGS?=/O2 /MT /Z7 +endif + +WIN_FLAGS?=-D WIN32 -D _WIN32 -D PTW32_STATIC_LIB + + +# +# Individual Macros +# +# $1 = Source Name +# $2 = Compile Flags +# +define C_COMPILER_RULE +$(OUTDIR)/$(basename $(1)).o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(HOST_CC) /Fo$$@ /c $$< $(WIN_OPT_FLAGS) $(2) $(WIN_FLAGS) +endef + +define CXX_COMPILER_RULE +$(OUTDIR)/$(basename $(1)).o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(HOST_CXX) /Fo$$@ -c $$< $(WIN_OPT_FLAGS) $(2) $(WIN_FLAGS) +endef + + +# $1 = Source Name +# $2 = POSIX Compile Flags (unused) +# $3 = VC Compile Flags +# +define COMPILE_RULE +ifeq ('.c','$(suffix $(1))') +$(call C_COMPILER_RULE,$(1),$(3) $(foreach inc,$(INC_PATHS),/I$(inc))) +else +$(call CXX_COMPILER_RULE,$(1),$(3) $(foreach inc,$(INC_PATHS),/I$(inc))) +endif +endef + + +# +# LIB Macro +# +# $1 = Target Name +# $2 = List of Sources +# +# +define LIB_RULE +all:$(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/$(1).lib +$(NACL_SDK_ROOT)/lib/$(OSNAME)_host/$(CONFIG)/$(1).lib : $(foreach src,$(2),$(OUTDIR)/$(basename $(src)).o) + $(MKDIR) -p $(dir $$@) + $(HOST_LIB) $$@ $$^ $(WIN_LDFLAGS) +endef + + +# +# Link Macro +# +# $1 = Target Name +# $2 = List of inputs +# $3 = List of libs +# $4 = List of deps +# $5 = List of lib dirs +# $6 = Other Linker Args +# +define LINKER_RULE +all: $(1) +$(1) : $(2) $(4) + $(HOST_LINK) /DLL /OUT:$(1) /PDB:$(1).pdb $(2) /DEBUG $(foreach path,$(5),/LIBPATH:$(path)) $(foreach lib,$(3),$(lib.lib)) $(6) +endef + + +# +# Link Macro +# +# $1 = Target Name +# $2 = List of Sources +# $3 = List of LIBS +# $4 = List of DEPS +# $5 = POSIX Linker Switches +# $6 = VC Linker Switches +# +define LINK_RULE +$(call LINKER_RULE,$(OUTDIR)/$(1)$(HOST_EXT),$(foreach src,$(2),$(OUTDIR)/$(basename $(src)).o),$(3),$(4),$(LIB_PATHS),$(6)) +endef + + +# +# NMF Manifiest generation +# +# Use the python script create_nmf to scan the binaries for dependencies using +# objdump. Pass in the (-L) paths to the default library toolchains so that we +# can find those libraries and have it automatically copy the files (-s) to +# the target directory for us. +# +# $1 = Target Name (the basename of the nmf +# $2 = Additional create_nmf.py arguments +# +NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py + +define NMF_RULE +NMF_LIST+=$(OUTDIR)/$(1).nmf +$(OUTDIR)/$(1).nmf : $(OUTDIR)/$(1)$(HOST_EXT) + @echo "Host Toolchain" > $$@ +endef + +all : $(LIB_LIST) $(DEPS_LIST) $(NMF_LIST) + diff --git a/native_client_sdk/src/tools/nacl_gcc.mk b/native_client_sdk/src/tools/nacl_gcc.mk new file mode 100644 index 0000000..97dddce --- /dev/null +++ b/native_client_sdk/src/tools/nacl_gcc.mk @@ -0,0 +1,202 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Default Paths +# + +LD_X86_32:=-L$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_x86_32/$(CONFIG) +LD_X86_64:=-L$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_x86_64/$(CONFIG) +LD_ARM:=-L$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_arm/$(CONFIG) + + +# +# Macros for TOOLS +# +# We use the C++ compiler for everything and then use the -Wl,-as-needed flag +# in the linker to drop libc++ unless it's actually needed. +# +X86_CC?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-gcc +X86_CXX?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-g++ +X86_LINK?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-g++ -Wl,-as-needed +X86_LIB?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-ar r + +ARM_CC?=$(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-gcc +ARM_CXX?=$(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-g++ +ARM_LINK?=$(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-g++ -Wl,-as-needed +ARM_LIB?=$(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-ar r + + +# +# Compile Macro +# +# $1 = Source Name +# $2 = Compile Flags +# +define C_COMPILER_RULE +$(OUTDIR)/$(basename $(1))_x86_32.o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(X86_CC) -o $$@ -c $$< -m32 $(POSIX_OPT_FLAGS) $(2) $(NACL_CFLAGS) + +$(OUTDIR)/$(basename $(1))_x86_64.o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(X86_CC) -o $$@ -c $$< -m64 $(POSIX_OPT_FLAGS) $(2) $(NACL_CFLAGS) + +$(OUTDIR)/$(basename $(1))_arm.o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(ARM_CC) -o $$@ -c $$< $(POSIX_OPT_FLAGS) $(2) $(NACL_CFLAGS) +endef + +define CXX_COMPILER_RULE +$(OUTDIR)/$(basename $(1))_x86_32.o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(X86_CXX) -o $$@ -c $$< -m32 $(POSIX_OPT_FLAGS) $(2) $(NACL_CXXFLAGS) + +$(OUTDIR)/$(basename $(1))_x86_64.o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(X86_CXX) -o $$@ -c $$< -m64 $(POSIX_OPT_FLAGS) $(2) $(NACL_CXXFLAGS) + +$(OUTDIR)/$(basename $(1))_arm.o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(ARM_CXX) -o $$@ -c $$< $(POSIX_OPT_FLAGS) $(2) $(NACL_CXXFLAGS) +endef + + +# +# $1 = Source Name +# $2 = POSIX Compile Flags +# $3 = Include Directories +# $4 = VC Flags (unused) +# +define COMPILE_RULE +ifeq ('.c','$(suffix $(1))') +$(call C_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc)) $(3)) +else +$(call CXX_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc)) $(3)) +endif +endef + + +# +# SO Macro +# +# $1 = Target Name +# $2 = List of Sources +# +# +GLIBC_REMAP:= +define SO_RULE +NMF_TARGETS+=$$(OUTDIR)/$(1)_x86_32.so +$(OUTDIR)/$(1)_x86_32.so : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_x86_32.o) $(4) + $(X86_LINK) -o $$@ $$(filter-out $(4),$$^) -shared -m32 $$(LD_X86_32) $$(LD_FLAGS) $(foreach lib,$(3),-l$(lib)) + +NMF_TARGETS+=$(OUTDIR)/$(1)_x86_64.so +$(OUTDIR)/$(1)_x86_64.so : $(foreach src,$(2),$$(OUTDIR)/$(basename $(src))_x86_64.o) $(4) + $(X86_LINK) -o $$@ $$(filter-out $(4),$$^) -shared -m64 $(LD_X86_64) $$(LD_FLAGS) $(foreach lib,$(3),-l$(lib)) + +GLIBC_SO_LIST+=$(OUTDIR)/$(1)_x86_32.so $(OUTDIR)/$(1)_x86_64.so +GLIBC_REMAP+=-n $(1)_x86_32.so,$(1).so +GLIBC_REMAP+=-n $(1)_x86_64.so,$(1).so +endef + + +# +# LIB Macro +# +# $1 = Target Name +# $2 = List of Sources +# $3 = POSIX Link Flags +# $4 = VC Link Flags (unused) +# +define LIB_RULE +all: $(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_x86_32/$(CONFIG)/lib$(1).a +$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_x86_32/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_x86_32.o) + $(MKDIR) -p $$(dir $$@) + $(X86_LIB) $$@ $$^ + +all: $(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).a +$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_x86_64.o) + $(MKDIR) -p $$(dir $$@) + $(X86_LIB) $$@ $$^ + +ifneq ('glibc','$(TOOLCHAIN)') +all: $(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_arm/$(CONFIG)/lib$(1).a +endif +$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_arm/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_arm.o) + $(MKDIR) -p $$(dir $$@) + $(ARM_LIB) $$@ $$^ +endef + + +# +# Specific Link Macro +# +# $1 = Target Name +# $2 = List of Sources +# $3 = List of LIBS +# $4 = List of DEPS +# $5 = POSIX Link Flags +# $6 = Library Paths +# +define LINKER_RULE +$(OUTDIR)/$(1)_x86_32.nexe : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_x86_32.o) $(4) + $(X86_LINK) -o $$@ $$(filter-out $(4),$$^) -m32 $(foreach path,$(6),-L$(path)/$(TOOLCHAIN)_x86_32/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(5) + +$(OUTDIR)/$(1)_x86_64.nexe : $(foreach src,$(2),$$(OUTDIR)/$(basename $(src))_x86_64.o) $(4) + $(X86_LINK) -o $$@ $$(filter-out $(4),$$^) -m64 $(foreach path,$(6),-L$(path)/$(TOOLCHAIN)_x86_64/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(5) + +$(OUTDIR)/$(1)_arm.nexe : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_arm.o) $(4) + $(ARM_LINK) -o $$@ $$(filter-out $(4),$$^) $(foreach path,$(6),-L$(path)/$(TOOLCHAIN)_arm/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(5) +endef + + +# +# Generalized Link Macro +# +# $1 = Target Name +# $2 = List of Sources +# $3 = List of LIBS +# $4 = List of DEPS +# $5 = POSIX Linker Switches +# $6 = VC Linker Switches +# +define LINK_RULE +$(call LINKER_RULE,$(1),$(2),$(filter-out pthread,$(3)),$(4),$(5),$(LIB_PATHS)) +endef + + +# +# Generate NMF_TARGETS +# +ARCHES=x86_32 x86_64 +ifeq "newlib" "$(TOOLCHAIN)" +ARCHES+=arm +endif +NMF_ARCHES:=$(foreach arch,$(ARCHES),_$(arch).nexe) + + +# +# NMF Manifiest generation +# +# Use the python script create_nmf to scan the binaries for dependencies using +# objdump. Pass in the (-L) paths to the default library toolchains so that we +# can find those libraries and have it automatically copy the files (-s) to +# the target directory for us. +# +# $1 = Target Name (the basename of the nmf +# $2 = Additional create_nmf.py arguments +# +NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py +GLIBC_DUMP:=$(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/bin/objdump +GLIBC_PATHS:=-L $(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/lib32 +GLIBC_PATHS+=-L $(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/lib + +define NMF_RULE +all:$(OUTDIR)/$(1).nmf +$(OUTDIR)/$(1).nmf : $(foreach arch,$(NMF_ARCHES),$(OUTDIR)/$(1)$(arch)) $(GLIBC_SO_LIST) + $(NMF) -o $$@ $$^ -D $(GLIBC_DUMP) $(GLIBC_PATHS) -s $(OUTDIR) $(2) $(GLIBC_REMAP) +endef + + diff --git a/native_client_sdk/src/tools/nacl_llvm.mk b/native_client_sdk/src/tools/nacl_llvm.mk new file mode 100644 index 0000000..289efc8 --- /dev/null +++ b/native_client_sdk/src/tools/nacl_llvm.mk @@ -0,0 +1,132 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# +# GNU Make based build file. For details on GNU Make see: +# http://www.gnu.org/software/make/manual/make.html +# +# + + +# +# Paths to Tools +# +PNACL_CC?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang -c +PNACL_CXX?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang++ -c +PNACL_LINK?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang++ +PNACL_LIB?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-ar r + + +# +# Compile Macro +# +# $1 = Source Name +# $2 = Compile Flags +# $3 = Include Directories +# +define C_COMPILER_RULE +$(OUTDIR)/$(basename $(1))_pnacl.o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(PNACL_CC) -o $$@ -c $$< $(POSIX_OPT_FLAGS) $(2) $(NACL_CFLAGS) +endef + +define CXX_COMPILER_RULE +$(OUTDIR)/$(basename $(1))_pnacl.o : $(1) $(TOP_MAKE) | $(OUTDIR) + $(PNACL_CXX) -o $$@ -c $$< $(POSIX_OPT_FLAGS) $(2) $(NACL_CFLAGS) +endef + + +# $1 = Source Name +# $2 = POSIX Compile Flags +# $3 = Include Directories +# $4 = VC Flags (unused) +define COMPILE_RULE +ifeq ('.c','$(suffix $(1))') +$(call C_COMPILER_RULE,$(1),$(2) -I$(NACL_SDK_ROOT)/include $(foreach inc,$(3),-I$(inc))) +else +$(call CXX_COMPILER_RULE,$(1),$(2) -I$(NACL_SDK_ROOT)/include $(foreach inc,$(3),-I$(inc))) +endif +endef + + +# +# SO Macro +# +# $1 = Target Name +# $2 = List of Sources +# +# +define SO_RULE +$(error 'Shared libraries not supported by PNaCl') +endef + + +# +# LIB Macro +# +# $1 = Target Name +# $2 = List of Sources +# $3 = POSIX Link Flags +# $4 = VC Link Flags (unused) +define LIB_RULE +all: $(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)/$(CONFIG)/lib$(1).a +$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(OUTDIR)/$(basename $(src))_pnacl.o) + $(MKDIR) -p $$(dir $$@) + $(PNACL_LIB) $$@ $$^ $(3) +endef + + +# +# Specific Link Macro +# +# $1 = Target Name +# $2 = List of inputs +# $3 = List of libs +# $4 = List of deps +# $5 = List of lib dirs +# $6 = Other Linker Args +# +define LINKER_RULE +all: $(1) +$(1) : $(2) $(4) + $(PNACL_LINK) -o $(1) $(2) $(foreach path,$(5),-L$(path)/pnacl/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(6) +endef + + + +# +# Generalized Link Macro +# +# $1 = Target Name +# $2 = List of Sources +# $3 = List of LIBS +# $4 = List of DEPS +# $5 = POSIX Linker Switches +# $6 = VC Linker Switches +# +define LINK_RULE +$(call LINKER_RULE,$(OUTDIR)/$(1).pexe,$(foreach src,$(2),$(OUTDIR)/$(basename $(src))_pnacl.o),$(filter-out pthread,$(3)),$(4),$(LIB_PATHS),$(5)) +endef + + + +# +# NMF Manifiest generation +# +# Use the python script create_nmf to scan the binaries for dependencies using +# objdump. Pass in the (-L) paths to the default library toolchains so that we +# can find those libraries and have it automatically copy the files (-s) to +# the target directory for us. +# +# $1 = Target Name (the basename of the nmf +# $2 = Additional create_nmf.py arguments +# +NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py + +define NMF_RULE +all:$(OUTDIR)/$(1).nmf +$(OUTDIR)/$(1).nmf : $(OUTDIR)/$(1).pexe + $(NMF) -o $$@ $$^ -s $(OUTDIR) $(2) +endef + + |