Commit 7446d88f authored by binji@chromium.org's avatar binji@chromium.org

[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
parent 1577f4ee
...@@ -460,6 +460,10 @@ def BuildStepCopyExamples(pepperdir, toolchains, build_experimental): ...@@ -460,6 +460,10 @@ def BuildStepCopyExamples(pepperdir, toolchains, build_experimental):
plat = getos.GetPlatform() plat = getos.GetPlatform()
for arch in LIB_DICT[plat]: for arch in LIB_DICT[plat]:
buildbot_common.MakeDir(os.path.join(libdir, '%s_%s_host' % (plat, arch))) 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') srcdir = os.path.join(pepperdir, 'src')
buildbot_common.RemoveDir(srcdir) buildbot_common.RemoveDir(srcdir)
......
...@@ -9,8 +9,7 @@ import optparse ...@@ -9,8 +9,7 @@ import optparse
import os import os
import sys import sys
from make_rules import BuildDefineList, BuildLibList, BuildToolDict from make_rules import MakeRules, SetVar, GenerateCleanRules, GenerateNMFRules
from make_rules import BuildIncludeList, GetBuildRule, BUILD_RULES
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR) SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR)
...@@ -24,7 +23,6 @@ PPAPI_DIR = os.path.join(SRC_DIR, 'ppapi') ...@@ -24,7 +23,6 @@ PPAPI_DIR = os.path.join(SRC_DIR, 'ppapi')
sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) sys.path.append(os.path.join(SDK_SRC_DIR, 'tools'))
import getos import getos
SUPPORTED_HOSTS = ['win']
def ErrorExit(text): def ErrorExit(text):
ErrorMsgFunc(text) ErrorMsgFunc(text)
...@@ -45,24 +43,6 @@ def WriteReplaced(srcpath, dstpath, replacements): ...@@ -45,24 +43,6 @@ def WriteReplaced(srcpath, dstpath, replacements):
open(dstpath, 'wb').write(text) 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): def GenerateSourceCopyList(desc):
sources = [] sources = []
# Add sources for each target # Add sources for each target
...@@ -89,6 +69,14 @@ def GetSourcesDict(sources): ...@@ -89,6 +69,14 @@ def GetSourcesDict(sources):
return source_map 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): def GetPlatforms(plat_list, plat_filter):
platforms = [] platforms = []
for plat in plat_list: for plat in plat_list:
...@@ -100,7 +88,7 @@ def GetPlatforms(plat_list, plat_filter): ...@@ -100,7 +88,7 @@ def GetPlatforms(plat_list, plat_filter):
def GenerateToolDefaults(desc, tools): def GenerateToolDefaults(desc, tools):
defaults = '' defaults = ''
for tool in tools: for tool in tools:
defaults += BUILD_RULES[tool]['DEFS'] defaults += MakeRules(tool).BuildDefaults()
return defaults return defaults
...@@ -108,130 +96,85 @@ def GenerateSettings(desc, tools): ...@@ -108,130 +96,85 @@ def GenerateSettings(desc, tools):
settings = SetVar('VALID_TOOLCHAINS', tools) settings = SetVar('VALID_TOOLCHAINS', tools)
settings+= 'TOOLCHAIN?=%s\n\n' % tools[0] settings+= 'TOOLCHAIN?=%s\n\n' % tools[0]
for target in desc['TARGETS']: for target in desc['TARGETS']:
name = target['NAME'] project = target['NAME']
macro = name.upper() macro = project.upper()
srcs = GetSourcesDict(target['SOURCES']) srcs = GetSourcesDict(target['SOURCES'])
if srcs['.c']: c_flags = target.get('CCFLAGS')
flags = target.get('CCFLAGS', ['$(NACL_CCFLAGS)']) cc_flags = target.get('CXXFLAGS')
settings += SetVar(macro + '_CC', srcs['.c']) ld_flags = target.get('LDFLAGS')
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)
flags = target.get('LDFLAGS', ['$(NACL_LDFLAGS)']) if c_flags:
settings += SetVar(macro + '_LDFLAGS', 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 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): def GenerateRules(desc, tools):
all_targets = [] all_targets = []
rules = ''
clean = [] clean = []
for tc in tools: rules = '#\n# Per target object lists\n#\n'
rules += '\n#\n# Rules for %s toolchain\n#\n%s:\n\t$(MKDIR) %s\n' % (
tc, tc, tc) #Determine which projects are in the NMF files.
main = None main = None
dlls = []
project_list = []
glibc_rename = []
for target in desc['TARGETS']: for target in desc['TARGETS']:
name = target['NAME'] ptype = target['TYPE'].upper()
project = target['NAME']
project_list.append(project)
srcs = GetSourcesDict(target['SOURCES']) srcs = GetSourcesDict(target['SOURCES'])
for arch in BUILD_RULES[tc]['ARCHES']: if ptype == 'MAIN':
objs, comp_rule = GenerateCompile(target, tc, arch, srcs) main = project
targs, link_rule = GenerateLink(target, tc, arch, objs) if ptype == 'SO':
rules += comp_rule + link_rule dlls.append(project)
clean.append(objs) for arch in ['x86_32', 'x86_64']:
if target['TYPE'] == 'lib': glibc_rename.append('-n %s_%s.so,%s.so' % (project, arch, project))
all_targets.append(targs)
objects = GetProjectObjects(srcs)
if target['TYPE'] == 'main': rules += SetVar('%s_OBJS' % project.upper(), objects)
main = target if glibc_rename:
rules += SetVar('GLIBC_REMAP', glibc_rename)
configs = desc.get('CONFIGS', ['Debug', 'Release'])
for tc in tools:
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: if main:
targs, nmf_rule = GenerateNMF(main, tc) rules += GenerateNMFRules(tc, main, dlls, cfg, arches)
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
rules += GenerateCleanRules(tools, configs)
rules += '\nall: $(ALL_TARGETS)\n'
return '', 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
def GenerateReplacements(desc, tools): def GenerateReplacements(desc, tools):
...@@ -246,8 +189,7 @@ def GenerateReplacements(desc, tools): ...@@ -246,8 +189,7 @@ def GenerateReplacements(desc, tools):
prerun = desc.get('PRE', '') prerun = desc.get('PRE', '')
postlaunch = desc.get('POST', '') postlaunch = desc.get('POST', '')
targets = GenerateTargets(desc, tools) target_def = 'all:'
target_def = 'all: ' + all_targets
return { return {
'__PROJECT_SETTINGS__' : settings, '__PROJECT_SETTINGS__' : settings,
...@@ -263,6 +205,7 @@ def GenerateReplacements(desc, tools): ...@@ -263,6 +205,7 @@ def GenerateReplacements(desc, tools):
# 'KEY' : ( <TYPE>, [Accepted Values], <Required?>) # 'KEY' : ( <TYPE>, [Accepted Values], <Required?>)
DSC_FORMAT = { DSC_FORMAT = {
'TOOLS' : (list, ['newlib', 'glibc', 'pnacl', 'win'], True), 'TOOLS' : (list, ['newlib', 'glibc', 'pnacl', 'win'], True),
'CONFIGS' : (list, ['Debug', 'Release'], False),
'PREREQ' : (list, '', False), 'PREREQ' : (list, '', False),
'TARGETS' : (list, { 'TARGETS' : (list, {
'NAME': (str, '', True), 'NAME': (str, '', True),
...@@ -417,13 +360,17 @@ def IsNexe(desc): ...@@ -417,13 +360,17 @@ def IsNexe(desc):
def ProcessHTML(srcroot, dstroot, desc, toolchains): def ProcessHTML(srcroot, dstroot, desc, toolchains):
name = desc['NAME'] name = desc['NAME']
outdir = os.path.join(dstroot, desc['DEST'], name) outdir = os.path.join(dstroot, desc['DEST'], name)
srcfile = os.path.join(srcroot, 'index.html') srcfile = os.path.join(srcroot, 'index.html')
tools = GetPlatforms(toolchains, desc['TOOLS']) tools = GetPlatforms(toolchains, desc['TOOLS'])
configs = ['Debug', 'Release']
for tool in tools: for tool in tools:
dstfile = os.path.join(outdir, 'index_%s.html' % tool); for cfg in configs:
print 'Writting from %s to %s' % (srcfile, dstfile) dstfile = os.path.join(outdir, 'index_%s_%s.html' % (tool, cfg))
print 'Writing from %s to %s' % (srcfile, dstfile)
replace = { replace = {
'<config>': cfg,
'<NAME>': name, '<NAME>': name,
'<TITLE>': desc['TITLE'], '<TITLE>': desc['TITLE'],
'<tc>': tool '<tc>': tool
...@@ -431,6 +378,8 @@ def ProcessHTML(srcroot, dstroot, desc, toolchains): ...@@ -431,6 +378,8 @@ def ProcessHTML(srcroot, dstroot, desc, toolchains):
WriteReplaced(srcfile, dstfile, replace) WriteReplaced(srcfile, dstfile, replace)
replace['<tc>'] = tools[0] replace['<tc>'] = tools[0]
replace['<config>'] = configs[0]
srcfile = os.path.join(SDK_SRC_DIR, 'build_tools', 'redirect.html') srcfile = os.path.join(SDK_SRC_DIR, 'build_tools', 'redirect.html')
dstfile = os.path.join(outdir, 'index.html') dstfile = os.path.join(outdir, 'index.html')
WriteReplaced(srcfile, dstfile, replace) WriteReplaced(srcfile, dstfile, replace)
...@@ -560,6 +509,7 @@ def main(argv): ...@@ -560,6 +509,7 @@ def main(argv):
print 'Using default toolchains: ' + ' '.join(toolchains) print 'Using default toolchains: ' + ' '.join(toolchains)
master_projects = {} master_projects = {}
for filename in args: for filename in args:
desc = LoadProject(filename, toolchains) desc = LoadProject(filename, toolchains)
if not desc: if not desc:
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import os
# #
# Default macros for various platforms. # Default macros for various platforms.
...@@ -13,8 +15,8 @@ NEWLIB_CXX?=$(TC_PATH)/$(OSNAME)_x86_newlib/bin/i686-nacl-g++ -c -std=gnu++98 ...@@ -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_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_LIB?=$(TC_PATH)/$(OSNAME)_x86_newlib/bin/i686-nacl-ar r
NEWLIB_DUMP?=$(TC_PATH)/$(OSNAME)_x86_newlib/x86_64-nacl/bin/objdump 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_CCFLAGS?=-MMD -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include
NEWLIB_LDFLAGS?=-g -pthread NEWLIB_LDFLAGS?=-pthread
""" """
GLIBC_DEFAULTS = """ GLIBC_DEFAULTS = """
...@@ -25,8 +27,8 @@ GLIBC_LIB?=$(TC_PATH)/$(OSNAME)_x86_glibc/bin/i686-nacl-ar r ...@@ -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_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/lib32
GLIBC_PATHS+=-L $(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/lib 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_CCFLAGS?=-MMD -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include
GLIBC_LDFLAGS?=-g -pthread GLIBC_LDFLAGS?=-pthread
""" """
PNACL_DEFAULTS = """ PNACL_DEFAULTS = """
...@@ -35,79 +37,72 @@ PNACL_CXX?=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-clang++ -c -std=gnu++ ...@@ -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_LINK?=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-clang++
PNACL_LIB?=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-ar r PNACL_LIB?=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-ar r
PNACL_DUMP?=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/objdump PNACL_DUMP?=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/objdump
PNACL_CCFLAGS?=-O0 -MMD -g -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include PNACL_CCFLAGS?=-MMD -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include
PNACL_LDFLAGS?=-g -pthread PNACL_LDFLAGS?=-pthread
TRANSLATE:=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-translate TRANSLATE:=$(TC_PATH)/$(OSNAME)_x86_pnacl/newlib/bin/pnacl-translate
""" """
WIN_DEFAULTS = """ WIN_DEFAULTS = """
WIN_CC?=cl.exe WIN_CC?=cl.exe /nologo
WIN_CXX?=cl.exe WIN_CXX?=cl.exe /nologo
WIN_LINK?=link.exe WIN_LINK?=link.exe /nologo
WIN_LIB?=lib.exe WIN_LIB?=lib.exe /nologo
WIN_CCFLAGS=/I$(NACL_SDK_ROOT)/include /I$(NACL_SDK_ROOT)/include/win -D WIN32 -D _WIN32 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. # Compile rules for various platforms.
# #
NACL_CC_RULE = """ CC_RULE = '<tc>/<config>/<name>_<ARCH>.o : %.<ext> $(THIS_MAKE) | <tc>/<config>'
<OBJS>:=$(patsubst %.<ext>, <tc>/%_<ARCH>.o,$(<PROJ>_<EXT>)) NACL_CC_RULES = {
DEPFILES+=$(<OBJS>:.o=.d) 'Debug': '<TAB>$(<CC>) -o $@ $< -g -O0 <MACH> $(<PROJ>_<EXT>FLAGS) -DTCNAME=<tc> $(<TC>_CCFLAGS) <DEFLIST> <INCLIST>',
$(<OBJS>) : <tc>/%_<ARCH>.o : %.<ext> $(THIS_MAKE) | <tc> 'Release': '<TAB>$(<CC>) -o $@ $< -O2 <MACH> $(<PROJ>_<EXT>FLAGS) -DTCNAME=<tc> $(<TC>_CCFLAGS) <DEFLIST> <INCLIST>',
<TAB>$(<CC>) -o $@ $< <MACH> -DTCNAME=<tc> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLUDELIST> }
"""
SO_CC_RULE = """ SO_CC_RULES = {
<OBJS>:=$(patsubst %.<ext>, <tc>/%_<ARCH>.o,$(<PROJ>_<EXT>)) 'Debug': '<TAB>$(<CC>) -o $@ $< -g -O0 <MACH> -fPIC $(<PROJ>_<EXT>FLAGS) -DTCNAME=<tc> $(<TC>_CCFLAGS) <DEFLIST> <INCLIST>',
DEPFILES+=$(<OBJS>:.o=.d) 'Release': '<TAB>$(<CC>) -o $@ $< -02 <MACH> -fPIC $(<PROJ>_<EXT>FLAGS) -DTCNAME=<tc> $(<TC>_CCFLAGS) <DEFLIST> <INCLIST>'
$(<OBJS>) : <tc>/%_<ARCH>.o : %.<ext> $(THIS_MAKE) | <tc> }
<TAB>$(<CC>) -o $@ $< <MACH> -fPIC -DTCNAME=<tc> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLUDELIST>
"""
WIN_CC_RULE = """ WIN_CC_RULES = {
<OBJS>:=$(patsubst %.<ext>, <tc>/%.obj,$(<PROJ>_<EXT>)) 'Debug': '<TAB>$(<CC>) /Od /Fo$@ /MTd /c $< -DTCNAME=host $(WIN_CCFLAGS) <DEFLIST> <INCLIST>',
$(<OBJS>) : <tc>/%.obj : %.<ext> $(THIS_MAKE) | <tc> 'Release': '<TAB>$(<CC>) /O2 /Fo$@ /MT /c $< -DTCNAME=host $(WIN_CCFLAGS) <DEFLIST> <INCLIST>'
<TAB>$(<CC>) /Fo$@ /c $< -DTCNAME=host $(WIN_CCFLAGS) <DEFLIST> <INCLUDELIST> }
"""
# #
# Link rules for various platforms. # Link rules for various platforms.
# #
NEXE_LINK_RULE = """ NEXE_LINK_RULES = {
<tc>/<proj>_<ARCH>.nexe : <OBJS> 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g <MACH> $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST>',
<TAB>$(<LINK>) -o $@ $^ <MACH> $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST> 'Release': '<TAB>$(<LINK>) -o $@ $^ <MACH> $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST>'
<TC>_NMF+=<tc>/<proj>_<ARCH>.nexe }
"""
PEXE_LINK_RULE = """ SO_LINK_RULES = {
<tc>/<proj>.pexe : <OBJS> 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g <MACH> -shared $(<PROJ>_LDFLAGS) <LIBLIST>',
<TAB>$(<LINK>) -o $@ $^ $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST> 'Release': '<TAB>$(<LINK>) -o $@ $^ <MACH> -shared $(<PROJ>_LDFLAGS) <LIBLIST>',
}
<tc>/<proj>_x86_32.nexe : <tc>/<proj>.pexe PEXE_TRANSLATE_RULE = """
<tc>/<config>/<proj>_x86_32.nexe : <tc>/<config>/<proj>.pexe
<TAB>$(TRANSLATE) -arch x86-32 $< -o $@ <TAB>$(TRANSLATE) -arch x86-32 $< -o $@
<tc>/<proj>_x86_64.nexe : <tc>/<proj>.pexe <tc>/<config>/<proj>_x86_64.nexe : <tc>/<config>/<proj>.pexe
<TAB>$(TRANSLATE) -arch x86-64 $< -o $@ <TAB>$(TRANSLATE) -arch x86-64 $< -o $@
<tc>/<proj>_arm.nexe : <tc>/<proj>.pexe <tc>/<config>/<proj>_arm.nexe : <tc>/<config>/<proj>.pexe
<TAB>$(TRANSLATE) -arch arm $< -o $@ <TAB>$(TRANSLATE) -arch arm $< -o $@"""
PNACL_NMF:=<tc>/<proj>_x86_32.nexe <tc>/<proj>_x86_64.nexe <tc>/<proj>_arm.nexe
"""
SO_LINK_RULE = """ PEXE_LINK_RULES = {
<tc>/<proj>_<ARCH>.so : <OBJS> 'Debug': '<TAB>$(<LINK>) -o $@ $^ -g $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST>\n' + PEXE_TRANSLATE_RULE,
<TAB>$(<LINK>) -o $@ $^ <MACH> -shared $(<PROJ>_LDFLAGS) <LIBLIST> 'Release': '<TAB>$(<LINK>) -o $@ $^ $(<PROJ>_LDFLAGS) $(<TC>_LDFLAGS) <LIBLIST>\n' + PEXE_TRANSLATE_RULE,
GLIBC_REMAP+= -n <proj>_<ARCH>.so,<proj>.so }
<TC>_NMF+=<tc>/<proj>_<ARCH>.so
"""
WIN_LINK_RULE = """ WIN_LINK_RULES = {
win/<proj>.dll : <OBJS> 'Debug': '<TAB>$(<LINK>) /DLL /OUT:$@ $(<PROJ>_LDFLAGS) /LIBPATH:$(NACL_SDK_ROOT)/lib/win_x86_32_host/Debug $^ <LIBLIST> $(WIN_LDFLAGS)',
<TAB>$(<LINK>) /DLL /OUT:$@ $(<PROJ>_<EXT>FLAGS) /LIBPATH:$(NACL_SDK_ROOT)/lib $^ <LIBLIST> $(WIN_LDFLAGS) 'Release': '<TAB>$(<LINK>) /DLL /OUT:$@ $(<PROJ>_LDFLAGS) /LIBPATH:$(NACL_SDK_ROOT)/lib/win_x86_32_host/Release $^ <LIBLIST> $(WIN_LDFLAGS)'
<TC>_NMF+=<tc>/<proj>.dll }
WIN_LAUNCH_RULES = """
HOST_ARGS:=--register-pepper-plugins=$(abspath win/<proj>.dll);application/x-nacl HOST_ARGS:=--register-pepper-plugins=$(abspath win/<proj>.dll);application/x-nacl
LAUNCH_HOST: CHECK_FOR_CHROME all LAUNCH_HOST: CHECK_FOR_CHROME all
<TAB>$(CHROME_PATH) $(HOST_ARGS) "localhost:5103/index_win.html" <TAB>$(CHROME_PATH) $(HOST_ARGS) "localhost:5103/index_win.html"
...@@ -116,35 +111,39 @@ LAUNCH_HOST: CHECK_FOR_CHROME all ...@@ -116,35 +111,39 @@ LAUNCH_HOST: CHECK_FOR_CHROME all
# #
# Lib rules for various platforms. # Lib rules for various platforms.
# #
POSIX_LIB_RULE = """ POSIX_LIB_RULES = {
$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/lib<proj>.a : <OBJS> 'Debug':
<TAB>$(MKDIR) -p $(dir $@) '<TAB>$(MKDIR) -p $(dir $@)\n'
<TAB>$(<LIB>) $@ $^ '<TAB>$(<LIB>) $@ $^',
""" 'Release':
'<TAB>$(MKDIR) -p $(dir $@)\n'
WIN_LIB_RULE = """ '<TAB>$(<LIB>) $@ $^',
$(NACL_SDK_ROOT)/lib/win_<ARCH>_host/<proj>.lib : <OBJS> }
<TAB>$(<LIB>) /OUT:$@ $^ $(<PROJ>_<EXT>FLAGS) <LIBLIST>
"""
WIN_LIB_RULES = {
'Debug': '<TAB>$(<LIB>) /OUT:$@ $^ $(WIN_LDFLAGS) <LIBLIST>',
'Release': '<TAB>$(<LIB>) /OUT:$@ $^ $(WIN_LDFLAGS) <LIBLIST>'
}
#
# NMF rules for various platforms.
#
NMF_RULE = """ NMF_RULE = """
<tc>/<proj>.nmf : $(<TC>_NMF) <tc>/<config>/<proj>.nmf : <NMF_TARGETS>
<TAB>$(NMF) -D $(<DUMP>) -o $@ $^ -t <tc> -s <tc> <TAB>$(NMF) -D $(<DUMP>) -o $@ $^ -t <tc> -s <tc>/<config>
""" """
NMF_EMPTY = """ NMF_EMPTY = """
<tc>/<proj>.nmf : $(<TC>_NMF) | <tc> <tc>/<config>/<proj>.nmf : <NMF_TARGETS> | <tc>/<config>
<TAB>echo {} > $@ <TAB>echo {} > $@
""" """
GLIBC_NMF_RULE = """ GLIBC_NMF_RULE = """
<tc>/<proj>.nmf : $(<TC>_NMF) <tc>/<config>/<proj>.nmf : <NMF_TARGETS>
<TAB>$(NMF) -D $(<DUMP>) -o $@ $(GLIBC_PATHS) $^ -t <tc> -s <tc> $(<TC>_REMAP) <TAB>$(NMF) -D $(<DUMP>) -o $@ $(GLIBC_PATHS) $^ -t <tc> -s <tc>/<config> $(GLIBC_REMAP)
""" """
EXT_MAP = { EXT_MAP = {
'c': 'CC', 'c': 'CC',
'cc': 'CXX' 'cc': 'CXX'
...@@ -154,20 +153,33 @@ WIN_TOOL = { ...@@ -154,20 +153,33 @@ WIN_TOOL = {
'DEFINE': '-D%s', 'DEFINE': '-D%s',
'INCLUDE': '/I%s', 'INCLUDE': '/I%s',
'LIBRARY': '%s.lib', 'LIBRARY': '%s.lib',
'main': '<tc>/<proj>.dll', 'MAIN': '<tc>/<config>/<proj>.dll',
'nmf': '<tc>/<proj>.nmf', 'NMFMAIN': '<tc>/<config>/<proj>.dll',
'so': None, 'SO': None,
'lib': '$(NACL_SDK_ROOT)/lib/win_<ARCH>_host/<proj>.lib', 'LIB': '$(NACL_SDK_ROOT)/lib/win_<ARCH>_host/<config>/<proj>.lib',
} }
NACL_TOOL = { NACL_TOOL = {
'DEFINE': '-D%s', 'DEFINE': '-D%s',
'INCLUDE': '-I%s', 'INCLUDE': '-I%s',
'LIBRARY': '-l%s', 'LIBRARY': '-l%s',
'main': '<tc>/<proj>_<ARCH>.nexe', 'MAIN': '<tc>/<config>/<proj>_<ARCH>.nexe',
'nmf': '<tc>/<proj>.nmf', 'NMFMAIN': '<tc>/<config>/<proj>_<ARCH>.nexe',
'so': '<tc>/<proj>_<ARCH>.so', 'SO': '<tc>/<config>/<proj>_<ARCH>.so',
'lib': '$(NACL_SDK_ROOT)/lib/$(OSNAME)_<ARCH>_<tc>/lib<proj>.a', '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 = { ...@@ -200,104 +212,234 @@ BUILD_RULES = {
'newlib' : { 'newlib' : {
'ARCHES': [NACL_X86_32, NACL_X86_64], 'ARCHES': [NACL_X86_32, NACL_X86_64],
'DEFS': NEWLIB_DEFAULTS, 'DEFS': NEWLIB_DEFAULTS,
'CC' : NACL_CC_RULE, 'CC' : NACL_CC_RULES,
'CXX' : NACL_CC_RULE, 'CXX' : NACL_CC_RULES,
'NMF' : NMF_RULE, 'NMF' : NMF_RULE,
'MAIN': NEXE_LINK_RULE, 'MAIN': NEXE_LINK_RULES,
'LIB': POSIX_LIB_RULE, 'LIB': POSIX_LIB_RULES,
'SO' : None, 'SO' : None,
'TOOL': NACL_TOOL, 'TOOL': NACL_TOOL,
}, },
'glibc' : { 'glibc' : {
'ARCHES': [NACL_X86_32, NACL_X86_64], 'ARCHES': [NACL_X86_32, NACL_X86_64],
'DEFS': GLIBC_DEFAULTS, 'DEFS': GLIBC_DEFAULTS,
'CC': NACL_CC_RULE, 'CC': NACL_CC_RULES,
'CXX': NACL_CC_RULE, 'CXX': NACL_CC_RULES,
'NMF' : GLIBC_NMF_RULE, 'NMF' : GLIBC_NMF_RULE,
'MAIN': NEXE_LINK_RULE, 'MAIN': NEXE_LINK_RULES,
'LIB': POSIX_LIB_RULE, 'LIB': POSIX_LIB_RULES,
'SO': SO_LINK_RULE, 'SO': SO_LINK_RULES,
'TOOL': NACL_TOOL, 'TOOL': NACL_TOOL,
}, },
'pnacl' : { 'pnacl' : {
'ARCHES': [NACL_PNACL], 'ARCHES': [NACL_PNACL],
'DEFS': PNACL_DEFAULTS, 'DEFS': PNACL_DEFAULTS,
'CC': NACL_CC_RULE, 'CC': NACL_CC_RULES,
'CXX': NACL_CC_RULE, 'CXX': NACL_CC_RULES,
'NMF' : NMF_RULE, 'NMF' : NMF_RULE,
'MAIN': PEXE_LINK_RULE, 'MAIN': PEXE_LINK_RULES,
'LIB': POSIX_LIB_RULE, 'LIB': POSIX_LIB_RULES,
'SO': None, 'SO': None,
'TOOL': NACL_TOOL 'TOOL': PNACL_TOOL
}, },
'win' : { 'win' : {
'ARCHES': [WIN_32], 'ARCHES': [WIN_32],
'DEFS': WIN_DEFAULTS, 'DEFS': WIN_DEFAULTS,
'CC': WIN_CC_RULE, 'CC': WIN_CC_RULES,
'CXX': WIN_CC_RULE, 'CXX': WIN_CC_RULES,
'NMF' : NMF_EMPTY, 'NMF' : NMF_EMPTY,
'MAIN': WIN_LINK_RULE, 'MAIN': WIN_LINK_RULES,
'LIB': WIN_LIB_RULE, 'LIB': WIN_LIB_RULES,
'SO': None, 'SO': None,
'TOOL': WIN_TOOL 'TOOL': WIN_TOOL
} }
} }
class MakeRules(object):
def GetBuildRule(tool, ext): """MakeRules generates Tool, Config, and Arch dependend makefile settings.
return BUILD_RULES[tool][ext]
The MakeRules object generates strings used in the makefile based on the
current object settings such as toolchain, configuration, architecture...
def BuildList(tool, key, items): It stores settings such as includes, defines, and lists, and converts them
pattern = BUILD_RULES[tool]['TOOL'][key] to the appropriate format whenever the toolchain changes.
items = [(pattern % name) for name in items] """
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 ' '.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 BuildDefineList(tool, defs): def Replace(self, text):
return BuildList(tool, 'DEFINE', defs) return Replace(text, self.vars)
def BuildIncludeList(tool, includes): def Replace(text, replacements):
return BuildList(tool, 'INCLUDE', includes) for key in replacements:
val = replacements[key]
if val is not None:
text = text.replace(key, val)
return text
def BuildLibList(tool, libs): def SetVar(varname, values):
return BuildList(tool, 'LIBRARY', libs) 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 + ' '
def BuildToolDict(toolchain, project, arch = {}, ext='nexe', **kwargs): if line:
tc = toolchain out += line[:-1] + '\n'
TC = toolchain.upper() return out
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 def GenerateCleanRules(tools, configs):
for key in arch: rules = '#\n# Target to remove temporary files\n#\n.PHONY: clean\nclean:\n'
replace[key] = arch[key] for tc in tools:
for cfg in configs:
rules += '\t$(RM) -fr %s/%s\n' % (tc, cfg)
return rules + '\n'
# Add other passed in replacements
for key in kwargs:
replace['<%s>' % key] = kwargs[key]
if '<OBJS>' not in replace: def GenerateNMFRules(tc, main, dlls, cfg, arches):
if replace.get('<ARCH>', ''): target = BUILD_RULES[tc]['TOOL']['NMFMAIN']
replace['<OBJS>'] = '%s_%s_%s_%s_O' % (TC, PROJ, replace['<ARCH>'], EXT) dll_target = BUILD_RULES[tc]['TOOL']['SO']
else: nmf_targets = []
replace['<OBJS>'] = '%s_%s_%s_O' % (TC, PROJ, EXT)
return replace
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'
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
<head> <head>
<meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" /> <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> </head>
<body> <body>
Redirecting to default example: <tc> Redirecting to default example: <tc> <config>
</body> </body>
</html> </html>
...@@ -19,13 +19,13 @@ var common = (function () { ...@@ -19,13 +19,13 @@ var common = (function () {
* @param {number} width The width to create the plugin. * @param {number} width The width to create the plugin.
* @param {number} height The height 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'); var moduleEl = document.createElement('embed');
moduleEl.setAttribute('name', 'nacl_module'); moduleEl.setAttribute('name', 'nacl_module');
moduleEl.setAttribute('id', 'nacl_module'); moduleEl.setAttribute('id', 'nacl_module');
moduleEl.setAttribute('width', width); moduleEl.setAttribute('width', width);
moduleEl.setAttribute('height',height); moduleEl.setAttribute('height',height);
moduleEl.setAttribute('src', tool + '/' + name + '.nmf'); moduleEl.setAttribute('src', tool + '/' + config + '/' + name + '.nmf');
moduleEl.setAttribute('type', 'application/x-nacl'); moduleEl.setAttribute('type', 'application/x-nacl');
// The <EMBED> element is wrapped inside a <DIV>, which has both a 'load' // The <EMBED> element is wrapped inside a <DIV>, which has both a 'load'
...@@ -148,7 +148,7 @@ var common = (function () { ...@@ -148,7 +148,7 @@ var common = (function () {
* @param {number} width The width to create the plugin. * @param {number} width The width to create the plugin.
* @param {number} height The height 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 // If the page loads before the Native Client module loads, then set the
// status message indicating that the module is still loading. Otherwise, // status message indicating that the module is still loading. Otherwise,
// do not change the status message. // do not change the status message.
...@@ -160,7 +160,7 @@ var common = (function () { ...@@ -160,7 +160,7 @@ var common = (function () {
// plug-in graphic, if there is a problem. // plug-in graphic, if there is a problem.
width = typeof width !== 'undefined' ? width : 200; width = typeof width !== 'undefined' ? width : 200;
height = typeof height !== 'undefined' ? height : 200; height = typeof height !== 'undefined' ? height : 200;
createNaClModule(name, tool, width, height); createNaClModule(name, tool, config, width, height);
attachDefaultListeners(); attachDefaultListeners();
} else { } else {
// It's possible that the Native Client module onload event fired // It's possible that the Native Client module onload event fired
......
...@@ -137,7 +137,7 @@ Chrome executable.</li> ...@@ -137,7 +137,7 @@ Chrome executable.</li>
<embed name="nacl_module" <embed name="nacl_module"
id="hello_world" id="hello_world"
width=100 height=100 width=100 height=100
src="<tc>/debugging.nmf" src="<tc>/<config>/debugging.nmf"
type="application/x-nacl" /> type="application/x-nacl" />
</div> </div>
<hr> <hr>
......
...@@ -27,7 +27,7 @@ found in the LICENSE file. ...@@ -27,7 +27,7 @@ found in the LICENSE file.
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>')"> <body onload="common.onload('<NAME>', '<tc>', '<config>')">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<div>Magic eightball: type a question below, press the button, and get a <div>Magic eightball: type a question below, press the button, and get a
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>', 256, 256)"> <body onload="common.onload('<NAME>', '<tc>', '<config>', 256, 256)">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<input type="file" id="FileInput" onchange="handleFileInput()" multiple> <input type="file" id="FileInput" onchange="handleFileInput()" multiple>
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
function(bytes) { function(bytes) {
common.updateStatus( common.updateStatus(
'Allocated '+bytes+' bytes of persistant storage.'); 'Allocated '+bytes+' bytes of persistant storage.');
common.createNaClModule('<NAME>', '<tc>', 200, 200); common.createNaClModule('<NAME>', '<tc>', '<config>', 200, 200);
common.attachDefaultListeners(); common.attachDefaultListeners();
}, },
function(e) { alert('Failed to allocate space') }); function(e) { alert('Failed to allocate space') });
......
...@@ -27,7 +27,7 @@ found in the LICENSE file. ...@@ -27,7 +27,7 @@ found in the LICENSE file.
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>', 480, 480)"> <body onload="common.onload('<NAME>', '<tc>', '<config>', 480, 480)">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<p> <p>
......
...@@ -11,7 +11,7 @@ found in the LICENSE file. ...@@ -11,7 +11,7 @@ found in the LICENSE file.
<title><TITLE></title> <title><TITLE></title>
<script type="text/javascript" src="common.js"></script> <script type="text/javascript" src="common.js"></script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>', '800', '200')"> <body onload="common.onload('<NAME>', '<tc>', '<config>', '800', '200')">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<!-- The NaCl plugin will be embedded inside the element with id "listener". <!-- The NaCl plugin will be embedded inside the element with id "listener".
......
...@@ -40,7 +40,7 @@ found in the LICENSE file. ...@@ -40,7 +40,7 @@ found in the LICENSE file.
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>')"> <body onload="common.onload('<NAME>', '<tc>', '<config>')">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<table border=5 cellpadding=5% summary="A title and a result log"> <table border=5 cellpadding=5% summary="A title and a result log">
......
...@@ -11,7 +11,7 @@ found in the LICENSE file. ...@@ -11,7 +11,7 @@ found in the LICENSE file.
<title><TITLE></title> <title><TITLE></title>
<script type="text/javascript" src="common.js"></script> <script type="text/javascript" src="common.js"></script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>')"> <body onload="common.onload('<NAME>', '<tc>', '<config>')">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<!-- The NaCl plugin will be embedded inside the element with id "listener". <!-- The NaCl plugin will be embedded inside the element with id "listener".
......
...@@ -11,7 +11,7 @@ found in the LICENSE file. ...@@ -11,7 +11,7 @@ found in the LICENSE file.
<title><TITLE></title> <title><TITLE></title>
<script type="text/javascript" src="common.js"></script> <script type="text/javascript" src="common.js"></script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>', 640, 480)"> <body onload="common.onload('<NAME>', '<tc>', '<config>', 640, 480)">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<!-- The NaCl plugin will be embedded inside the element with id "listener". <!-- The NaCl plugin will be embedded inside the element with id "listener".
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>')"> <body onload="common.onload('<NAME>', '<tc>', '<config>')">
<h1>Native Client Simple Module</h1> <h1>Native Client Simple Module</h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<!-- The NaCl plugin will be embedded inside the element with id "listener". <!-- The NaCl plugin will be embedded inside the element with id "listener".
......
...@@ -31,7 +31,7 @@ found in the LICENSE file. ...@@ -31,7 +31,7 @@ found in the LICENSE file.
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>')"> <body onload="common.onload('<NAME>', '<tc>', '<config>')">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
......
...@@ -97,7 +97,7 @@ found in the LICENSE file. ...@@ -97,7 +97,7 @@ found in the LICENSE file.
} }
</script> </script>
</head> </head>
<body onload="common.createNaClModule('<NAME>', '<tc>', 200, 200)"> <body onload="common.createNaClModule('<NAME>', '<tc>', '<config>',200, 200)">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<h2>Event Log</h2> <h2>Event Log</h2>
......
...@@ -11,7 +11,7 @@ found in the LICENSE file. ...@@ -11,7 +11,7 @@ found in the LICENSE file.
<title><TITLE></title> <title><TITLE></title>
<script type="text/javascript" src="common.js"></script> <script type="text/javascript" src="common.js"></script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>', 300, 300)"> <body onload="common.onload('<NAME>', '<tc>', '<config>', 300, 300)">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<h1>Full-screen and Mouse-lock Example</h1> <h1>Full-screen and Mouse-lock Example</h1>
......
...@@ -40,7 +40,7 @@ found in the LICENSE file. ...@@ -40,7 +40,7 @@ found in the LICENSE file.
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>')"> <body onload="common.onload('<NAME>', '<tc>', '<config>')">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<button onclick="cancelQueue()">Kill worker thread and queue</button> <button onclick="cancelQueue()">Kill worker thread and queue</button>
......
...@@ -30,7 +30,7 @@ found in the LICENSE file. ...@@ -30,7 +30,7 @@ found in the LICENSE file.
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>')" onunload="pageDidUnload()"> <body onload="common.onload('<NAME>', '<tc>', '<config>')" onunload="pageDidUnload()">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<p> <p>
......
...@@ -46,7 +46,7 @@ found in the LICENSE file. ...@@ -46,7 +46,7 @@ found in the LICENSE file.
function(bytes) { function(bytes) {
common.updateStatus( common.updateStatus(
'Allocated '+bytes+' bytes of persistent storage.'); 'Allocated '+bytes+' bytes of persistent storage.');
common.createNaClModule('<NAME>', '<tc>', 800, 600); common.createNaClModule('<NAME>', '<tc>', '<config>', 800, 600);
common.attachDefaultListeners(); common.attachDefaultListeners();
}, },
function(e) { alert('Failed to allocate space'); }); function(e) { alert('Failed to allocate space'); });
......
...@@ -36,7 +36,7 @@ found in the LICENSE file. ...@@ -36,7 +36,7 @@ found in the LICENSE file.
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>')"> <body onload="common.onload('<NAME>', '<tc>', '<config>')">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
......
...@@ -26,7 +26,7 @@ found in the LICENSE file. ...@@ -26,7 +26,7 @@ found in the LICENSE file.
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>', 480, 480)"> <body onload="common.onload('<NAME>', '<tc>', '<config>', 480, 480)">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<p> <p>
......
...@@ -36,7 +36,7 @@ found in the LICENSE file. ...@@ -36,7 +36,7 @@ found in the LICENSE file.
} }
</script> </script>
</head> </head>
<body onload="common.onload('<NAME>', '<tc>')"> <body onload="common.onload('<NAME>', '<tc>', '<config>')">
<h1><TITLE></h1> <h1><TITLE></h1>
<h2>Status: <code id="statusField">NO-STATUS</code></h2> <h2>Status: <code id="statusField">NO-STATUS</code></h2>
<div>Set a server URL, then push "Connect" button to establish a connection. <div>Set a server URL, then push "Connect" button to establish a connection.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment