diff options
author | Torne (Richard Coles) <torne@google.com> | 2013-05-15 11:34:50 +0100 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2013-05-15 11:34:50 +0100 |
commit | a93a17c8d99d686bd4a1511e5504e5e6cc9fcadf (patch) | |
tree | 2fc96923f36ddec68fee218d79dd407c28fa46f8 /native_client_sdk | |
parent | 770489ea635fbf896c1ace4db0d08d6981a2db8b (diff) | |
download | chromium_org-a93a17c8d99d686bd4a1511e5504e5e6cc9fcadf.tar.gz |
Merge from Chromium at DEPS revision r200144
This commit was generated by merge_to_master.py.
Change-Id: I85f3a249ae157fd8253431215fb2dfcd12ee9bf3
Diffstat (limited to 'native_client_sdk')
21 files changed, 288 insertions, 209 deletions
diff --git a/native_client_sdk/src/build_tools/build_projects.py b/native_client_sdk/src/build_tools/build_projects.py index 8e969d5990..185bd2b120 100755 --- a/native_client_sdk/src/build_tools/build_projects.py +++ b/native_client_sdk/src/build_tools/build_projects.py @@ -93,12 +93,12 @@ def UpdateProjects(pepperdir, platform, project_tree, toolchains, if clobber: buildbot_common.RemoveDir(dirpath) buildbot_common.MakeDir(dirpath) - depth = len(branch.split('/')) targets = [desc['NAME'] for desc in projects] # Generate master make for this branch of projects - generate_make.GenerateMasterMakefile(os.path.join(pepperdir, branch), - targets, depth) + generate_make.GenerateMasterMakefile(pepperdir, + os.path.join(pepperdir, branch), + targets) if branch.startswith('examples') and not landing_page: landing_page = LandingPage() @@ -106,8 +106,8 @@ def UpdateProjects(pepperdir, platform, project_tree, toolchains, # Generate individual projects for desc in projects: srcroot = os.path.dirname(desc['FILEPATH']) - generate_make.ProcessProject(srcroot, pepperdir, desc, toolchains, - configs=configs, + generate_make.ProcessProject(pepperdir, srcroot, pepperdir, desc, + toolchains, configs=configs, first_toolchain=first_toolchain) if branch.startswith('examples'): @@ -127,9 +127,9 @@ def UpdateProjects(pepperdir, platform, project_tree, toolchains, targets = ['api', 'demo', 'getting_started', 'tutorial'] targets = [x for x in targets if 'examples/'+x in project_tree] branch_name = 'examples' - depth = len(branch_name.split('/')) - generate_make.GenerateMasterMakefile(os.path.join(pepperdir, branch_name), - targets, depth) + generate_make.GenerateMasterMakefile(pepperdir, + os.path.join(pepperdir, branch_name), + targets) def BuildProjectsBranch(pepperdir, platform, branch, deps=True, clean=False, @@ -147,7 +147,7 @@ def BuildProjectsBranch(pepperdir, platform, branch, deps=True, clean=False, extra_args += ['IGNORE_DEPS=1'] try: - buildbot_common.Run([make, '-j8', 'all_versions'] + extra_args, + buildbot_common.Run([make, '-j8', 'TOOLCHAIN=all'] + extra_args, cwd=make_dir) except: print 'Failed to build ' + branch @@ -155,7 +155,7 @@ def BuildProjectsBranch(pepperdir, platform, branch, deps=True, clean=False, if clean: # Clean to remove temporary files but keep the built - buildbot_common.Run([make, '-j8', 'clean'] + extra_args, + buildbot_common.Run([make, '-j8', 'clean', 'TOOLCHAIN=all'] + extra_args, cwd=make_dir) @@ -222,8 +222,7 @@ def main(args): filters['NAME'] = options.project print 'Filter by name: ' + str(options.project) - project_tree = parse_dsc.LoadProjectTree(SDK_SRC_DIR, verbose=options.verbose, - filters=filters) + project_tree = parse_dsc.LoadProjectTree(SDK_SRC_DIR, filters=filters) parse_dsc.PrintProjectTree(project_tree) UpdateHelpers(pepperdir, platform, clobber=options.clobber) diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py index 3b3b6b2349..0bb7b3ad37 100755 --- a/native_client_sdk/src/build_tools/build_sdk.py +++ b/native_client_sdk/src/build_tools/build_sdk.py @@ -53,7 +53,7 @@ import oshelpers CYGTAR = os.path.join(NACL_DIR, 'build', 'cygtar.py') NACLPORTS_URL = 'https://naclports.googlecode.com/svn/trunk/src' -NACLPORTS_REV = 712 +NACLPORTS_REV = 757 options = None @@ -467,12 +467,7 @@ def GypNinjaBuild_NaCl(platform, rel_out_dir): def GypNinjaBuild_Chrome(arch, rel_out_dir): gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') - out_dir = MakeNinjaRelPath(rel_out_dir) - gyp_file = os.path.join(SRC_DIR, 'ppapi', 'ppapi_untrusted.gyp') - targets = ['ppapi_cpp_lib', 'ppapi_gles2_lib'] - GypNinjaBuild(arch, gyp_py, gyp_file, targets, out_dir) - gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'native_client.gyp') GypNinjaBuild(arch, gyp_py, gyp_file, 'ppapi_lib', out_dir) @@ -536,7 +531,6 @@ def BuildStepBuildToolchains(pepperdir, platform, toolchains): glibcdir = os.path.join(pepperdir, 'toolchain', tcname + '_glibc') pnacldir = os.path.join(pepperdir, 'toolchain', tcname + '_pnacl') - # Run scons TC build steps if set(toolchains) & set(['glibc', 'newlib']): GypNinjaBuild_Chrome('ia32', 'gypbuild') @@ -642,11 +636,12 @@ def BuildStepMakeAll(pepperdir, platform, directory, step_name, if not deps: extra_args += ['IGNORE_DEPS=1'] - buildbot_common.Run([make, '-j8', 'all_versions'] + extra_args, + buildbot_common.Run([make, '-j8', 'TOOLCHAIN=all'] + extra_args, cwd=make_dir) if clean: # Clean to remove temporary files but keep the built libraries. - buildbot_common.Run([make, '-j8', 'clean'] + extra_args, cwd=make_dir) + buildbot_common.Run([make, '-j8', 'clean', 'TOOLCHAIN=all'] + extra_args, + cwd=make_dir) def BuildStepBuildLibraries(pepperdir, platform, directory, clean=True): @@ -784,15 +779,13 @@ def BuildStepBuildNaClPorts(pepper_ver, pepperdir): env = dict(os.environ) env['NACL_SDK_ROOT'] = pepperdir env['NACLPORTS_NO_ANNOTATE'] = "1" + env['NACLPORTS_NO_UPLOAD'] = "1" - build_script = 'build_tools/bots/linux/nacl-linux-sdk-bundle.sh' + build_script = 'build_tools/bots/linux/naclports-linux-sdk-bundle.sh' buildbot_common.BuildStep('Build naclports') buildbot_common.Run([build_script], env=env, cwd=NACLPORTS_DIR) - out_dir = os.path.join(bundle_dir, 'pepper_XX') - out_dir_final = os.path.join(bundle_dir, 'pepper_%s' % pepper_ver) - buildbot_common.RemoveDir(out_dir_final) - buildbot_common.Move(out_dir, out_dir_final) + out_dir = os.path.join(bundle_dir, 'pepper_%s' % pepper_ver) # Some naclports do not include a standalone LICENSE/COPYING file # so we explicitly list those here for inclusion. @@ -800,9 +793,9 @@ def BuildStepBuildNaClPorts(pepper_ver, pepperdir): 'jpeg-8d/README', 'zlib-1.2.3/README') src_root = os.path.join(NACLPORTS_DIR, 'out', 'repository-i686') - output_license = os.path.join(out_dir_final, 'ports', 'LICENSE') + output_license = os.path.join(out_dir, 'ports', 'LICENSE') GenerateNotice(src_root , output_license, extra_licenses) - readme = os.path.join(out_dir_final, 'ports', 'README') + readme = os.path.join(out_dir, 'ports', 'README') oshelpers.Copy(['-v', os.path.join(SDK_SRC_DIR, 'README.naclports'), readme]) diff --git a/native_client_sdk/src/build_tools/generate_make.py b/native_client_sdk/src/build_tools/generate_make.py index 9d3f6eb1c5..9027b32b4d 100644 --- a/native_client_sdk/src/build_tools/generate_make.py +++ b/native_client_sdk/src/build_tools/generate_make.py @@ -161,7 +161,7 @@ def FindAndCopyFiles(src_files, root, search_dirs, dst_dir): buildbot_common.CopyFile(src_file, dst_file) -def ProcessProject(srcroot, dstroot, desc, toolchains, configs=None, +def ProcessProject(pepperdir, srcroot, dstroot, desc, toolchains, configs=None, first_toolchain=False): if not configs: configs = ['Debug', 'Release'] @@ -204,7 +204,6 @@ def ProcessProject(srcroot, dstroot, desc, toolchains, configs=None, RunTemplateFileIfChanged(template, make_path, template_dict) outdir = os.path.dirname(os.path.abspath(make_path)) - pepperdir = os.path.dirname(os.path.dirname(outdir)) AddMakeBat(pepperdir, outdir) if IsExample(desc): @@ -215,23 +214,23 @@ def ProcessProject(srcroot, dstroot, desc, toolchains, configs=None, return (name, desc['DEST']) -def GenerateMasterMakefile(out_path, targets, depth): +def GenerateMasterMakefile(pepperdir, out_path, targets): """Generate a Master Makefile that builds all examples. Args: + pepperdir: NACL_SDK_ROOT out_path: Root for output such that out_path+NAME = full path targets: List of targets names - depth: How deep in from NACL_SDK_ROOT """ in_path = os.path.join(SDK_EXAMPLE_DIR, 'Makefile') out_path = os.path.join(out_path, 'Makefile') + rel_path = os.path.relpath(pepperdir, out_path) template_dict = { 'projects': targets, - 'rel_sdk' : '/'.join(['..'] * depth) + 'rel_sdk' : rel_path, } RunTemplateFileIfChanged(in_path, out_path, template_dict) outdir = os.path.dirname(os.path.abspath(out_path)) - pepperdir = os.path.dirname(outdir) AddMakeBat(pepperdir, outdir) diff --git a/native_client_sdk/src/build_tools/library.mk b/native_client_sdk/src/build_tools/library.mk index 89b18f0f47..2ee3490006 100644 --- a/native_client_sdk/src/build_tools/library.mk +++ b/native_client_sdk/src/build_tools/library.mk @@ -61,3 +61,18 @@ $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),{{flags}}))) # Use the lib macro for this target on the list of sources. # $(eval $(call LIB_RULE,{{name}},$(SOURCES))) + +[[if target['TYPE'] != 'static-lib':]] +ifeq ($(TOOLCHAIN),glibc) +# +# When building with GLIBC, also build a shared object version of the +# library. +# +$(eval $(call SO_RULE,{{name}},$(SOURCES))) +endif +[[]] + +# +# Install the resulting libraries in the SDK library directory. +# +all: install diff --git a/native_client_sdk/src/build_tools/parse_dsc.py b/native_client_sdk/src/build_tools/parse_dsc.py index ec9b968c59..19c220cb43 100644..100755 --- a/native_client_sdk/src/build_tools/parse_dsc.py +++ b/native_client_sdk/src/build_tools/parse_dsc.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # Copyright (c) 2013 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. @@ -22,7 +23,8 @@ DSC_FORMAT = { # lib = library target # so = shared object target, automatically added to NMF # so-standalone = shared object target, not put into NMF - 'TYPE': (str, ['main', 'lib', 'so', 'so-standalone'], True), + 'TYPE': (str, ['main', 'lib', 'static-lib', 'so', 'so-standalone'], + True), 'SOURCES': (list, '', True), 'CCFLAGS': (list, '', False), 'CXXFLAGS': (list, '', False), @@ -50,47 +52,35 @@ DSC_FORMAT = { 'PERMISSIONS': (list, '', False), } -def IgnoreMsgFunc(test): - pass - - -def ErrorMsgFunc(text): - sys.stderr.write(text + '\n') +class ValidationError(Exception): + pass -def ValidateFormat(src, dsc_format, ErrorMsg=ErrorMsgFunc): - failed = False +def ValidateFormat(src, dsc_format): # Verify all required keys are there for key in dsc_format: - (exp_type, exp_value, required) = dsc_format[key] + exp_type, exp_value, required = dsc_format[key] if required and key not in src: - ErrorMsg('Missing required key %s.' % key) - failed = True + raise ValidationError('Missing required key %s.' % key) # For each provided key, verify it's valid for key in src: # Verify the key is known if key not in dsc_format: - ErrorMsg('Unexpected key %s.' % key) - failed = True - continue + raise ValidationError('Unexpected key %s.' % key) exp_type, exp_value, required = dsc_format[key] value = src[key] # Verify the key is of the expected type if exp_type != type(value): - ErrorMsg('Key %s expects %s not %s.' % ( + raise ValidationError('Key %s expects %s not %s.' % ( key, exp_type.__name__.upper(), type(value).__name__.upper())) - failed = True - continue # Verify the value is non-empty if required if required and not value: - ErrorMsg('Expected non-empty value for %s.' % key) - failed = True - continue + raise ValidationError('Expected non-empty value for %s.' % key) # If it's a bool, the expected values are always True or False. if exp_type is bool: @@ -100,8 +90,8 @@ def ValidateFormat(src, dsc_format, ErrorMsg=ErrorMsgFunc): if exp_type is str: if type(exp_value) is list and exp_value: if value not in exp_value: - ErrorMsg("Value '%s' not expected for %s." % (value, key)) - failed = True + raise ValidationError("Value '%s' not expected for %s." % + (value, key)) continue # if it's a list, then we need to validate the values @@ -109,44 +99,35 @@ def ValidateFormat(src, dsc_format, ErrorMsg=ErrorMsgFunc): # If we expect a dictionary, then call this recursively if type(exp_value) is dict: for val in value: - if not ValidateFormat(val, exp_value, ErrorMsg): - failed = True + ValidateFormat(val, exp_value) continue # If we expect a list of strings if type(exp_value) is str: for val in value: if type(val) is not str: - ErrorMsg('Value %s in %s is not a string.' % (val, key)) - failed = True + raise ValidationError('Value %s in %s is not a string.' % + (val, key)) continue # if we expect a particular string if type(exp_value) is list: for val in value: if val not in exp_value: - ErrorMsg('Value %s not expected in %s.' % (val, key)) - failed = True + raise ValidationError('Value %s not expected in %s.' % + (val, key)) continue # If we got this far, it's an unexpected type - ErrorMsg('Unexpected type %s for key %s.' % (str(type(src[key])), key)) - continue - return not failed - + raise ValidationError('Unexpected type %s for key %s.' % + (str(type(src[key])), key)) -def LoadProject(filename, ErrorMsg=ErrorMsgFunc, verbose=False): - if verbose: - errmsg = ErrorMsgFunc - else: - errmsg = IgnoreMsgFunc +def LoadProject(filename): with open(filename, 'r') as descfile: desc = eval(descfile.read(), {}, {}) - if desc.get('DISABLE', False): - return None - if not ValidateFormat(desc, DSC_FORMAT, errmsg): - ErrorMsg('Failed to validate: ' + filename) - return None - desc['FILEPATH'] = os.path.abspath(filename) + if desc.get('DISABLE', False): + return None + ValidateFormat(desc, DSC_FORMAT) + desc['FILEPATH'] = os.path.abspath(filename) return desc @@ -182,15 +163,17 @@ def PruneTree(tree, filters): return out -def LoadProjectTree(srcpath, toolchains=None, verbose=False, filters=None, - ErrorMsg=ErrorMsgFunc, InfoMsg=ErrorMsgFunc): +def LoadProjectTree(srcpath, filters=None): # Build the tree out = collections.defaultdict(list) for root, _, files in os.walk(srcpath): for filename in files: if fnmatch.fnmatch(filename, '*.dsc'): filepath = os.path.join(root, filename) - desc = LoadProject(filepath, ErrorMsg, verbose) + try: + desc = LoadProject(filepath) + except ValidationError as e: + raise ValidationError("Failed to validate: %s: %s" % (filepath, e)) if desc: key = desc['DEST'] out[key].append(desc) @@ -201,7 +184,7 @@ def LoadProjectTree(srcpath, toolchains=None, verbose=False, filters=None, return out -def PrintProjectTree(tree, InfoMsg=ErrorMsgFunc): +def PrintProjectTree(tree): for key in tree: print key + ':' for val in tree[key]: @@ -229,9 +212,13 @@ def main(argv): if not options.experimental: filters['EXPERIMENTAL'] = False - tree = LoadProjectTree('.', filters=filters) - PrintProjectTree(tree) + try: + tree = LoadProjectTree('.', filters=filters) + except ValidationError as e: + sys.stderr.write(str(e) + '\n') + return 1 + PrintProjectTree(tree) return 0 diff --git a/native_client_sdk/src/build_tools/test_sdk.py b/native_client_sdk/src/build_tools/test_sdk.py index bd1223a2f1..34845e7175 100755 --- a/native_client_sdk/src/build_tools/test_sdk.py +++ b/native_client_sdk/src/build_tools/test_sdk.py @@ -75,6 +75,11 @@ def main(args): parser.add_option('--experimental', help='build experimental tests', action='store_true') + if 'NACL_SDK_ROOT' in os.environ: + # We don't want the currently configured NACL_SDK_ROOT to have any effect + # of the build. + del os.environ['NACL_SDK_ROOT'] + options, args = parser.parse_args(args[1:]) platform = getos.GetPlatform() diff --git a/native_client_sdk/src/build_tools/tests/parse_dsc_test.py b/native_client_sdk/src/build_tools/tests/parse_dsc_test.py index c74539fa35..05a86325b1 100755 --- a/native_client_sdk/src/build_tools/tests/parse_dsc_test.py +++ b/native_client_sdk/src/build_tools/tests/parse_dsc_test.py @@ -31,19 +31,14 @@ BASIC_DESC = { } class TestValidateFormat(unittest.TestCase): - def _append_result(self, msg): - self.result += msg - return self.result - - def _validate(self, src, msg): - format = parse_dsc.DSC_FORMAT - self.result = '' - result = parse_dsc.ValidateFormat(src, format, - lambda msg: self._append_result(msg)) - if msg: - self.assertEqual(self.result, msg) - else: - self.assertEqual(result, True) + def _validate(self, src, expected_failure): + try: + parse_dsc.ValidateFormat(src, parse_dsc.DSC_FORMAT) + except parse_dsc.ValidationError as e: + if expected_failure: + self.assertEqual(str(e), expected_failure) + return + raise def testGoodDesc(self): testdesc = copy.deepcopy(BASIC_DESC) @@ -88,11 +83,5 @@ class TestValidateFormat(unittest.TestCase): # TODO(noelallen): Add test which generates a real make and runs it. -def main(): - suite = unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__]) - result = unittest.TextTestRunner(verbosity=2).run(suite) - - return int(not result.wasSuccessful()) - if __name__ == '__main__': - sys.exit(main()) + unittest.main() diff --git a/native_client_sdk/src/examples/Makefile b/native_client_sdk/src/examples/Makefile index 6ca12be8a4..e21cbe814d 100644 --- a/native_client_sdk/src/examples/Makefile +++ b/native_client_sdk/src/examples/Makefile @@ -14,6 +14,10 @@ PROJECTS:= \ HTTPD:={{rel_sdk}}/tools/httpd.py +ifeq ($(TOOLCHAIN),all) +TOOLCHAIN_ARG:=TOOLCHAIN=all +endif + # Define the default target all: @@ -23,41 +27,37 @@ all: # Macro defines a phony target for each example, and adds it to a list of # targets. # +# Note: We use targets for each project (instead of an explicit recipe) so +# each project can be built in parallel. +# define TARGET TARGET_LIST+=$(1)_TARGET .PHONY: $(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: - +$(MAKE) -C $(1) clean + +$(MAKE) -C $(1) $(TOOLCHAIN_ARG) $(MAKECMDGOALS) endef # Define the various targets via the Macro $(foreach proj,$(PROJECTS),$(eval $(call TARGET,$(proj)))) +.PHONY: all all: $(TARGET_LIST) @echo Done building targets. -all_versions: $(VERSIONS_LIST) - @echo Done building all versions. - -clean: $(CLEAN_LIST) +.PHONY: clean +clean: $(TARGET_LIST) @echo Done cleaning targets. +.PHONY: run run: all @echo Starting up python webserver. python $(HTTPD) -# uppercase aliases (for backward compatibility) +# Phony aliases for backward compatibility RUN: run -.PHONY: RUN run +all_versions: + +$(MAKE) TOOLCHAIN=all + +.PHONY: RUN all_versions diff --git a/native_client_sdk/src/examples/api/core/core.cc b/native_client_sdk/src/examples/api/core/core.cc index 59489697f9..031c02fe62 100644 --- a/native_client_sdk/src/examples/api/core/core.cc +++ b/native_client_sdk/src/examples/api/core/core.cc @@ -9,6 +9,12 @@ #include "ppapi/cpp/var.h" #include "ppapi/utility/completion_callback_factory.h" +#ifdef WIN32 +#undef PostMessage +// Allow 'this' in initializer list +#pragma warning(disable : 4355) +#endif + /// The Instance class. One of these exists for each instance of your NaCl /// module on the web page. The browser will ask the Module object to create /// a new Instance for each occurrence of the <embed> tag that has these diff --git a/native_client_sdk/src/examples/api/gamepad/gamepad.cc b/native_client_sdk/src/examples/api/gamepad/gamepad.cc index 5b275ec459..9ab4778e08 100644 --- a/native_client_sdk/src/examples/api/gamepad/gamepad.cc +++ b/native_client_sdk/src/examples/api/gamepad/gamepad.cc @@ -16,6 +16,14 @@ #include "ppapi/cpp/var.h" #include "ppapi/utility/completion_callback_factory.h" +#ifdef WIN32 +#undef min +#undef max + +// Allow 'this' in initializer list +#pragma warning(disable : 4355) +#endif + class GamepadInstance : public pp::Instance { public: explicit GamepadInstance(PP_Instance instance); diff --git a/native_client_sdk/src/examples/demo/nacl_io/handlers.c b/native_client_sdk/src/examples/demo/nacl_io/handlers.c index 97a5df5ef5..5d89f03563 100644 --- a/native_client_sdk/src/examples/demo/nacl_io/handlers.c +++ b/native_client_sdk/src/examples/demo/nacl_io/handlers.c @@ -10,12 +10,18 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> + +#include <sys/types.h> #include <sys/stat.h> #include "nacl_io_demo.h" #define MAX_OPEN_FILES 10 +#if defined(WIN32) +#define stat _stat +#endif + /** * A mapping from int -> FILE*, so the JavaScript messages can refer to an open * File. */ @@ -353,6 +359,8 @@ int HandleStat(int num_params, char** params, char** output) { int file_index; const char* filename; const char* mode; + int result; + struct stat buf; if (num_params != 1) { *output = PrintfToNewString("Error: stat takes 1 parameter."); @@ -361,9 +369,8 @@ int HandleStat(int num_params, char** params, char** output) { filename = params[0]; - struct stat buf; memset(&buf, 0, sizeof(buf)); - int result = stat(filename, &buf); + result = stat(filename, &buf); if (result == -1) { *output = PrintfToNewString("Error: stat returned error %d.", errno); return 2; diff --git a/native_client_sdk/src/examples/demo/pi_generator/pi_generator.cc b/native_client_sdk/src/examples/demo/pi_generator/pi_generator.cc index 6080b0377b..6259f0bb67 100644 --- a/native_client_sdk/src/examples/demo/pi_generator/pi_generator.cc +++ b/native_client_sdk/src/examples/demo/pi_generator/pi_generator.cc @@ -17,6 +17,12 @@ #include "ppapi/cpp/var.h" #include "ppapi/utility/completion_callback_factory.h" +#ifdef WIN32 +#undef PostMessage +// Allow 'this' in initializer list +#pragma warning(disable : 4355) +#endif + namespace { const int kPthreadMutexSuccess = 0; const char* const kPaintMethodId = "paint"; diff --git a/native_client_sdk/src/examples/getting_started/hello_world_ppapi_main/example.dsc b/native_client_sdk/src/examples/getting_started/hello_world_ppapi_main/example.dsc index 2bb125af57..19a2b4173a 100644 --- a/native_client_sdk/src/examples/getting_started/hello_world_ppapi_main/example.dsc +++ b/native_client_sdk/src/examples/getting_started/hello_world_ppapi_main/example.dsc @@ -1,10 +1,10 @@ { - 'TOOLS': ['newlib', 'glibc'], + 'TOOLS': ['newlib', 'glibc', 'pnacl'], 'TARGETS': [ { - 'NAME' : 'hello_world_stdio', - 'TYPE' : 'main', - 'SOURCES' : ['hello_world.c'], + 'NAME': 'hello_world_stdio', + 'TYPE': 'main', + 'SOURCES': ['hello_world.c'], 'LIBS': ['ppapi_main', 'nacl_io', 'ppapi_cpp', 'ppapi', 'pthread'] } ], @@ -16,4 +16,3 @@ 'TITLE': 'Hello World (libppapi_main)', 'GROUP': 'Getting Started' } - diff --git a/native_client_sdk/src/examples/hello_world_instance3d/example.dsc b/native_client_sdk/src/examples/hello_world_instance3d/example.dsc index 243af7ca9e..8dda62375e 100644 --- a/native_client_sdk/src/examples/hello_world_instance3d/example.dsc +++ b/native_client_sdk/src/examples/hello_world_instance3d/example.dsc @@ -25,6 +25,3 @@ 'TITLE': 'Hello World GLES 2.0 using ppapi_instance3d', 'GROUP': 'API' } - - - diff --git a/native_client_sdk/src/examples/tutorial/dlopen/example.dsc b/native_client_sdk/src/examples/tutorial/dlopen/example.dsc index 5282218de6..d7c1ca18c5 100644 --- a/native_client_sdk/src/examples/tutorial/dlopen/example.dsc +++ b/native_client_sdk/src/examples/tutorial/dlopen/example.dsc @@ -8,19 +8,17 @@ 'LIBS': ['nacl_io', 'dl', 'ppapi_cpp', 'ppapi', 'pthread'] }, { - 'NAME' : 'libeightball', + 'NAME' : 'eightball', 'TYPE' : 'so', 'SOURCES' : ['eightball.cc', 'eightball.h'], - 'CXXFLAGS': ['-fPIC'], 'LIBS' : ['ppapi_cpp', 'ppapi', 'pthread'] }, { - 'NAME' : 'libreverse', + 'NAME' : 'reverse', # This .so file is manually loaded by dlopen; we don't want to include it # in the .nmf, or it will be automatically loaded on startup. 'TYPE' : 'so-standalone', 'SOURCES' : ['reverse.cc', 'reverse.h'], - 'CXXFLAGS': ['-fPIC'], 'LIBS' : ['ppapi_cpp', 'ppapi', 'pthread'] } ], diff --git a/native_client_sdk/src/libraries/nacl_io/library.dsc b/native_client_sdk/src/libraries/nacl_io/library.dsc index 8f91bbd8e1..2954618a57 100644 --- a/native_client_sdk/src/libraries/nacl_io/library.dsc +++ b/native_client_sdk/src/libraries/nacl_io/library.dsc @@ -1,6 +1,4 @@ { - # Disabled pnacl for now because it warns on using the language extension - # typeof(...) 'TOOLS': ['newlib', 'glibc', 'pnacl', 'win'], 'SEARCH': [ '.', diff --git a/native_client_sdk/src/libraries/ppapi_main/library.dsc b/native_client_sdk/src/libraries/ppapi_main/library.dsc index 366fde4b6a..c65e93036f 100644 --- a/native_client_sdk/src/libraries/ppapi_main/library.dsc +++ b/native_client_sdk/src/libraries/ppapi_main/library.dsc @@ -2,8 +2,8 @@ 'TOOLS': ['newlib', 'glibc', 'pnacl'], 'TARGETS': [ { - 'NAME' : 'ppapi_main', - 'TYPE' : 'lib', + 'NAME': 'ppapi_main', + 'TYPE': 'static-lib', 'SOURCES' : [ "ppapi_instance.cc", "ppapi_instance2d.cc", diff --git a/native_client_sdk/src/tools/common.mk b/native_client_sdk/src/tools/common.mk index 5042907d79..c3458f6592 100644 --- a/native_client_sdk/src/tools/common.mk +++ b/native_client_sdk/src/tools/common.mk @@ -7,7 +7,6 @@ # http://www.gnu.org/software/make/manual/make.html # - # # Toolchain # @@ -33,6 +32,48 @@ OSNAME:=$(shell $(GETOS)) # +# TOOLCHAIN=all recursively calls this Makefile for all VALID_TOOLCHAINS. +# +ifeq ($(TOOLCHAIN),all) + +# Define the default target +all: + +# +# Generate a new MAKE command for each TOOLCHAIN. +# +# Note: We use targets for each toolchain (instead of an explicit recipe) so +# each toolchain can be built in parallel. +# +# $1 = Toolchain Name +# +define TOOLCHAIN_RULE +TOOLCHAIN_TARGETS += $(1)_TARGET +.PHONY: $(1)_TARGET +$(1)_TARGET: + +$(MAKE) TOOLCHAIN=$(1) $(MAKECMDGOALS) +endef + +# +# The target for all versions +# +USABLE_TOOLCHAINS=$(filter $(OSNAME) newlib glibc pnacl,$(VALID_TOOLCHAINS)) + +ifeq ($(NO_HOST_BUILDS),1) +USABLE_TOOLCHAINS:=$(filter-out $(OSNAME),$(USABLE_TOOLCHAINS)) +endif + +# Define the toolchain targets for all usable toolchains via the macro. +$(foreach tool,$(USABLE_TOOLCHAINS),$(eval $(call TOOLCHAIN_RULE,$(tool)))) + +.PHONY: all clean install +all: $(TOOLCHAIN_TARGETS) +clean: $(TOOLCHAIN_TARGETS) +install: $(TOOLCHAIN_TARGETS) + +else # TOOLCHAIN=all + +# # Verify we selected a valid toolchain for this example # ifeq (,$(findstring $(TOOLCHAIN),$(VALID_TOOLCHAINS))) @@ -145,34 +186,15 @@ endif # the 'all' target. Here we leave it blank to be first, but define it later # all: +.PHONY: all # -# Target a toolchain -# -# $1 = Toolchain Name +# The install target is used to install built libraries to thier final destination. +# By default this is the NaCl SDK 'lib' folder. # -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)) - -ifeq ($(NO_HOST_BUILDS),1) -USABLE_TOOLCHAINS:=$(filter-out $(OSNAME),$(USABLE_TOOLCHAINS)) -endif - -$(foreach tool,$(USABLE_TOOLCHAINS),$(eval $(call TOOLCHAIN_RULE,$(tool),$(dep)))) - -.PHONY: all_versions -all_versions: $(TOOLCHAIN_LIST) +install: +.PHONY: install OUTBASE?=. @@ -212,7 +234,7 @@ clean: # define DEPEND_RULE ifndef $(IGNORE_DEPS) -.PHONY : rebuild_$(1) +.PHONY: rebuild_$(1) rebuild_$(1) :| $(STAMPDIR)/dir.stamp ifeq (,$(2)) @@ -226,7 +248,7 @@ $(STAMPDIR)/$(1).stamp : rebuild_$(1) else -.PHONY : $(STAMPDIR)/$(1).stamp +.PHONY: $(STAMPDIR)/$(1).stamp $(STAMPDIR)/$(1).stamp : @echo Ignore $(1) endif @@ -418,3 +440,5 @@ CHECK_FOR_CHROME: check_for_chrome DEBUG: debug LAUNCH: run RUN: run + +endif # TOOLCHAIN=all diff --git a/native_client_sdk/src/tools/host_gcc.mk b/native_client_sdk/src/tools/host_gcc.mk index 702c633dae..2a099aa94c 100644 --- a/native_client_sdk/src/tools/host_gcc.mk +++ b/native_client_sdk/src/tools/host_gcc.mk @@ -18,7 +18,7 @@ HOST_CC?=gcc HOST_CXX?=g++ HOST_LINK?=g++ -HOST_LIB?=ar r +HOST_LIB?=ar HOST_STRIP?=strip ifeq (,$(findstring gcc,$(shell $(WHICH) gcc))) @@ -41,13 +41,13 @@ LINUX_CCFLAGS=-fPIC -pthread $(LINUX_WARNINGS) -I$(NACL_SDK_ROOT)/include -I$(NA define C_COMPILER_RULE -include $(call SRC_TO_DEP,$(1)) $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CC,$$@,$(HOST_CC) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(LINUX_FLAGS)) + $(call LOG,CC ,$$@,$(HOST_CC) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(LINUX_FLAGS)) endef define CXX_COMPILER_RULE -include $(call SRC_TO_DEP,$(1)) $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CXX,$$@,$(HOST_CXX) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(LINUX_FLAGS)) + $(call LOG,CXX ,$$@,$(HOST_CXX) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(LINUX_FLAGS)) endef @@ -90,7 +90,7 @@ $(STAMPDIR)/$(1).stamp: $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a all: $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(call SRC_TO_OBJ,$(src))) $(MKDIR) -p $$(dir $$@) - $(call LOG,LIB,$$@,$(HOST_LIB) $$@ $$^) + $(call LOG,LIB,$$@,$(HOST_LIB) -cr $$@ $$^) endef diff --git a/native_client_sdk/src/tools/nacl_gcc.mk b/native_client_sdk/src/tools/nacl_gcc.mk index d73a9f793d..0c7aaf1431 100644 --- a/native_client_sdk/src/tools/nacl_gcc.mk +++ b/native_client_sdk/src/tools/nacl_gcc.mk @@ -64,29 +64,53 @@ ARM_CXXFLAGS?=-DNACL_ARCH=arm define C_COMPILER_RULE -include $(call SRC_TO_DEP,$(1),_x86_32) $(call SRC_TO_OBJ,$(1),_x86_32): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CC,$$@,$(X86_32_CC) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS) $(X86_32_CFLAGS)) + $(call LOG,CC ,$$@,$(X86_32_CC) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS) $(X86_32_CFLAGS)) -include $(call SRC_TO_DEP,$(1),_x86_64) $(call SRC_TO_OBJ,$(1),_x86_64): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CC,$$@,$(X86_64_CC) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS) $(X86_64_CFLAGS)) + $(call LOG,CC ,$$@,$(X86_64_CC) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS) $(X86_64_CFLAGS)) -include $(call SRC_TO_DEP,$(1),_arm) $(call SRC_TO_OBJ,$(1),_arm): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CC,$$@,$(ARM_CC) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS) $(ARM_CFLAGS)) + $(call LOG,CC ,$$@,$(ARM_CC) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS) $(ARM_CFLAGS)) + +-include $(call SRC_TO_DEP,$(1),_x86_32_pic) +$(call SRC_TO_OBJ,$(1),_x86_32_pic): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp + $(call LOG,CC ,$$@,$(X86_32_CC) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(NACL_CFLAGS) $(X86_32_CFLAGS)) + +-include $(call SRC_TO_DEP,$(1),_x86_64_pic) +$(call SRC_TO_OBJ,$(1),_x86_64_pic): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp + $(call LOG,CC ,$$@,$(X86_64_CC) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(NACL_CFLAGS) $(X86_64_CFLAGS)) + +-include $(call SRC_TO_DEP,$(1),_arm_pic) +$(call SRC_TO_OBJ,$(1),_arm_pic): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp + $(call LOG,CC ,$$@,$(ARM_CC) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(NACL_CFLAGS) $(ARM_CFLAGS)) endef define CXX_COMPILER_RULE -include $(call SRC_TO_DEP,$(1),_x86_32) $(call SRC_TO_OBJ,$(1),_x86_32): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CXX,$$@,$(X86_32_CXX) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CXXFLAGS) $(X86_32_CXXFLAGS)) + $(call LOG,CXX ,$$@,$(X86_32_CXX) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CXXFLAGS) $(X86_32_CXXFLAGS)) -include $(call SRC_TO_DEP,$(1),_x86_64) $(call SRC_TO_OBJ,$(1),_x86_64): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CXX,$$@,$(X86_64_CXX) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CXXFLAGS) $(X86_64_CXXFLAGS)) + $(call LOG,CXX ,$$@,$(X86_64_CXX) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CXXFLAGS) $(X86_64_CXXFLAGS)) -include $(call SRC_TO_DEP,$(1),_arm) $(call SRC_TO_OBJ,$(1),_arm): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CXX,$$@,$(ARM_CXX) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CXXFLAGS) $(ARM_CXXFLAGS)) + $(call LOG,CXX ,$$@,$(ARM_CXX) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CXXFLAGS) $(ARM_CXXFLAGS)) + +-include $(call SRC_TO_DEP,$(1),_x86_32_pic) +$(call SRC_TO_OBJ,$(1),_x86_32_pic): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp + $(call LOG,CXX ,$$@,$(X86_32_CXX) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(NACL_CXXFLAGS) $(X86_32_CXXFLAGS)) + +-include $(call SRC_TO_DEP,$(1),_x86_64_pic) +$(call SRC_TO_OBJ,$(1),_x86_64_pic): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp + $(call LOG,CXX ,$$@,$(X86_64_CXX) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(NACL_CXXFLAGS) $(X86_64_CXXFLAGS)) + +-include $(call SRC_TO_DEP,$(1),_arm_pic) +$(call SRC_TO_OBJ,$(1),_arm_pic): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp + $(call LOG,CXX ,$$@,$(ARM_CXX) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(2) $(NACL_CXXFLAGS) $(ARM_CXXFLAGS)) endef @@ -104,7 +128,6 @@ $(call CXX_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc)) $(3)) endif endef - # # SO Macro # @@ -114,23 +137,30 @@ endef # $4 = List of DEPS # $5 = 1 => Don't add to NMF. # -# GLIBC_REMAP:= define SO_RULE -NMF_TARGETS+=$$(OUTDIR)/$(1)_x86_32.so -$(OUTDIR)/$(1)_x86_32.so : $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_x86_32)) $(4) - $(call LOG,LINK,$$@,$(X86_32_LINK) -o $$@ $$(filter-out $(4),$$^) -shared -m32 $$(LD_X86_32) $$(LD_FLAGS) $(foreach lib,$(3),-l$(lib))) +all: $(OUTDIR)/lib$(1)_x86_32.so +$(OUTDIR)/lib$(1)_x86_32.so: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_x86_32_pic)) $(4) + $(call LOG,LINK,$$@,$(X86_32_LINK) -o $$@ $$(filter-out $(4),$$^) -shared -m32 $(LD_X86_32) $$(LD_FLAGS) $(foreach lib,$(3),-l$(lib))) + +install: $(LIBDIR)/$(TOOLCHAIN)_x86_32/$(CONFIG)/lib$(1).so +$(LIBDIR)/$(TOOLCHAIN)_x86_32/$(CONFIG)/lib$(1).so: $(OUTDIR)/lib$(1)_x86_32.so + $(MKDIR) -p $$(dir $$@) + $(call LOG,CP ,$$@,$(OSHELPERS) cp $$^ $$@) -NMF_TARGETS+=$(OUTDIR)/$(1)_x86_64.so -$(OUTDIR)/$(1)_x86_64.so : $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_x86_64)) $(4) +all: $(OUTDIR)/lib$(1)_x86_64.so +$(OUTDIR)/lib$(1)_x86_64.so: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_x86_64_pic)) $(4) $(call LOG,LINK,$$@,$(X86_32_LINK) -o $$@ $$(filter-out $(4),$$^) -shared -m64 $(LD_X86_64) $$(LD_FLAGS) $(foreach lib,$(3),-l$(lib))) -ifneq (1,$(5)) -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 -else -all: $(OUTDIR)/$(1)_x86_32.so $(OUTDIR)/$(1)_x86_64.so +install: $(LIBDIR)/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).so +$(LIBDIR)/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).so: $(OUTDIR)/lib$(1)_x86_64.so + $(MKDIR) -p $$(dir $$@) + $(call LOG,CP ,$$@,$(OSHELPERS) cp $$^ $$@) + +ifneq ($(5),1) +GLIBC_SO_LIST+=$(OUTDIR)/lib$(1)_x86_32.so $(OUTDIR)/lib$(1)_x86_64.so +GLIBC_REMAP+=-n lib$(1)_x86_32.so,lib$(1).so +GLIBC_REMAP+=-n lib$(1)_x86_64.so,lib$(1).so endif endef @@ -144,31 +174,47 @@ endef # $4 = VC Link Flags (unused) # define LIB_RULE -$(STAMPDIR)/$(1).stamp : $(LIBDIR)/$(TOOLCHAIN)_x86_32/$(CONFIG)/lib$(1).a -$(STAMPDIR)/$(1).stamp : $(LIBDIR)/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).a -ifneq ('glibc','$(TOOLCHAIN)') -$(STAMPDIR)/$(1).stamp : $(LIBDIR)/$(TOOLCHAIN)_arm/$(CONFIG)/lib$(1).a +$(STAMPDIR)/$(1).stamp : $(OUTDIR)/lib$(1)_x86_32.a +$(STAMPDIR)/$(1).stamp : $(OUTDIR)/lib$(1)_x86_64.a +ifneq ($(TOOLCHAIN),glibc) +$(STAMPDIR)/$(1).stamp : $(OUTDIR)/lib$(1)_arm.a endif $(STAMPDIR)/$(1).stamp : @echo "TOUCHED $$@" > $(STAMPDIR)/$(1).stamp -all: $(LIBDIR)/$(TOOLCHAIN)_x86_32/$(CONFIG)/lib$(1).a -$(LIBDIR)/$(TOOLCHAIN)_x86_32/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_x86_32)) + +all: $(OUTDIR)/lib$(1)_x86_32.a +$(OUTDIR)/lib$(1)_x86_32.a: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_x86_32)) $(MKDIR) -p $$(dir $$@) - $(call LOG,LIB,$$@,$(X86_32_LIB) -r $$@ $$^) + $(call LOG,LIB ,$$@,$(X86_32_LIB) -cr $$@ $$^) -all: $(LIBDIR)/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).a -$(LIBDIR)/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_x86_64)) +install: $(LIBDIR)/$(TOOLCHAIN)_x86_32/$(CONFIG)/lib$(1).a +$(LIBDIR)/$(TOOLCHAIN)_x86_32/$(CONFIG)/lib$(1).a: $(OUTDIR)/lib$(1)_x86_32.a $(MKDIR) -p $$(dir $$@) - $(call LOG,LIB,$$@,$(X86_64_LIB) -r $$@ $$^) + $(call LOG,CP ,$$@,$(OSHELPERS) cp $$^ $$@) -ifneq ('glibc','$(TOOLCHAIN)') -all: $(LIBDIR)/$(TOOLCHAIN)_arm/$(CONFIG)/lib$(1).a -endif -$(LIBDIR)/$(TOOLCHAIN)_arm/$(CONFIG)/lib$(1).a : $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_arm)) +all: $(OUTDIR)/lib$(1)_x86_64.a +$(OUTDIR)/lib$(1)_x86_64.a: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_x86_64)) $(MKDIR) -p $$(dir $$@) - $(call LOG,LIB,$$@,$(ARM_LIB) -r $$@ $$^) + $(call LOG,LIB ,$$@,$(X86_64_LIB) -cr $$@ $$^) + +install: $(LIBDIR)/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).a +$(LIBDIR)/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).a: $(OUTDIR)/lib$(1)_x86_64.a + $(MKDIR) -p $$(dir $$@) + $(call LOG,CP ,$$@,$(OSHELPERS) cp $$^ $$@) + +ifneq ($(TOOLCHAIN),glibc) +all: $(OUTDIR)/lib$(1)_arm.a +$(OUTDIR)/lib$(1)_arm.a: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_arm)) + $(MKDIR) -p $$(dir $$@) + $(call LOG,LIB ,$$@,$(ARM_LIB) -cr $$@ $$^) + +install: $(LIBDIR)/$(TOOLCHAIN)_arm/$(CONFIG)/lib$(1).a +$(LIBDIR)/$(TOOLCHAIN)_arm/$(CONFIG)/lib$(1).a: $(OUTDIR)/lib$(1)_arm.a + $(MKDIR) -p $$(dir $$@) + $(call LOG,CP ,$$@,$(OSHELPERS) cp $$^ $$@) +endif endef @@ -289,7 +335,7 @@ endif # -# Generate NMF_TARGETS +# Generate NMF_ARCHES # NMF_ARCHES:=$(foreach arch,$(ARCHES),_$(arch).nexe) @@ -307,8 +353,11 @@ NMF_ARCHES:=$(foreach arch,$(ARCHES),_$(arch).nexe) # 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 +GLIBC_PATHS:=-L$(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/lib32 +GLIBC_PATHS+=-L$(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/lib +GLIBC_PATHS+=-L$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_x86_64/$(CONFIG) +GLIBC_PATHS+=-L$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_x86_32/$(CONFIG) + define NMF_RULE all:$(OUTDIR)/$(1).nmf diff --git a/native_client_sdk/src/tools/nacl_llvm.mk b/native_client_sdk/src/tools/nacl_llvm.mk index bc16169b38..ec9832ad6d 100644 --- a/native_client_sdk/src/tools/nacl_llvm.mk +++ b/native_client_sdk/src/tools/nacl_llvm.mk @@ -28,13 +28,13 @@ PNACL_STRIP?=$(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-finalize define C_COMPILER_RULE -include $(call SRC_TO_DEP,$(1),_pnacl) $(call SRC_TO_OBJ,$(1),_pnacl): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CC,$$@,$(PNACL_CC) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS)) + $(call LOG,CC ,$$@,$(PNACL_CC) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS)) endef define CXX_COMPILER_RULE -include $(call SRC_TO_DEP,$(1)) $(call SRC_TO_OBJ,$(1),_pnacl): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.stamp - $(call LOG,CXX,$$@,$(PNACL_CXX) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS)) + $(call LOG,CXX ,$$@,$(PNACL_CXX) -o $$@ -c $$< $(POSIX_FLAGS) $(2) $(NACL_CFLAGS)) endef |