diff options
author | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-07 06:46:19 +0000 |
---|---|---|
committer | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-07 06:46:19 +0000 |
commit | 7446d88f7b420d554b558cd329a1edfecf998510 (patch) | |
tree | 201a72a1de8a59f1d194e4a5c6070d89355267a2 /native_client_sdk | |
parent | 1577f4ee0cf784587b3fd62b276f81f5e593ae58 (diff) | |
download | chromium_src-7446d88f7b420d554b558cd329a1edfecf998510.zip chromium_src-7446d88f7b420d554b558cd329a1edfecf998510.tar.gz chromium_src-7446d88f7b420d554b558cd329a1edfecf998510.tar.bz2 |
[NaCl SDK] Support multiple configs
Slightly modified from noelallen's codereview.chromium.org/10823177.
My changes: style nits, as well as fixing pnacl builds
original CL description follows:
This CL adds support for Debug and Release configs.
It moves functions that require knowledge of the Makefile to make_rules.py and
keeps functions that require understanding of the DSC files in
generate_make.py.
It adds a 'config' parameter to the embed in common.js.
Updates all index.html files to support the new config parameter.
make_rules.py has been converted to a class. This allows the object to persist
state about the build which allows us to remove knowledge of the make rules
from generate_make.py.
BUG=none
TBR=noelallen@chromium.org
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/10828187
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150289 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
24 files changed, 421 insertions, 325 deletions
diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py index 437fdaf..9b2368d 100755 --- a/native_client_sdk/src/build_tools/build_sdk.py +++ b/native_client_sdk/src/build_tools/build_sdk.py @@ -460,6 +460,10 @@ def BuildStepCopyExamples(pepperdir, toolchains, build_experimental): plat = getos.GetPlatform() for arch in LIB_DICT[plat]: buildbot_common.MakeDir(os.path.join(libdir, '%s_%s_host' % (plat, arch))) + for config in ['Debug', 'Release']: + buildbot_common.MakeDir(os.path.join(libdir, '%s_%s_host' % (plat, arch), + config)) + srcdir = os.path.join(pepperdir, 'src') buildbot_common.RemoveDir(srcdir) diff --git a/native_client_sdk/src/build_tools/generate_make.py b/native_client_sdk/src/build_tools/generate_make.py index d3abb20..ddd95a8 100755 --- a/native_client_sdk/src/build_tools/generate_make.py +++ b/native_client_sdk/src/build_tools/generate_make.py @@ -9,8 +9,7 @@ import optparse import os import sys -from make_rules import BuildDefineList, BuildLibList, BuildToolDict -from make_rules import BuildIncludeList, GetBuildRule, BUILD_RULES +from make_rules import MakeRules, SetVar, GenerateCleanRules, GenerateNMFRules SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR) @@ -24,7 +23,6 @@ PPAPI_DIR = os.path.join(SRC_DIR, 'ppapi') sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) import getos -SUPPORTED_HOSTS = ['win'] def ErrorExit(text): ErrorMsgFunc(text) @@ -45,24 +43,6 @@ def WriteReplaced(srcpath, dstpath, replacements): open(dstpath, 'wb').write(text) -def SetVar(varname, values): - if not values: - return varname + ':=\n' - - line = varname + ':=' - out = '' - for value in values: - if len(line) + len(value) > 78: - out += line[:-1] + '\n' - line = '%s+=%s ' % (varname, value) - else: - line += value + ' ' - - if line: - out += line[:-1] + '\n' - return out - - def GenerateSourceCopyList(desc): sources = [] # Add sources for each target @@ -89,6 +69,14 @@ def GetSourcesDict(sources): return source_map +def GetProjectObjects(source_dict): + object_list = [] + for key in ['.c', '.cc']: + for src in source_dict[key]: + object_list.append(os.path.splitext(src)[0]) + return object_list + + def GetPlatforms(plat_list, plat_filter): platforms = [] for plat in plat_list: @@ -100,7 +88,7 @@ def GetPlatforms(plat_list, plat_filter): def GenerateToolDefaults(desc, tools): defaults = '' for tool in tools: - defaults += BUILD_RULES[tool]['DEFS'] + defaults += MakeRules(tool).BuildDefaults() return defaults @@ -108,130 +96,85 @@ def GenerateSettings(desc, tools): settings = SetVar('VALID_TOOLCHAINS', tools) settings+= 'TOOLCHAIN?=%s\n\n' % tools[0] for target in desc['TARGETS']: - name = target['NAME'] - macro = name.upper() + project = target['NAME'] + macro = project.upper() srcs = GetSourcesDict(target['SOURCES']) - if srcs['.c']: - flags = target.get('CCFLAGS', ['$(NACL_CCFLAGS)']) - settings += SetVar(macro + '_CC', srcs['.c']) - settings += SetVar(macro + '_CCFLAGS', flags) - - if srcs['.cc']: - flags = target.get('CXXFLAGS', ['$(NACL_CXXFLAGS)']) - settings += SetVar(macro + '_CXX', srcs['.cc']) - settings += SetVar(macro + '_CXXFLAGS', flags) + c_flags = target.get('CCFLAGS') + cc_flags = target.get('CXXFLAGS') + ld_flags = target.get('LDFLAGS') - flags = target.get('LDFLAGS', ['$(NACL_LDFLAGS)']) - settings += SetVar(macro + '_LDFLAGS', flags) + if c_flags: + settings += SetVar(macro + '_CCFLAGS', c_flags) + if cc_flags: + settings += SetVar(macro + '_CXXFLAGS', cc_flags) + if ld_flags: + settings += SetVar(macro + '_LDFLAGS', ld_flags) return settings -def GetTarget(tool, targ_type, replace): - pattern = BUILD_RULES[tool]['TOOL'][targ_type] - return Replace(pattern, replace) - - -def GenerateCompile(target, tool, arch, srcs): - """Generates a Compile target. - - For the given target, toolset and architecture, returns a rule to generate - the object files for the set of sources. - - Returns: - Returns a tuple containin the objects and the rule. - """ - rules = '' - name = target['NAME'] - object_sets = [] - - defs = BuildDefineList(tool, target.get('DEFINES', [])) - includes = BuildIncludeList(tool, target.get('INCLUDES', [])) - - if srcs['.c']: - replace = BuildToolDict(tool, name, arch, 'c', - DEFLIST=defs, INCLUDELIST=includes) - compile_rule = GetBuildRule(tool, 'CC') - rules += Replace(compile_rule, replace) - object_sets.append('$(%s)' % replace['<OBJS>']) - - if srcs['.cc']: - replace = BuildToolDict(tool, name, arch, 'cc', - DEFLIST=defs, INCLUDELIST=includes) - compile_rule = GetBuildRule(tool, 'CXX') - rules += Replace(compile_rule, replace) - object_sets.append('$(%s)' % replace['<OBJS>']) - - return (' '.join(object_sets), rules) - - -def GenerateLink(target, tool, arch, objs): - """Generate a Link target. - - Returns: - Returns a tuple containing the rule and target. - """ - targ_type = target['TYPE'] - link_rule = GetBuildRule(tool, targ_type.upper()) - libs = target.get('LIBS', []) - libs = BuildLibList(tool, libs) - replace = BuildToolDict(tool, target['NAME'], arch, 'nexe', - OBJS=objs, LIBLIST=libs) - rule = Replace(link_rule, replace) - target_out = GetTarget(tool, targ_type, replace) - return target_out, rule - - -def GenerateNMF(target, tool): - nmf_rule = BUILD_RULES[tool]['NMF'] - replace = BuildToolDict(tool, target['NAME']) - rule = Replace(nmf_rule, replace) - target_out = GetTarget(tool, 'nmf', replace) - return target_out, rule - - def GenerateRules(desc, tools): all_targets = [] - rules = '' clean = [] + rules = '#\n# Per target object lists\n#\n' + + #Determine which projects are in the NMF files. + main = None + dlls = [] + project_list = [] + glibc_rename = [] + + for target in desc['TARGETS']: + ptype = target['TYPE'].upper() + project = target['NAME'] + project_list.append(project) + srcs = GetSourcesDict(target['SOURCES']) + if ptype == 'MAIN': + main = project + if ptype == 'SO': + dlls.append(project) + for arch in ['x86_32', 'x86_64']: + glibc_rename.append('-n %s_%s.so,%s.so' % (project, arch, project)) + + objects = GetProjectObjects(srcs) + rules += SetVar('%s_OBJS' % project.upper(), objects) + if glibc_rename: + rules += SetVar('GLIBC_REMAP', glibc_rename) + + configs = desc.get('CONFIGS', ['Debug', 'Release']) for tc in tools: - rules += '\n#\n# Rules for %s toolchain\n#\n%s:\n\t$(MKDIR) %s\n' % ( - tc, tc, tc) - main = None - for target in desc['TARGETS']: - name = target['NAME'] - srcs = GetSourcesDict(target['SOURCES']) - for arch in BUILD_RULES[tc]['ARCHES']: - objs, comp_rule = GenerateCompile(target, tc, arch, srcs) - targs, link_rule = GenerateLink(target, tc, arch, objs) - rules += comp_rule + link_rule - clean.append(objs) - if target['TYPE'] == 'lib': - all_targets.append(targs) - - if target['TYPE'] == 'main': - main = target - - if main: - targs, nmf_rule = GenerateNMF(main, tc) - rules += nmf_rule - all_targets.append(targs) - rules += '\n.PHONY : clean\nclean:\n\t$(RM) $(DEPFILES) ' + ' '.join(clean) - rules += '\n\n-include $(DEPFILES)' - return ' '.join(all_targets), rules - - -def GenerateTargets(desc, tools): - targets = [] - rules = '' - for tc in tools: - for target in desc['TARGETS']: - name = target['NAME'] - replace = BuildToolDict(tc, name) - target = GetTarget(tc, target['TYPE'], replace) - if target: - targets.append(target) - return targets + makeobj = MakeRules(tc) + arches = makeobj.GetArches() + rules += makeobj.BuildDirectoryRules(configs) + for cfg in configs: + makeobj.SetConfig(cfg) + for target in desc['TARGETS']: + project = target['NAME'] + ptype = target['TYPE'] + srcs = GetSourcesDict(target['SOURCES']) + objs = GetProjectObjects(srcs) + defs = target.get('DEFINES', []) + incs = target.get('INCLUDES', []) + libs = target.get('LIBS', []) + lpaths = target.get('LIBPATHS', []) + ipaths = target.get('INCPATHS', []) + makeobj.SetProject(project, ptype, defs=defs, incs=incs, libs=libs) + for arch in arches: + makeobj.SetArch(arch) + for src in srcs.get('.c', []): + rules += makeobj.BuildCompileRule('CC', src) + for src in srcs.get('.cc', []): + rules += makeobj.BuildCompileRule('CXX', src) + rules += '\n' + rules += makeobj.BuildObjectList() + rules += makeobj.BuildLinkRule() + if main: + rules += GenerateNMFRules(tc, main, dlls, cfg, arches) + + rules += GenerateCleanRules(tools, configs) + rules += '\nall: $(ALL_TARGETS)\n' + return '', rules + def GenerateReplacements(desc, tools): @@ -246,8 +189,7 @@ def GenerateReplacements(desc, tools): prerun = desc.get('PRE', '') postlaunch = desc.get('POST', '') - targets = GenerateTargets(desc, tools) - target_def = 'all: ' + all_targets + target_def = 'all:' return { '__PROJECT_SETTINGS__' : settings, @@ -263,6 +205,7 @@ def GenerateReplacements(desc, tools): # 'KEY' : ( <TYPE>, [Accepted Values], <Required?>) DSC_FORMAT = { 'TOOLS' : (list, ['newlib', 'glibc', 'pnacl', 'win'], True), + 'CONFIGS' : (list, ['Debug', 'Release'], False), 'PREREQ' : (list, '', False), 'TARGETS' : (list, { 'NAME': (str, '', True), @@ -417,20 +360,26 @@ def IsNexe(desc): def ProcessHTML(srcroot, dstroot, desc, toolchains): name = desc['NAME'] outdir = os.path.join(dstroot, desc['DEST'], name) - srcfile = os.path.join(srcroot, 'index.html') tools = GetPlatforms(toolchains, desc['TOOLS']) + + configs = ['Debug', 'Release'] + for tool in tools: - dstfile = os.path.join(outdir, 'index_%s.html' % tool); - print 'Writting from %s to %s' % (srcfile, dstfile) - replace = { - '<NAME>': name, - '<TITLE>': desc['TITLE'], - '<tc>': tool - } - WriteReplaced(srcfile, dstfile, replace) + for cfg in configs: + dstfile = os.path.join(outdir, 'index_%s_%s.html' % (tool, cfg)) + print 'Writing from %s to %s' % (srcfile, dstfile) + replace = { + '<config>': cfg, + '<NAME>': name, + '<TITLE>': desc['TITLE'], + '<tc>': tool + } + WriteReplaced(srcfile, dstfile, replace) replace['<tc>'] = tools[0] + replace['<config>'] = configs[0] + srcfile = os.path.join(SDK_SRC_DIR, 'build_tools', 'redirect.html') dstfile = os.path.join(outdir, 'index.html') WriteReplaced(srcfile, dstfile, replace) @@ -560,6 +509,7 @@ def main(argv): print 'Using default toolchains: ' + ' '.join(toolchains) master_projects = {} + for filename in args: desc = LoadProject(filename, toolchains) if not desc: diff --git a/native_client_sdk/src/build_tools/make_rules.py b/native_client_sdk/src/build_tools/make_rules.py index ec72402..89d92a7 100755 --- a/native_client_sdk/src/build_tools/make_rules.py +++ b/native_client_sdk/src/build_tools/make_rules.py @@ -3,6 +3,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import os + # # Default macros for various platforms. @@ -13,8 +15,8 @@ NEWLIB_CXX?=$(TC_PATH)/$(OSNAME)_x86_newlib/bin/i686-nacl-g++ -c -std=gnu++98 NEWLIB_LINK?=$(TC_PATH)/$(OSNAME)_x86_newlib/bin/i686-nacl-g++ -Wl,-as-needed NEWLIB_LIB?=$(TC_PATH)/$(OSNAME)_x86_newlib/bin/i686-nacl-ar r NEWLIB_DUMP?=$(TC_PATH)/$(OSNAME)_x86_newlib/x86_64-nacl/bin/objdump -NEWLIB_CCFLAGS?=-O0 -MMD -g -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include -NEWLIB_LDFLAGS?=-g -pthread +NEWLIB_CCFLAGS?=-MMD -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include +NEWLIB_LDFLAGS?=-pthread """ GLIBC_DEFAULTS = """ @@ -25,8 +27,8 @@ GLIBC_LIB?=$(TC_PATH)/$(OSNAME)_x86_glibc/bin/i686-nacl-ar r 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_CCFLAGS?=-O0 -MMD -g -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include -GLIBC_LDFLAGS?=-g -pthread +GLIBC_CCFLAGS?=-MMD -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include +GLIBC_LDFLAGS?=-pthread """ PNACL_DEFAULTS = """ @@ -35,79 +37,72 @@ PNACL_CXX?=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-clang++ -c -std=gnu++ PNACL_LINK?=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-clang++ PNACL_LIB?=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-ar r PNACL_DUMP?=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/objdump -PNACL_CCFLAGS?=-O0 -MMD -g -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include -PNACL_LDFLAGS?=-g -pthread +PNACL_CCFLAGS?=-MMD -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include +PNACL_LDFLAGS?=-pthread TRANSLATE:=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-translate """ WIN_DEFAULTS = """ -WIN_CC?=cl.exe -WIN_CXX?=cl.exe -WIN_LINK?=link.exe -WIN_LIB?=lib.exe +WIN_CC?=cl.exe /nologo +WIN_CXX?=cl.exe /nologo +WIN_LINK?=link.exe /nologo +WIN_LIB?=lib.exe /nologo WIN_CCFLAGS=/I$(NACL_SDK_ROOT)/include /I$(NACL_SDK_ROOT)/include/win -D WIN32 -D _WIN32 -WIN_LDFLAGS=/LIBPATH:$(NACL_SDK_ROOT)/lib/win_x86_32_host """ # # Compile rules for various platforms. # -NACL_CC_RULE = """ -<OBJS>:=$(patsubst %.<ext>, <tc>/%_<ARCH>.o,$(<PROJ>_<EXT>)) -DEPFILES+=$(<OBJS>:.o=.d) -$(<OBJS>) : <tc>/%_<ARCH>.o : %.<ext> $(THIS_MAKE) | <tc> -<TAB>$(<CC>) -o $@ $< <MACH> -DTCNAME=<tc> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLUDELIST> -""" +CC_RULE = '<tc>/<config>/<name>_<ARCH>.o : %.<ext> $(THIS_MAKE) | <tc>/<config>' +NACL_CC_RULES = { + 'Debug': '<TAB>$(<CC>) -o $@ $< -g -O0 <MACH> $(<PROJ>_<EXT>FLAGS) -DTCNAME=<tc> $(<TC>_CCFLAGS) <DEFLIST> <INCLIST>', + 'Release': '<TAB>$(<CC>) -o $@ $< -O2 <MACH> $(<PROJ>_<EXT>FLAGS) -DTCNAME=<tc> $(<TC>_CCFLAGS) <DEFLIST> <INCLIST>', +} -SO_CC_RULE = """ -<OBJS>:=$(patsubst %.<ext>, <tc>/%_<ARCH>.o,$(<PROJ>_<EXT>)) -DEPFILES+=$(<OBJS>:.o=.d) -$(<OBJS>) : <tc>/%_<ARCH>.o : %.<ext> $(THIS_MAKE) | <tc> -<TAB>$(<CC>) -o $@ $< <MACH> -fPIC -DTCNAME=<tc> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLUDELIST> -""" +SO_CC_RULES = { + 'Debug': '<TAB>$(<CC>) -o $@ $< -g -O0 <MACH> -fPIC $(<PROJ>_<EXT>FLAGS) -DTCNAME=<tc> $(<TC>_CCFLAGS) <DEFLIST> <INCLIST>', + 'Release': '<TAB>$(<CC>) -o $@ $< -02 <MACH> -fPIC $(<PROJ>_<EXT>FLAGS) -DTCNAME=<tc> $(<TC>_CCFLAGS) <DEFLIST> <INCLIST>' +} -WIN_CC_RULE = """ -<OBJS>:=$(patsubst %.<ext>, <tc>/%.obj,$(<PROJ>_<EXT>)) -$(<OBJS>) : <tc>/%.obj : %.<ext> $(THIS_MAKE) | <tc> -<TAB>$(<CC>) /Fo$@ /c $< -DTCNAME=host $(WIN_CCFLAGS) <DEFLIST> <INCLUDELIST> -""" +WIN_CC_RULES = { + 'Debug': '<TAB>$(<CC>) /Od /Fo$@ /MTd /c $< -DTCNAME=host $(WIN_CCFLAGS) <DEFLIST> <INCLIST>', + 'Release': '<TAB>$(<CC>) /O2 /Fo$@ /MT /c $< -DTCNAME=host $(WIN_CCFLAGS) <DEFLIST> <INCLIST>' +} # # Link rules for various platforms. # -NEXE_LINK_RULE = """ -<tc>/<proj>_<ARCH>.nexe : <OBJS> -<TAB>$(<LINK>) -o $@ $^ <MACH> $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST> -<TC>_NMF+=<tc>/<proj>_<ARCH>.nexe -""" +NEXE_LINK_RULES = { + 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g <MACH> $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST>', + 'Release': '<TAB>$(<LINK>) -o $@ $^ <MACH> $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST>' +} -PEXE_LINK_RULE = """ -<tc>/<proj>.pexe : <OBJS> -<TAB>$(<LINK>) -o $@ $^ $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST> +SO_LINK_RULES = { + 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g <MACH> -shared $(<PROJ>_LDFLAGS) <LIBLIST>', + 'Release': '<TAB>$(<LINK>) -o $@ $^ <MACH> -shared $(<PROJ>_LDFLAGS) <LIBLIST>', +} -<tc>/<proj>_x86_32.nexe : <tc>/<proj>.pexe -<TAB>$(TRANSLATE) -arch x86-32 $< -o $@ +PEXE_TRANSLATE_RULE = """ +<tc>/<config>/<proj>_x86_32.nexe : <tc>/<config>/<proj>.pexe +<TAB>$(TRANSLATE) -arch x86-32 $< -o $@ -<tc>/<proj>_x86_64.nexe : <tc>/<proj>.pexe -<TAB>$(TRANSLATE) -arch x86-64 $< -o $@ +<tc>/<config>/<proj>_x86_64.nexe : <tc>/<config>/<proj>.pexe +<TAB>$(TRANSLATE) -arch x86-64 $< -o $@ -<tc>/<proj>_arm.nexe : <tc>/<proj>.pexe -<TAB>$(TRANSLATE) -arch arm $< -o $@ -PNACL_NMF:=<tc>/<proj>_x86_32.nexe <tc>/<proj>_x86_64.nexe <tc>/<proj>_arm.nexe -""" +<tc>/<config>/<proj>_arm.nexe : <tc>/<config>/<proj>.pexe +<TAB>$(TRANSLATE) -arch arm $< -o $@""" -SO_LINK_RULE = """ -<tc>/<proj>_<ARCH>.so : <OBJS> -<TAB>$(<LINK>) -o $@ $^ <MACH> -shared $(<PROJ>_LDFLAGS) <LIBLIST> -GLIBC_REMAP+= -n <proj>_<ARCH>.so,<proj>.so -<TC>_NMF+=<tc>/<proj>_<ARCH>.so -""" +PEXE_LINK_RULES = { + 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST>\n' + PEXE_TRANSLATE_RULE, + 'Release': '<TAB>$(<LINK>) -o $@ $^ $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST>\n' + PEXE_TRANSLATE_RULE, +} -WIN_LINK_RULE = """ -win/<proj>.dll : <OBJS> -<TAB>$(<LINK>) /DLL /OUT:$@ $(<PROJ>_<EXT>FLAGS) /LIBPATH:$(NACL_SDK_ROOT)/lib $^ <LIBLIST> $(WIN_LDFLAGS) -<TC>_NMF+=<tc>/<proj>.dll +WIN_LINK_RULES = { + 'Debug': '<TAB>$(<LINK>) /DLL /OUT:$@ $(<PROJ>_LDFLAGS) /LIBPATH:$(NACL_SDK_ROOT)/lib/win_x86_32_host/Debug $^ <LIBLIST> $(WIN_LDFLAGS)', + 'Release': '<TAB>$(<LINK>) /DLL /OUT:$@ $(<PROJ>_LDFLAGS) /LIBPATH:$(NACL_SDK_ROOT)/lib/win_x86_32_host/Release $^ <LIBLIST> $(WIN_LDFLAGS)' +} +WIN_LAUNCH_RULES = """ HOST_ARGS:=--register-pepper-plugins=$(abspath win/<proj>.dll);application/x-nacl LAUNCH_HOST: CHECK_FOR_CHROME all <TAB>$(CHROME_PATH) $(HOST_ARGS) "localhost:5103/index_win.html" @@ -116,35 +111,39 @@ LAUNCH_HOST: CHECK_FOR_CHROME all # # Lib rules for various platforms. # -POSIX_LIB_RULE = """ -$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/lib<proj>.a : <OBJS> -<TAB>$(MKDIR) -p $(dir $@) -<TAB>$(<LIB>) $@ $^ -""" - -WIN_LIB_RULE = """ -$(NACL_SDK_ROOT)/lib/win_<ARCH>_host/<proj>.lib : <OBJS> -<TAB>$(<LIB>) /OUT:$@ $^ $(<PROJ>_<EXT>FLAGS) <LIBLIST> -""" +POSIX_LIB_RULES = { + 'Debug': + '<TAB>$(MKDIR) -p $(dir $@)\n' + '<TAB>$(<LIB>) $@ $^', + 'Release': + '<TAB>$(MKDIR) -p $(dir $@)\n' + '<TAB>$(<LIB>) $@ $^', +} +WIN_LIB_RULES = { + 'Debug': '<TAB>$(<LIB>) /OUT:$@ $^ $(WIN_LDFLAGS) <LIBLIST>', + 'Release': '<TAB>$(<LIB>) /OUT:$@ $^ $(WIN_LDFLAGS) <LIBLIST>' +} +# +# NMF rules for various platforms. +# NMF_RULE = """ -<tc>/<proj>.nmf : $(<TC>_NMF) -<TAB>$(NMF) -D $(<DUMP>) -o $@ $^ -t <tc> -s <tc> +<tc>/<config>/<proj>.nmf : <NMF_TARGETS> +<TAB>$(NMF) -D $(<DUMP>) -o $@ $^ -t <tc> -s <tc>/<config> """ NMF_EMPTY = """ -<tc>/<proj>.nmf : $(<TC>_NMF) | <tc> +<tc>/<config>/<proj>.nmf : <NMF_TARGETS> | <tc>/<config> <TAB>echo {} > $@ """ GLIBC_NMF_RULE = """ -<tc>/<proj>.nmf : $(<TC>_NMF) -<TAB>$(NMF) -D $(<DUMP>) -o $@ $(GLIBC_PATHS) $^ -t <tc> -s <tc> $(<TC>_REMAP) +<tc>/<config>/<proj>.nmf : <NMF_TARGETS> +<TAB>$(NMF) -D $(<DUMP>) -o $@ $(GLIBC_PATHS) $^ -t <tc> -s <tc>/<config> $(GLIBC_REMAP) """ - EXT_MAP = { 'c': 'CC', 'cc': 'CXX' @@ -154,20 +153,33 @@ WIN_TOOL = { 'DEFINE': '-D%s', 'INCLUDE': '/I%s', 'LIBRARY': '%s.lib', - 'main': '<tc>/<proj>.dll', - 'nmf': '<tc>/<proj>.nmf', - 'so': None, - 'lib': '$(NACL_SDK_ROOT)/lib/win_<ARCH>_host/<proj>.lib', + 'MAIN': '<tc>/<config>/<proj>.dll', + 'NMFMAIN': '<tc>/<config>/<proj>.dll', + 'SO': None, + 'LIB': '$(NACL_SDK_ROOT)/lib/win_<ARCH>_host/<config>/<proj>.lib', } NACL_TOOL = { 'DEFINE': '-D%s', 'INCLUDE': '-I%s', 'LIBRARY': '-l%s', - 'main': '<tc>/<proj>_<ARCH>.nexe', - 'nmf': '<tc>/<proj>.nmf', - 'so': '<tc>/<proj>_<ARCH>.so', - 'lib': '$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/lib<proj>.a', + 'MAIN': '<tc>/<config>/<proj>_<ARCH>.nexe', + 'NMFMAIN': '<tc>/<config>/<proj>_<ARCH>.nexe', + 'SO': '<tc>/<config>/<proj>_<ARCH>.so', + 'LIB': '$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/<config>/lib<proj>.a', +} + +PNACL_TOOL = { + 'DEFINE': '-D%s', + 'INCLUDE': '-I%s', + 'LIBRARY': '-l%s', + 'MAIN': '<tc>/<config>/<proj>.pexe', + 'NMFMAIN': + '<tc>/<config>/<proj>_x86_32.nexe ' + '<tc>/<config>/<proj>_x86_64.nexe ' + '<tc>/<config>/<proj>_arm.nexe', + 'SO': None, + 'LIB': '$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/<config>/lib<proj>.a', } @@ -200,104 +212,234 @@ BUILD_RULES = { 'newlib' : { 'ARCHES': [NACL_X86_32, NACL_X86_64], 'DEFS': NEWLIB_DEFAULTS, - 'CC' : NACL_CC_RULE, - 'CXX' : NACL_CC_RULE, + 'CC' : NACL_CC_RULES, + 'CXX' : NACL_CC_RULES, 'NMF' : NMF_RULE, - 'MAIN': NEXE_LINK_RULE, - 'LIB': POSIX_LIB_RULE, + 'MAIN': NEXE_LINK_RULES, + 'LIB': POSIX_LIB_RULES, 'SO' : None, 'TOOL': NACL_TOOL, }, 'glibc' : { 'ARCHES': [NACL_X86_32, NACL_X86_64], 'DEFS': GLIBC_DEFAULTS, - 'CC': NACL_CC_RULE, - 'CXX': NACL_CC_RULE, + 'CC': NACL_CC_RULES, + 'CXX': NACL_CC_RULES, 'NMF' : GLIBC_NMF_RULE, - 'MAIN': NEXE_LINK_RULE, - 'LIB': POSIX_LIB_RULE, - 'SO': SO_LINK_RULE, + 'MAIN': NEXE_LINK_RULES, + 'LIB': POSIX_LIB_RULES, + 'SO': SO_LINK_RULES, 'TOOL': NACL_TOOL, }, 'pnacl' : { 'ARCHES': [NACL_PNACL], 'DEFS': PNACL_DEFAULTS, - 'CC': NACL_CC_RULE, - 'CXX': NACL_CC_RULE, + 'CC': NACL_CC_RULES, + 'CXX': NACL_CC_RULES, 'NMF' : NMF_RULE, - 'MAIN': PEXE_LINK_RULE, - 'LIB': POSIX_LIB_RULE, + 'MAIN': PEXE_LINK_RULES, + 'LIB': POSIX_LIB_RULES, 'SO': None, - 'TOOL': NACL_TOOL + 'TOOL': PNACL_TOOL }, 'win' : { 'ARCHES': [WIN_32], 'DEFS': WIN_DEFAULTS, - 'CC': WIN_CC_RULE, - 'CXX': WIN_CC_RULE, + 'CC': WIN_CC_RULES, + 'CXX': WIN_CC_RULES, 'NMF' : NMF_EMPTY, - 'MAIN': WIN_LINK_RULE, - 'LIB': WIN_LIB_RULE, + 'MAIN': WIN_LINK_RULES, + 'LIB': WIN_LIB_RULES, 'SO': None, 'TOOL': WIN_TOOL } } - -def GetBuildRule(tool, ext): - return BUILD_RULES[tool][ext] - - -def BuildList(tool, key, items): - pattern = BUILD_RULES[tool]['TOOL'][key] - items = [(pattern % name) for name in items] - return ' '.join(items) - -def BuildDefineList(tool, defs): - return BuildList(tool, 'DEFINE', defs) - - -def BuildIncludeList(tool, includes): - return BuildList(tool, 'INCLUDE', includes) - - -def BuildLibList(tool, libs): - return BuildList(tool, 'LIBRARY', libs) - - -def BuildToolDict(toolchain, project, arch = {}, ext='nexe', **kwargs): - tc = toolchain - TC = toolchain.upper() - proj = project - PROJ = proj.upper() - EXT = EXT_MAP.get(ext, ext.upper()) - - replace = { - '<CC>' : '%s_%s' % (TC, EXT), - '<DUMP>': '%s_DUMP' % TC, - '<ext>' : ext, - '<EXT>' : EXT, - '<LIB>': '%s_LIB' % TC, - '<LINK>': '%s_LINK' % TC, - '<proj>': proj, - '<PROJ>': PROJ, - '<TAB>': '\t', - '<tc>' : tc, - '<TC>' : TC - } - - # Add replacements for this platform/architecture - for key in arch: - replace[key] = arch[key] - - # Add other passed in replacements - for key in kwargs: - replace['<%s>' % key] = kwargs[key] - - if '<OBJS>' not in replace: - if replace.get('<ARCH>', ''): - replace['<OBJS>'] = '%s_%s_%s_%s_O' % (TC, PROJ, replace['<ARCH>'], EXT) +class MakeRules(object): + """MakeRules generates Tool, Config, and Arch dependend makefile settings. + + The MakeRules object generates strings used in the makefile based on the + current object settings such as toolchain, configuration, architecture... + It stores settings such as includes, defines, and lists, and converts them + to the appropriate format whenever the toolchain changes. + """ + + def __init__(self, tc, cfg=None, arch=None): + self.tc = tc + self.defines = [] + self.includes = [] + self.libraries = [] + self.vars = { + '<TAB>': '\t', + } + self.SetToolchain(tc) + if cfg: + self.SetConfig(cfg) + if arch: + self.SetArch(arch) + + def _BuildList(self, key, items): + pattern = BUILD_RULES[self.tc]['TOOL'][key] + if pattern and items: + items = [pattern % item for item in items] + return ' '.join(items) + return '' + + def BuildDefaults(self): + return BUILD_RULES[self.tc]['DEFS'] + + def BuildDirectoryRules(self, configs): + tc = self.tc + rules = '\n#\n# Rules for %s toolchain\n#\n%s:\n\t$(MKDIR) %s\n' % ( + tc, tc, tc) + for cfg in configs: + rules += '%s/%s: | %s\n\t$(MKDIR) %s/%s\n' % (tc, cfg, tc, tc, cfg) + + rules += '\n# Include header dependency files.\n' + for cfg in configs: + rules += '-include %s/%s/*.d\n' % (tc, cfg) + return rules + '\n' + + def BuildCompileRule(self, EXT, src): + self.vars['<EXT>'] = EXT + out = '<tc>/<config>/%s_<ARCH>.o : %s $(THIS_MAKE) | <tc>/<config>\n' % ( + os.path.splitext(src)[0], src) + out+= BUILD_RULES[self.tc][EXT][self.cfg] + '\n\n' + return self.Replace(out) + + def BuildLinkRule(self): + target = BUILD_RULES[self.tc]['TOOL'][self.ptype.upper()] + out = '' + if self.ptype == 'lib': + out = 'ALL_TARGETS+=%s\n' % target + out += target + ' : $(<PROJ>_<TC>_<CONFIG>_<ARCH>_O)\n' + out += BUILD_RULES[self.tc][self.ptype.upper()][self.cfg] + '\n\n' + return self.Replace(out) + + def BuildObjectList(self): + obj_list = self.GetObjectList() + sub_str = '$(patsubst %%,%s/%s/%%_%s.o,$(%s_OBJS))' % ( + self.tc, self.cfg, self.arch['<ARCH>'], self.project.upper()) + return '%s:=%s\n' % (obj_list, sub_str) + + def GetArches(self): + return BUILD_RULES[self.tc]['ARCHES'] + + def GetObjectList(self): + return '%s_%s_%s_%s_O' % (self.project.upper(), self.tc.upper(), + self.cfg.upper(), self.arch['<ARCH>']) + + def SetArch(self, arch): + self.arch = arch + for key in arch: + self.vars[key] = arch[key] + + def SetConfig(self, config): + self.cfg = config + self.vars['<config>'] = config + self.vars['<CONFIG>'] = config.upper() + + def SetDefines(self, defs): + self.defines = defs + self.vars['<DEFLIST>'] = self._BuildList('DEFINE', defs) + + def SetIncludes(self, incs): + self.includes = incs + self.vars['<INCLIST>'] = self._BuildList('INCLUDE', incs) + + def SetLibraries(self, libs): + self.libraries = libs + self.vars['<LIBLIST>'] = self._BuildList('LIBRARY', libs) + + def SetProject(self, proj, ptype, defs=None, incs=None, libs=None): + self.project = proj + self.ptype = ptype + self.vars['<proj>'] = proj + self.vars['<PROJ>'] = proj.upper() + self.SetDefines(defs) + self.SetIncludes(incs) + self.SetLibraries(libs) + + def SetSource(self, src): + self.source = source + self.vars['<src>'] = src + + def SetToolchain(self, tc): + TC = tc.upper() + self.vars['<CC>'] = '%s_CC' % TC + self.vars['<CXX>'] = '%s_CXX' % TC + self.vars['<DUMP>'] = '%s_DUMP' % TC + self.vars['<LIB>'] = '%s_LIB' % TC + self.vars['<LINK>'] = '%s_LINK' % TC + self.vars['<tc>'] = tc + self.vars['<TC>'] = TC + self.SetDefines(self.defines) + self.SetIncludes(self.includes) + self.SetLibraries(self.libraries) + + def SetVars(self, **kwargs): + # Add other passed in replacements + for key in kwargs: + self.vars['<%s>' % key] = kwargs[key] + self.var_set = kwargs + + def Replace(self, text): + return Replace(text, self.vars) + + +def Replace(text, replacements): + for key in replacements: + val = replacements[key] + if val is not None: + text = text.replace(key, val) + return text + + +def SetVar(varname, values): + if not values: + return varname + ':=\n' + + line = varname + ':=' + out = '' + for value in values: + if len(line) + len(value) > 78: + out += line[:-1] + '\n' + line = '%s+=%s ' % (varname, value) else: - replace['<OBJS>'] = '%s_%s_%s_O' % (TC, PROJ, EXT) - return replace - + line += value + ' ' + + if line: + out += line[:-1] + '\n' + return out + + +def GenerateCleanRules(tools, configs): + rules = '#\n# Target to remove temporary files\n#\n.PHONY: clean\nclean:\n' + for tc in tools: + for cfg in configs: + rules += '\t$(RM) -fr %s/%s\n' % (tc, cfg) + return rules + '\n' + + +def GenerateNMFRules(tc, main, dlls, cfg, arches): + target = BUILD_RULES[tc]['TOOL']['NMFMAIN'] + dll_target = BUILD_RULES[tc]['TOOL']['SO'] + nmf_targets = [] + + for arch in arches: + replace = { + '<ARCH>' : arch['<ARCH>'], + '<config>' : cfg, + '<DUMP>' : '%s_DUMP' % tc.upper(), + '<TAB>' : '\t', + '<tc>' : tc + } + for dll in dlls: + replace['<proj>'] = dll + nmf_targets.append(Replace(dll_target, replace)) + replace['<proj>'] = main + nmf_targets.append(Replace(target, replace)) + + replace['<NMF_TARGETS>'] = ' '.join(nmf_targets) + rules = Replace(BUILD_RULES[tc]['NMF'], replace) + return '\nALL_TARGETS+=%s/%s/%s.nmf' % (tc, cfg, main) + rules + '\n' diff --git a/native_client_sdk/src/build_tools/redirect.html b/native_client_sdk/src/build_tools/redirect.html index 10d7074..007598b 100644 --- a/native_client_sdk/src/build_tools/redirect.html +++ b/native_client_sdk/src/build_tools/redirect.html @@ -8,9 +8,9 @@ <head> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="-1" /> - <meta http-equiv="Refresh" content="0;url=index_<tc>.html" /> + <meta http-equiv="Refresh" content="0;url=index_<tc>_<config>.html" /> </head> <body> - Redirecting to default example: <tc> + Redirecting to default example: <tc> <config> </body> </html> diff --git a/native_client_sdk/src/examples/common.js b/native_client_sdk/src/examples/common.js index f7df0d8..8c1d132 100644 --- a/native_client_sdk/src/examples/common.js +++ b/native_client_sdk/src/examples/common.js @@ -19,13 +19,13 @@ var common = (function () { * @param {number} width The width to create the plugin. * @param {number} height The height to create the plugin. */ - function createNaClModule(name, tool, width, height) { + function createNaClModule(name, tool, config, width, height) { var moduleEl = document.createElement('embed'); moduleEl.setAttribute('name', 'nacl_module'); moduleEl.setAttribute('id', 'nacl_module'); moduleEl.setAttribute('width', width); moduleEl.setAttribute('height',height); - moduleEl.setAttribute('src', tool + '/' + name + '.nmf'); + moduleEl.setAttribute('src', tool + '/' + config + '/' + name + '.nmf'); moduleEl.setAttribute('type', 'application/x-nacl'); // The <EMBED> element is wrapped inside a <DIV>, which has both a 'load' @@ -148,7 +148,7 @@ var common = (function () { * @param {number} width The width to create the plugin. * @param {number} height The height to create the plugin. */ - function pageDidLoad(name, tool, width, height) { + function pageDidLoad(name, tool, config, width, height) { // If the page loads before the Native Client module loads, then set the // status message indicating that the module is still loading. Otherwise, // do not change the status message. @@ -160,7 +160,7 @@ var common = (function () { // plug-in graphic, if there is a problem. width = typeof width !== 'undefined' ? width : 200; height = typeof height !== 'undefined' ? height : 200; - createNaClModule(name, tool, width, height); + createNaClModule(name, tool, config, width, height); attachDefaultListeners(); } else { // It's possible that the Native Client module onload event fired diff --git a/native_client_sdk/src/examples/debugging/index.html b/native_client_sdk/src/examples/debugging/index.html index ec91c5b..e12a438 100644 --- a/native_client_sdk/src/examples/debugging/index.html +++ b/native_client_sdk/src/examples/debugging/index.html @@ -137,7 +137,7 @@ Chrome executable.</li> <embed name="nacl_module" id="hello_world" width=100 height=100 - src="<tc>/debugging.nmf" + src="<tc>/<config>/debugging.nmf" type="application/x-nacl" /> </div> <hr> diff --git a/native_client_sdk/src/examples/dlopen/index.html b/native_client_sdk/src/examples/dlopen/index.html index e2a2d78..c8de6a5 100644 --- a/native_client_sdk/src/examples/dlopen/index.html +++ b/native_client_sdk/src/examples/dlopen/index.html @@ -27,7 +27,7 @@ found in the LICENSE file. } </script> </head> -<body onload="common.onload('<NAME>', '<tc>')"> +<body onload="common.onload('<NAME>', '<tc>', '<config>')"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <div>Magic eightball: type a question below, press the button, and get a diff --git a/native_client_sdk/src/examples/file_histogram/index.html b/native_client_sdk/src/examples/file_histogram/index.html index f03c0d3..0ebda73 100644 --- a/native_client_sdk/src/examples/file_histogram/index.html +++ b/native_client_sdk/src/examples/file_histogram/index.html @@ -40,7 +40,7 @@ } </script> </head> -<body onload="common.onload('<NAME>', '<tc>', 256, 256)"> +<body onload="common.onload('<NAME>', '<tc>', '<config>', 256, 256)"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <input type="file" id="FileInput" onchange="handleFileInput()" multiple> diff --git a/native_client_sdk/src/examples/file_io/index.html b/native_client_sdk/src/examples/file_io/index.html index db3eaed..4f4f003 100644 --- a/native_client_sdk/src/examples/file_io/index.html +++ b/native_client_sdk/src/examples/file_io/index.html @@ -89,7 +89,7 @@ function(bytes) { common.updateStatus( 'Allocated '+bytes+' bytes of persistant storage.'); - common.createNaClModule('<NAME>', '<tc>', 200, 200); + common.createNaClModule('<NAME>', '<tc>', '<config>', 200, 200); common.attachDefaultListeners(); }, function(e) { alert('Failed to allocate space') }); diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/index.html b/native_client_sdk/src/examples/fullscreen_tumbler/index.html index 45b7f1f..c2db3eb 100644 --- a/native_client_sdk/src/examples/fullscreen_tumbler/index.html +++ b/native_client_sdk/src/examples/fullscreen_tumbler/index.html @@ -27,7 +27,7 @@ found in the LICENSE file. } </script> </head> -<body onload="common.onload('<NAME>', '<tc>', 480, 480)"> +<body onload="common.onload('<NAME>', '<tc>', '<config>', 480, 480)"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <p> diff --git a/native_client_sdk/src/examples/gamepad/index.html b/native_client_sdk/src/examples/gamepad/index.html index c7d902a..8453be2 100644 --- a/native_client_sdk/src/examples/gamepad/index.html +++ b/native_client_sdk/src/examples/gamepad/index.html @@ -11,7 +11,7 @@ found in the LICENSE file. <title><TITLE></title> <script type="text/javascript" src="common.js"></script> </head> -<body onload="common.onload('<NAME>', '<tc>', '800', '200')"> +<body onload="common.onload('<NAME>', '<tc>', '<config>', '800', '200')"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <!-- The NaCl plugin will be embedded inside the element with id "listener". diff --git a/native_client_sdk/src/examples/geturl/index.html b/native_client_sdk/src/examples/geturl/index.html index 7d60f0b..c3c405d 100644 --- a/native_client_sdk/src/examples/geturl/index.html +++ b/native_client_sdk/src/examples/geturl/index.html @@ -40,7 +40,7 @@ found in the LICENSE file. } </script> </head> -<body onload="common.onload('<NAME>', '<tc>')"> +<body onload="common.onload('<NAME>', '<tc>', '<config>')"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <table border=5 cellpadding=5% summary="A title and a result log"> diff --git a/native_client_sdk/src/examples/hello_world/index.html b/native_client_sdk/src/examples/hello_world/index.html index 75546c0..bd067f6 100644 --- a/native_client_sdk/src/examples/hello_world/index.html +++ b/native_client_sdk/src/examples/hello_world/index.html @@ -11,7 +11,7 @@ found in the LICENSE file. <title><TITLE></title> <script type="text/javascript" src="common.js"></script> </head> -<body onload="common.onload('<NAME>', '<tc>')"> +<body onload="common.onload('<NAME>', '<tc>', '<config>')"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <!-- The NaCl plugin will be embedded inside the element with id "listener". diff --git a/native_client_sdk/src/examples/hello_world_gles/index.html b/native_client_sdk/src/examples/hello_world_gles/index.html index 451affb4..435ab50 100644 --- a/native_client_sdk/src/examples/hello_world_gles/index.html +++ b/native_client_sdk/src/examples/hello_world_gles/index.html @@ -11,7 +11,7 @@ found in the LICENSE file. <title><TITLE></title> <script type="text/javascript" src="common.js"></script> </head> -<body onload="common.onload('<NAME>', '<tc>', 640, 480)"> +<body onload="common.onload('<NAME>', '<tc>', '<config>', 640, 480)"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <!-- The NaCl plugin will be embedded inside the element with id "listener". diff --git a/native_client_sdk/src/examples/hello_world_interactive/index.html b/native_client_sdk/src/examples/hello_world_interactive/index.html index 3e6bbe6..f28263f 100644 --- a/native_client_sdk/src/examples/hello_world_interactive/index.html +++ b/native_client_sdk/src/examples/hello_world_interactive/index.html @@ -32,7 +32,7 @@ } </script> </head> -<body onload="common.onload('<NAME>', '<tc>')"> +<body onload="common.onload('<NAME>', '<tc>', '<config>')"> <h1>Native Client Simple Module</h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <!-- The NaCl plugin will be embedded inside the element with id "listener". diff --git a/native_client_sdk/src/examples/input_events/index.html b/native_client_sdk/src/examples/input_events/index.html index 7eb3da5..6323640 100644 --- a/native_client_sdk/src/examples/input_events/index.html +++ b/native_client_sdk/src/examples/input_events/index.html @@ -31,7 +31,7 @@ found in the LICENSE file. } </script> </head> -<body onload="common.onload('<NAME>', '<tc>')"> +<body onload="common.onload('<NAME>', '<tc>', '<config>')"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> diff --git a/native_client_sdk/src/examples/load_progress/index.html b/native_client_sdk/src/examples/load_progress/index.html index 009eb19..fc4811f 100644 --- a/native_client_sdk/src/examples/load_progress/index.html +++ b/native_client_sdk/src/examples/load_progress/index.html @@ -97,7 +97,7 @@ found in the LICENSE file. } </script> </head> -<body onload="common.createNaClModule('<NAME>', '<tc>', 200, 200)"> +<body onload="common.createNaClModule('<NAME>', '<tc>', '<config>',200, 200)"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Event Log</h2> diff --git a/native_client_sdk/src/examples/mouselock/index.html b/native_client_sdk/src/examples/mouselock/index.html index 690aea5..58e2bb0 100644 --- a/native_client_sdk/src/examples/mouselock/index.html +++ b/native_client_sdk/src/examples/mouselock/index.html @@ -11,7 +11,7 @@ found in the LICENSE file. <title><TITLE></title> <script type="text/javascript" src="common.js"></script> </head> -<body onload="common.onload('<NAME>', '<tc>', 300, 300)"> +<body onload="common.onload('<NAME>', '<tc>', '<config>', 300, 300)"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <h1>Full-screen and Mouse-lock Example</h1> diff --git a/native_client_sdk/src/examples/multithreaded_input_events/index.html b/native_client_sdk/src/examples/multithreaded_input_events/index.html index 0647621..aa31a6f 100644 --- a/native_client_sdk/src/examples/multithreaded_input_events/index.html +++ b/native_client_sdk/src/examples/multithreaded_input_events/index.html @@ -40,7 +40,7 @@ found in the LICENSE file. } </script> </head> -<body onload="common.onload('<NAME>', '<tc>')"> +<body onload="common.onload('<NAME>', '<tc>', '<config>')"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <button onclick="cancelQueue()">Kill worker thread and queue</button> diff --git a/native_client_sdk/src/examples/pi_generator/index.html b/native_client_sdk/src/examples/pi_generator/index.html index acc215c..f7a644d 100644 --- a/native_client_sdk/src/examples/pi_generator/index.html +++ b/native_client_sdk/src/examples/pi_generator/index.html @@ -30,7 +30,7 @@ found in the LICENSE file. } </script> </head> -<body onload="common.onload('<NAME>', '<tc>')" onunload="pageDidUnload()"> +<body onload="common.onload('<NAME>', '<tc>', '<config>')" onunload="pageDidUnload()"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <p> diff --git a/native_client_sdk/src/examples/pong/index.html b/native_client_sdk/src/examples/pong/index.html index f41ac5a..91e0979 100644 --- a/native_client_sdk/src/examples/pong/index.html +++ b/native_client_sdk/src/examples/pong/index.html @@ -46,7 +46,7 @@ found in the LICENSE file. function(bytes) { common.updateStatus( 'Allocated '+bytes+' bytes of persistent storage.'); - common.createNaClModule('<NAME>', '<tc>', 800, 600); + common.createNaClModule('<NAME>', '<tc>', '<config>', 800, 600); common.attachDefaultListeners(); }, function(e) { alert('Failed to allocate space'); }); diff --git a/native_client_sdk/src/examples/sine_synth/index.html b/native_client_sdk/src/examples/sine_synth/index.html index 36f5acc..3bc90a7 100644 --- a/native_client_sdk/src/examples/sine_synth/index.html +++ b/native_client_sdk/src/examples/sine_synth/index.html @@ -36,7 +36,7 @@ found in the LICENSE file. } </script> </head> -<body onload="common.onload('<NAME>', '<tc>')"> +<body onload="common.onload('<NAME>', '<tc>', '<config>')"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> diff --git a/native_client_sdk/src/examples/tumbler/index.html b/native_client_sdk/src/examples/tumbler/index.html index 1fcce01..defd1bf 100644 --- a/native_client_sdk/src/examples/tumbler/index.html +++ b/native_client_sdk/src/examples/tumbler/index.html @@ -26,7 +26,7 @@ found in the LICENSE file. } </script> </head> -<body onload="common.onload('<NAME>', '<tc>', 480, 480)"> +<body onload="common.onload('<NAME>', '<tc>', '<config>', 480, 480)"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <p> diff --git a/native_client_sdk/src/examples/websocket/index.html b/native_client_sdk/src/examples/websocket/index.html index c511482..329202c 100644 --- a/native_client_sdk/src/examples/websocket/index.html +++ b/native_client_sdk/src/examples/websocket/index.html @@ -36,7 +36,7 @@ found in the LICENSE file. } </script> </head> -<body onload="common.onload('<NAME>', '<tc>')"> +<body onload="common.onload('<NAME>', '<tc>', '<config>')"> <h1><TITLE></h1> <h2>Status: <code id="statusField">NO-STATUS</code></h2> <div>Set a server URL, then push "Connect" button to establish a connection. |