summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/src/examples/Makefile43
-rw-r--r--native_client_sdk/src/examples/dlopen/Makefile193
-rw-r--r--native_client_sdk/src/examples/fullscreen_tumbler/Makefile164
-rw-r--r--native_client_sdk/src/examples/fullscreen_tumbler/check_browser.js178
-rw-r--r--native_client_sdk/src/examples/gamepad/Makefile157
-rw-r--r--native_client_sdk/src/examples/geturl/Makefile152
-rw-r--r--native_client_sdk/src/examples/hello_world_interactive/Makefile8
-rw-r--r--native_client_sdk/src/examples/index.html164
-rw-r--r--native_client_sdk/src/examples/input_events/Makefile160
-rw-r--r--native_client_sdk/src/examples/load_progress/Makefile152
-rw-r--r--native_client_sdk/src/examples/load_progress/check_browser.js178
-rw-r--r--native_client_sdk/src/examples/mouselock/Makefile153
-rw-r--r--native_client_sdk/src/examples/mouselock/check_browser.js178
-rw-r--r--native_client_sdk/src/examples/multithreaded_input_events/Makefile153
-rw-r--r--native_client_sdk/src/examples/pi_generator/Makefile151
-rw-r--r--native_client_sdk/src/examples/pong/Makefile152
-rw-r--r--native_client_sdk/src/examples/sine_synth/Makefile151
-rw-r--r--native_client_sdk/src/examples/tumbler/Makefile158
18 files changed, 1054 insertions, 1591 deletions
diff --git a/native_client_sdk/src/examples/Makefile b/native_client_sdk/src/examples/Makefile
new file mode 100644
index 0000000..468269e
--- /dev/null
+++ b/native_client_sdk/src/examples/Makefile
@@ -0,0 +1,43 @@
+# Copyright (c) 2012 The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+#
+# GNU Make based build file.  For details on GNU Make see:
+#   http://www.gnu.org/software/make/manual/make.html
+#
+
+PROJECTS:=dlopen fullscreen_tumbler gamepad geturl hello_world_glibc
+PROJECTS+=hello_world_interactive hello_world_newlib input_events load_progress
+PROJECTS+=mouselock multithreaded_input_events pi_generator pong sine_synth
+PROJECTS+=tumbler
+
+# Define the default target
+all:
+
+
+#
+# Target Macro
+#
+# Macro defines a phony target for each example, and adds it to a list of
+# targets.
+#
+define TARGET
+TARGET_LIST+=$(1)_TARGET
+.PHONY: $(1)_TARGET
+$(1)_TARGET:
+ +cd $(1) && $(MAKE)
+endef
+
+
+# Define the various targets via the Macro
+$(foreach proj,$(PROJECTS),$(eval $(call TARGET,$(proj))))
+
+
+all: $(TARGET_LIST)
+ echo "Done building targets, running webserver."
+
+RUN: all
+ echo "Staring up python webserver."
+ python httpd.py
+
diff --git a/native_client_sdk/src/examples/dlopen/Makefile b/native_client_sdk/src/examples/dlopen/Makefile
index adf8a78..fa3545d 100644
--- a/native_client_sdk/src/examples/dlopen/Makefile
+++ b/native_client_sdk/src/examples/dlopen/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
+# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -16,11 +16,10 @@
# the rest of the makefile is boilerplate for defining build rules.
#
PROJECT:=dlopen
-COPY_FILES:=dlopen.html
-LDFLAGS:=-ldl -lppapi_cpp -lppapi
+WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
+CXXFLAGS:=-g -O0 -pthread -std=gnu++98 $(WARNINGS)
+LDFLAGS:=-g -ldl -lppapi_cpp -lppapi
-NEXES:=$(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-NEXES+=lib32/libeightball.so lib64/libeightball.so
#
# Get pepper directory for toolchain and includes.
@@ -29,181 +28,107 @@ NEXES+=lib32/libeightball.so lib64/libeightball.so
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
-
-# Project Build flags
-DEFINES:=
-INCLUDES:=
-WARNINGS:=-Wno-long-long -Wall -Wswitch-enum
-CXXFLAGS:=-pthread $(WARNINGS) $(DEFINES) $(INCLUDES)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_glibc)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_glibc)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
+NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py
#
# Create shell aliases
#
# Create Python based aliases for common shell commands like copy or move.
#
-COPY:= python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR:= python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM:= python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV:= python $(PEPPER_ROOT)/tools/oshelpers.py mv
+COPY:= python $(NACL_SDK_ROOT)/tools/oshelpers.py cp
+MKDIR:= python $(NACL_SDK_ROOT)/tools/oshelpers.py mkdir
+RM:= python $(NACL_SDK_ROOT)/tools/oshelpers.py rm
+MV:= python $(NACL_SDK_ROOT)/tools/oshelpers.py mv
+
+#
+# Disable DOS PATH warning when using Cygwin based tools Windows
+#
+CYGWIN ?= nodosfilewarning
+export CYGWIN
+
#
# NMF Manifiest generation
#
-NMF:=python $(PEPPER_ROOT)/tools/create_nmf.py
+NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py
NMF+=-D $(TC_PATH)/x86_64-nacl/bin/objdump
NMF_PATHS:=-L $(TC_PATH)/x86_64-nacl/lib32 -L $(TC_PATH)/x86_64-nacl/lib
NMF_PATHS+=-L lib32 -L lib64
+
#
# Disable DOS PATH warning when using Cygwin based tools Windows
#
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
-
-# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
+# Declare the ALL target first, to make the 'all' target the default build.
+# Since the NMF file requires all the binaires for generation we use that as
+# the dependency.
+all : $(PROJECT).nmf
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/lib32:
+# Rules to create subdirectories for libraries
+lib32:
$(MKDIR) -p $@
-DBG/lib64:
+lib64:
$(MKDIR) -p $@
# Copy all files to that config
$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
# Build debug version dlopen nexe and eightball.so for 32 and 64 bit.
-DBG/dlopen_x86_32.o: dlopen.cc $(THIS_MAKE) | DBG
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS)
-
-DBG/dlopen_x86_32.nexe: DBG/dlopen_x86_32.o $(THIS_MAKE) | DBG
- $(CXX) -o $@ $< $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-DBG/dlopen_x86_64.o: dlopen.cc $(THIS_MAKE) | DBG
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
+dlopen_x86_32.o: dlopen.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 $(CXXFLAGS)
-DBG/dlopen_x86_64.nexe: DBG/dlopen_x86_64.o $(THIS_MAKE) | DBG
- $(CXX) -o $@ $< $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
+dlopen_x86_32.nexe: dlopen_x86_32.o
+ $(CXX) -o $@ $< -m32 $(LDFLAGS)
-DBG/eightball_x86_32.o: eightball.cc $(THIS_MAKE) | DBG
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -fPIC
+dlopen_x86_64.o: dlopen.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 $(CXXFLAGS)
-DBG/lib32/libeightball.so: DBG/eightball_x86_32.o $(THIS_MAKE) | DBG/lib32
- $(CXX) -o $@ $< $(DEBUG_x86_32_FLAGS) $(LDFLAGS) -shared
+dlopen_x86_64.nexe: dlopen_x86_64.o
+ $(CXX) -o $@ $< -m64 $(LDFLAGS)
-DBG/eightball_x86_64.o: eightball.cc $(THIS_MAKE) | DBG
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS) -fPIC
+eightball_x86_32.o: eightball.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 $(CXXFLAGS) -fPIC
-DBG/lib64/libeightball.so: DBG/eightball_x86_64.o $(THIS_MAKE) | DBG/lib64
- $(CXX) -o $@ $< $(DEBUG_x86_64_FLAGS) $(LDFLAGS) -shared
+lib32/libeightball.so: eightball_x86_32.o | lib32
+ $(CXX) -o $@ $< -m32 $(LDFLAGS) -shared
-# Define rule for building NMF file and copying dependencies
-DBG_NEXES:=$(foreach src,$(NEXES),DBG/$(src))
-
-DBG/$(PROJECT).nmf : $(DBG_NEXES)
- cd DBG && $(NMF) -o dlopen.nmf -s . $(NMF_PATHS) $(NEXES)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : $(DBG_NEXES) DBG/$(PROJECT).nmf $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
+eightball_x86_64.o: eightball.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 $(CXXFLAGS) -fPIC
+lib64/libeightball.so: eightball_x86_64.o | lib64
+ $(CXX) -o $@ $< -m64 $(LDFLAGS) -shared
#
-# Release build rules.
+# NMF Manifiest generation
#
-RELEASE_x86_32_FLAGS:=-m32 -O2
-RELEASE_x86_64_FLAGS:=-m64 -O2
-
-REL:
- $(MKDIR) -p $@
-
-REL/lib32:
- $(MKDIR) -p $@
-
-REL/lib64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
-
-# Build release version dlopen nexe and eightball.so for 32 and 64 bit.
-REL/dlopen_x86_32.o: dlopen.cc $(THIS_MAKE) | REL
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS)
-
-REL/dlopen_x86_32.nexe: REL/dlopen_x86_32.o $(THIS_MAKE) | REL
- $(CXX) -o $@ $< $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
-
-REL/dlopen_x86_64.o: dlopen.cc $(THIS_MAKE) | REL
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
-
-REL/dlopen_x86_64.nexe: REL/dlopen_x86_64.o $(THIS_MAKE) | REL
- $(CXX) -o $@ $< $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
-
-REL/eightball_x86_32.o: eightball.cc $(THIS_MAKE) | REL/lib32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -fPIC
-
-REL/lib32/libeightball.so: REL/eightball_x86_32.o $(THIS_MAKE) | REL/lib32
- $(CXX) -o $@ $< $(RELEASE_x86_32_FLAGS) $(LDFLAGS) -shared
-
-REL/eightball_x86_64.o: eightball.cc $(THIS_MAKE) | REL/lib64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS) -fPIC
-
-REL/lib64/libeightball.so: REL/eightball_x86_64.o $(THIS_MAKE) | REL/lib64
- $(CXX) -o $@ $< $(RELEASE_x86_64_FLAGS) $(LDFLAGS) -shared
-
-# Define rule for building NMF file and copying dependencies
-REL_NEXES:=$(foreach src,$(NEXES),REL/$(src))
+# Use the python script create_nmf to scan the binaries for dependencies using
+# objdump. Pass in the (-L) paths to the default library toolchains so that we
+# can find those libraries and have it automatically copy the files (-s) to
+# the target directory for us.
+NEXES:=dlopen_x86_32.nexe dlopen_x86_32.nexe
+NEXES+=lib32/libeightball.so lib64/libeightball.so
+NMF_ARGS:=-D $(TC_PATH)/x86_64-nacl/bin/objdump
+NMF_PATHS:=-L $(TC_PATH)/x86_64-nacl/lib32 -L $(TC_PATH)/x86_64-nacl/lib64
-REL/$(PROJECT).nmf : $(REL_NEXES)
- cd REL && $(NMF) -o dlopen.nmf -s . $(NMF_PATHS) $(NEXES)
+$(PROJECT).nmf : $(NEXES)
+ $(NMF) -o $@ -s . $^ $(NMF_PATHS)
-# Define a RELEASE alias to build the release version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : $(REL_NEXES) REL/$(PROJECT).nmf $(REL_COPIES)
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/Makefile b/native_client_sdk/src/examples/fullscreen_tumbler/Makefile
index 79bc0b9..434de02 100644
--- a/native_client_sdk/src/examples/fullscreen_tumbler/Makefile
+++ b/native_client_sdk/src/examples/fullscreen_tumbler/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
+# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -15,14 +15,11 @@
# only the list of sources and project name that will actually change and
# the rest of the makefile is boilerplate for defining build rules.
#
-PROJECT:=fullscreen_tumbler
-C_SOURCES:=
-CXX_SOURCES:=transforms.cc shader_util.cc opengl_context.cc tumbler_module.cc
-CXX_SOURCES+=scripting_bridge.cc tumbler.cc cube.cc
-COPY_FILES:=bind.js trackball.js dragger.js vector3.js tumbler.js
-COPY_FILES+=fullscreen_tumbler.html fullscreen_tumbler.nmf
-COPY_FILES+=../common/check_browser.js
-
+PROJECT:=tumbler
+LDFLAGS:=-lppapi_gles2 -lppapi_cpp -lppapi
+CXX_SOURCES:=$(PROJECT).cc
+CXX_SOURCES+=transforms.cc shader_util.cc opengl_context.cc tumbler_module.cc
+CXX_SOURCES+=scripting_bridge.cc cube.cc
#
# Get pepper directory for toolchain and includes.
@@ -31,34 +28,19 @@ COPY_FILES+=../common/check_browser.js
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
-LDFLAGS:=-lppapi_gles2 -lppapi_cpp -lppapi
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -66,123 +48,31 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
-
-REL:
- $(MKDIR) -p $@
-
-REL/x86_32:
- $(MKDIR) -p $@
-
-REL/x86_64:
- $(MKDIR) -p $@
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+# Define 32 bit compile and link rules for C++ sources
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/fullscreen_tumbler/check_browser.js b/native_client_sdk/src/examples/fullscreen_tumbler/check_browser.js
new file mode 100644
index 0000000..0c54ba4
--- /dev/null
+++ b/native_client_sdk/src/examples/fullscreen_tumbler/check_browser.js
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2012 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * @fileoverview This file provides a BrowserChecker Javascript class.
+ * Users can create a BrowserChecker object, invoke checkBrowser(|version|),
+ * and then use getIsValidBrowser() and getBrowserSupportStatus()
+ * to determine if the browser version is greater than |version|
+ * and if the Native Client plugin is found.
+ */
+
+// Create a namespace object
+var browser_version = browser_version || {};
+
+/**
+ * Class to provide checking for version and NativeClient.
+ * @param {integer} arg1 An argument that indicates major version of Chrome we
+ * require, such as 14.
+ */
+
+/**
+ * Constructor for the BrowserChecker. Sets the major version of
+ * Chrome that is required to |minChromeVersion|.
+ * @param minChromeVersion The earliest major version of chrome that
+ * is supported. If the Chrome browser version is less than
+ * |minChromeVersion| then |isValidBrowswer| will be set to false.
+ * @param opt_maxChromeVersion Ignored. Retained for backwards compatibility.
+ * @param appVersion The application version string.
+ * @param plugins The plugins that exist in the browser.
+ * @constructor
+ */
+browser_version.BrowserChecker = function(minChromeVersion,
+ appVersion, plugins,
+ opt_maxChromeVersion) {
+ /**
+ * Version specified by the user. This class looks to see if the browser
+ * version is >= |minChromeVersion_|.
+ * @type {integer}
+ * @private
+ */
+ this.minChromeVersion_ = minChromeVersion;
+
+ /**
+ * List of Browser plugin objects.
+ * @type {Ojbect array}
+ * @private
+ */
+ this.plugins_ = plugins;
+
+ /**
+ * Application version string from the Browser.
+ * @type {integer}
+ * @private
+ */
+ this.appVersion_ = appVersion;
+
+ /**
+ * Flag used to indicate if the browser has Native Client and is if the
+ * browser version is recent enough.
+ * @type {boolean}
+ * @private
+ */
+ this.isValidBrowser_ = false;
+
+ /**
+ * Actual major version of Chrome -- found by querying the browser.
+ * @type {integer}
+ * @private
+ */
+ this.chromeVersion_ = null;
+
+ /**
+ * Browser support status. This allows the user to get a detailed status
+ * rather than using this.browserSupportMessage.
+ */
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.UNKNOWN;
+}
+
+/**
+ * The values used for BrowserChecker status to indicate success or
+ * a specific error.
+ * @enum {id}
+ */
+browser_version.BrowserChecker.StatusValues = {
+ UNKNOWN: 0,
+ NACL_ENABLED: 1,
+ UNKNOWN_BROWSER: 2,
+ CHROME_VERSION_TOO_OLD: 3,
+ NACL_NOT_ENABLED: 4,
+ NOT_USING_SERVER: 5
+};
+
+/**
+ * Determines if the plugin with name |name| exists in the browser.
+ * @param {string} name The name of the plugin.
+ * @param {Object array} plugins The plugins in this browser.
+ * @return {bool} |true| if the plugin is found.
+ */
+browser_version.BrowserChecker.prototype.pluginExists = function(name,
+ plugins) {
+ for (var index=0; index < plugins.length; index++) {
+ var plugin = this.plugins_[index];
+ var plugin_name = plugin['name'];
+ // If the plugin is not found, you can use the Javascript console
+ // to see the names of the plugins that were found when debugging.
+ if (plugin_name.indexOf(name) != -1) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * Returns browserSupportStatus_ which indicates if the browser supports
+ * Native Client. Values are defined as literals in
+ * browser_version.BrowserChecker.StatusValues.
+ * @ return {int} Level of NaCl support.
+ */
+browser_version.BrowserChecker.prototype.getBrowserSupportStatus = function() {
+ return this.browserSupportStatus_;
+}
+
+/**
+ * Returns isValidBrowser (true/false) to indicate if the browser supports
+ * Native Client.
+ * @ return {bool} If this browser has NativeClient and correct version.
+ */
+browser_version.BrowserChecker.prototype.getIsValidBrowser = function() {
+ return this.isValidBrowser_;
+}
+
+/**
+ * Checks to see if this browser can support Native Client applications.
+ * For Chrome browsers, checks to see if the "Native Client" plugin is
+ * enabled.
+ */
+browser_version.BrowserChecker.prototype.checkBrowser = function() {
+ var versionPatt = /Chrome\/(\d+)\.(\d+)\.(\d+)\.(\d+)/;
+ var result = this.appVersion_.match(versionPatt);
+
+ // |result| stores the Chrome version number.
+ if (!result) {
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.UNKNOWN_BROWSER;
+ } else {
+ this.chromeVersion_ = result[1];
+ // We know we have Chrome, check version and/or plugin named Native Client
+ if (this.chromeVersion_ >= this.minChromeVersion_) {
+ var found_nacl = this.pluginExists('Native Client', this.plugins_);
+ if (found_nacl) {
+ this.isValidBrowser_ = true;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.NACL_ENABLED;
+ } else {
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.NACL_NOT_ENABLED;
+ }
+ } else {
+ // We are in a version that is less than |minChromeVersion_|
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.CHROME_VERSION_TOO_OLD;
+ }
+ }
+ var my_protocol = window.location.protocol;
+ if (my_protocol.indexOf('file') == 0) {
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.NOT_USING_SERVER;
+ }
+}
+
diff --git a/native_client_sdk/src/examples/gamepad/Makefile b/native_client_sdk/src/examples/gamepad/Makefile
index f1a69f1..b533d29 100644
--- a/native_client_sdk/src/examples/gamepad/Makefile
+++ b/native_client_sdk/src/examples/gamepad/Makefile
@@ -16,9 +16,8 @@
# the rest of the makefile is boilerplate for defining build rules.
#
PROJECT:=gamepad
-CXX_SOURCES:=gamepad.cc gamepad_module.cc
-COPY_FILES:=gamepad.html gamepad.nmf
LDFLAGS:=-lppapi_cpp -lppapi
+CXX_SOURCES:=$(PROJECT).cc gamepad_module.cc
#
@@ -28,33 +27,19 @@ LDFLAGS:=-lppapi_cpp -lppapi
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -62,122 +47,44 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
+# Define 32 bit compile and link rules for main application
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-REL:
- $(MKDIR) -p $@
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-REL/x86_32:
- $(MKDIR) -p $@
+# Define 32 bit compile and link rules for loadable library
+eightball_x86_32.o: eightball.cc $(THIS_MAKE) | DBG
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS) -fPIC
-REL/x86_64:
- $(MKDIR) -p $@
+lib32/libeightball.so: eightball_x86_32.o $(THIS_MAKE) | lib32
+ $(CXX) -o $@ $< -m32 $(CXXFLAGS) $(LDFLAGS) -shared
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+# Define 64 bit compile and link rules for loadable library
+eightball_x86_64.o: eightball.cc $(THIS_MAKE) | DBG
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS) -fPIC
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+lib64/libeightball.so: eightball_x86_64.o $(THIS_MAKE) | lib64
+ $(CXX) -o $@ $< -m64 $(CXXFLAGS) $(LDFLAGS) -shared
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/geturl/Makefile b/native_client_sdk/src/examples/geturl/Makefile
index 42c3c7c..cd5c344 100644
--- a/native_client_sdk/src/examples/geturl/Makefile
+++ b/native_client_sdk/src/examples/geturl/Makefile
@@ -16,9 +16,9 @@
# the rest of the makefile is boilerplate for defining build rules.
#
PROJECT:=geturl
-CXX_SOURCES:=geturl.cc geturl_handler.cc
-COPY_FILES:=geturl.html geturl.nmf geturl_success.html
LDFLAGS:=-lppapi_cpp -lppapi
+CXX_SOURCES:=$(PROJECT).cc geturl_handler.cc
+
#
# Get pepper directory for toolchain and includes.
@@ -27,33 +27,19 @@ LDFLAGS:=-lppapi_cpp -lppapi
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -61,122 +47,30 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
-
-REL:
- $(MKDIR) -p $@
-
-REL/x86_32:
- $(MKDIR) -p $@
-
-REL/x86_64:
- $(MKDIR) -p $@
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+# Define 32 bit compile and link rules for C++ sources
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/hello_world_interactive/Makefile b/native_client_sdk/src/examples/hello_world_interactive/Makefile
index 62e9f95..6641177 100644
--- a/native_client_sdk/src/examples/hello_world_interactive/Makefile
+++ b/native_client_sdk/src/examples/hello_world_interactive/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
+# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -25,7 +25,7 @@ NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# information (-g) for correctness and ease of debugging.
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -Werror -pedantic
CXXFLAGS:=-pthread -O0 $(WARNINGS)
-
+LDFLAGS:=-lppapi_cpp -lppapi
#
# Compute path to compiler
@@ -57,11 +57,11 @@ hello_world_64.o helper_functions_64.o : %_64.o : %.cc
# Define link rule for 32 bit (-m32) nexe
hello_world_x86_32.nexe : hello_world_32.o helper_functions_32.o
- $(CXX) -o $@ $^ -m32 -O0 -g -lppapi_cpp -lppapi
+ $(CXX) -o $@ $^ -m32 -O0 -g $(LDFLAGS)
# Define link rule for 64 bit (-m64) nexe
hello_world_x86_64.nexe : hello_world_64.o helper_functions_64.o
- $(CXX) -o $@ $^ -m64 -O0 -g -lppapi_cpp -lppapi
+ $(CXX) -o $@ $^ -m64 -O0 -g $(LDFLAGS)
# Define a phony rule so it always runs, to build nexe and start up server.
.PHONY: RUN
diff --git a/native_client_sdk/src/examples/index.html b/native_client_sdk/src/examples/index.html
index 8bc87ee..a3d2a88 100644
--- a/native_client_sdk/src/examples/index.html
+++ b/native_client_sdk/src/examples/index.html
@@ -16,7 +16,7 @@ dt {
}
dd {
margin-bottom: 12pt;
- width: 600px;
+ width: 800px;
}
</style>
<link href="http://code.google.com/css/codesite.css" rel="stylesheet"
@@ -24,28 +24,144 @@ dd {
<title>Native Client Examples</title>
</head>
<body>
-<h2>Native Client Examples</h2>
-<p>The examples are no longer pre-built in the SDK. To try out the Native
-Client examples right now in your Chrome web browser, please see the
-<a href="http://www.gonacl.com/dev/sdk.html">SDK page on GoNaCl.com</a> and
-download the SDK examples from the
-<a href="https://chrome.google.com/webstore/">Chrome Web Store</a>.</p>
-<p>If you would like to build and run the examples within the SDK
-then run these commands, starting from the examples directory:</p><br />
-<strong>Windows</strong>
-<blockquote><code>
-cd %NACL_SDK_ROOT%\%NACL_TARGET_PLATFORM%\examples<br />
-scons<br />
-cd %NACL_SDK_ROOT%\staging<br />
-httpd<br />
-</code></blockquote>
-<strong>Mac/Linux</strong>
-<blockquote><code>
-cd $NACL_SDK_ROOT/$NACL_TARGET_PLATFORM/examples<br />
-./scons<br />
-cd $NACL_SDK_ROOT/staging<br />
-./httpd.py<br />
-</code></blockquote>
-<p>Happy hacking!</p>
+<h1>Native Client Examples</h1>
+<dd><p>This page lists all of the examples available in the most recent Native
+ Client SDK bundle. Each example is designed to teach a few specific Native
+ Client programming concepts. You will need to setup the build environment
+ including a path to 'make' which can be found in the 'tools' directory for
+ Windows, and the variable NACL_SDK_ROOT which points to one of the pepper
+ bundles found under the SDK install location. Calling make from the examples
+ directory will build all the projects, while calling make from and individual
+ example directory will build only that example.
+ </p>
+</dd>
+<h3>Using the Tools</h3>
+<dd><p>The following "hello_world" examples, show the basic outline of a Native
+Client application. The make files in each of the examples bellow show a
+simple way to build a NaCl application using
+<a href="http://www.gnu.org/software/make/manual/make.html">GNU Make</a>.
+See the link for further information.
+</p></dd>
+<dl>
+ <dt><a href="hello_world_newlib/hello_world.html">
+ Hello World (NEWLIB)</a></dt>
+ <dd>The Hello World In C example demonstrates the basic structure of all
+ Native Client applications. This example loads a Native Client module. The
+ page tracks the status of the module as it load. On a successful load, the
+ module will post a message containing the string "Hello World" back to
+ JavaScript which will display it as an alert.
+ <p>Teaching focus: Basic HTML, JavaScript, and module architecture.</p>
+ </dd>
+ <dt><a href="hello_world_glibc/hello_world.html">
+ Hello World (GLIBC)</a></dt>
+ <dd>The Hello World (GLIBC) example is identical to the one above, with the
+ exception that it used the GLIBC toolchain which uses Shared Objects. The use
+ of Shared Objects means a more complicated manifest file (NMF) which is needed
+ to allow the application to find the libraries. The NMF is automatically
+ generated as part of the build process, by scanning the application for
+ dependencies.
+ <p>Teaching focus: Basic HTML, JavaScript, Shared Objects, and module
+ architecture.</p>
+ </dd>
+ <dt><a href="hello_world_interactive/hello_world.html">
+ Interactive Hello World in C++</a></dt>
+ <dd>The Interactive Hello World C++ example demonstrates the basic structure
+ of all Native Client applications. This example loads a Native Client module
+ which uses two way interaction with JavaScript whenever a button is clicked.
+ The NaCl module will respond with the number 42 or the reversed version of the
+ string in the text box when the appropriate button is clicked.
+ <p>Teaching focus: Basic HTML, JavaScript, C++ PPAPI, and module
+ architecture; Messaging API.</p>
+ </dd>
+
+<h3>Common APIs</h3>
+<dd><p>The following set of examples illustrate various Pepper APIs including
+audio, 2D, 3D, input and urls.</p></dd>
+<dt><a href="sine_synth/sine_synth.html">Sine Wave Synthesizer</a></dt>
+ <dd> The Sine Wave Synthesizer example demonstrates playing sound (a sine
+ wave). Enter the desired frequency and hit play to start, stop to end. The
+ frequency box will display "Loading, please wait." while the module loads.
+ <p>Teaching focus: Audio.</p>
+ </dd>
+<dt><a href="input_events/input_events.html">Input Events</a></dt>
+ <dd> The Input Events example demonstrates how to handle events triggered by the user. This example allows a user
+ to interact with a square representing a module instance. Events are displayed on the screen as the user clicks, scrolls, types, inside or outside
+ of the square.
+
+ <p>Teaching focus: Keyboard and mouse input, view change, and focus events.</p>
+ </dd>
+ <dt><a href="pi_generator/pi_generator.html">Pi Generator</a></dt>
+ <dd> The Pi Generator example demonstrates creating a helper thread that estimate pi using the Monte Carlo
+ method while randomly putting 1,000,000,000 points inside a 2D square that shares two
+ sides with a quarter circle.
+
+ <p>Teaching focus: Thread creation, 2D graphics, view change events.</p>
+ </dd>
+ <dt><a href="tumbler/tumbler.html">Tumbler</a></dt>
+ <dd> The Tumbler example demonstrates how to create a 3D cube that you can rotate with your mouse while pressing the
+ left mouse button. This example creates a 3D context and draws to it using
+ OpenGL ES. The JavaScript implements a virtual trackball interface to
+ map mouse movements into 3D rotations using simple 3D vector math and
+ quaternions.
+
+ <p>Teaching focus: 3D graphics</p>
+ </dd>
+ <dt><a href="geturl/geturl.html">Get URL</a></dt>
+ <dd> The Get URL example demonstrates fetching an URL and then displaying its contents.
+
+ <p>Teaching focus: URL loading.</p>
+ </dd>
+
+<h3>Common Concepts</h3>
+<dd><p>The following set of examples illustrate various common concepts such as
+showing load progress, using Shared Objects (dynamic libraries),
+mulithreading...</p></dd>
+<dt><a href="dlopen/dlopen.html">Shared Object Loading (GLIBC)</a></dt>
+ <dd> The Load Progress example demonstrates how to listen for and handle
+ events that occur while a NaCl module loads. This example listens for
+ different load event types and dispatches different events to their
+ respective handler. This example also checks for valid browser version and
+ shows how to calculate and display loading progress.
+ <p>Teaching focus: Using shared objects.</p>
+ </dd>
+<dt><a href="load_progress/load_progress.html">Load Progress</a></dt>
+ <dd> The Load Progress example demonstrates how to listen for and handle events that occur while a
+ NaCl module loads. This example listens for different load event types and dispatches different events to their respective handler. This example also checks for valid browser
+ version and shows how to calculate and display loading progress.
+
+ <p>Teaching focus: Progress event handling.</p>
+ </dd>
+<dt><a href="pong/pong.html">Pong</a></dt>
+ <dd> The Pong example demonstrates how to create a basic 2D video game and how to store application
+ information in a local persistent file. This game uses up and
+ down arrow keyboard input events to move the paddle.
+
+ <p>Teaching focus: File I/O, 2D graphics, input events.</p>
+ </dd>
+ <dt><a href="multithreaded_input_events/mt_input_events.html">Multi-threaded Input Events</a></dt>
+ <dd>The Multithreaded Input Events example combines HTML, Javascript,
+ and C++ (the C++ is compiled to create a .nexe file).
+ The C++ shows how to handle input events in a multi-threaded application.
+ The main thread converts input events to non-pepper events and puts them on
+ a queue. The worker thread pulls them off of the queue, converts them to a
+ string, and then uses CallOnMainThread so that PostMessage can be send the
+ result of the worker thread to the browser.
+ <p>Teaching focus: Multithreaded event handling.</p>
+ </dd>
+ <dt><a href="fullscreen_tumbler/fullscreen_tumbler.html">Full-screen Tumbler</a></dt>
+ <dd>This is a modified version of the Tumbler example above that supports
+ full-screen display. It is in every way identical to Tumbler in
+ functionality, except that it adds the ability to switch to/from
+ full-screen display by pressing the Enter key.
+ <p>Teaching focus: Full-screen</p>
+ </dd>
+ <dt><a href="mouselock/mouselock.html">Mouse Locker</a></dt>
+ <dd> The Mouselock example demonstrates how to use the MouseLock API to hide
+ the mouse cursor. Mouse lock is only available in full-screen mode. You can
+ lock and unlock the mouse while in full-screen mode by pressing the Enter key.
+
+ <p>Teaching focus: Mouse lock, Full-screen</p>
+ </dd>
+</dl>
</body>
</html>
diff --git a/native_client_sdk/src/examples/input_events/Makefile b/native_client_sdk/src/examples/input_events/Makefile
index 53a5c76..668aebd 100644
--- a/native_client_sdk/src/examples/input_events/Makefile
+++ b/native_client_sdk/src/examples/input_events/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
+# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -16,9 +16,8 @@
# the rest of the makefile is boilerplate for defining build rules.
#
PROJECT:=input_events
-CXX_SOURCES:=input_events.cc
-COPY_FILES:=input_events.html input_events.nmf
LDFLAGS:=-lppapi_cpp -lppapi
+CXX_SOURCES:=$(PROJECT).cc
#
@@ -28,33 +27,19 @@ LDFLAGS:=-lppapi_cpp -lppapi
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -62,122 +47,43 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-REL:
- $(MKDIR) -p $@
+# Define 32 bit compile and link rules for main application
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-REL/x86_32:
- $(MKDIR) -p $@
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-REL/x86_64:
- $(MKDIR) -p $@
+# Define 32 bit compile and link rules for loadable library
+eightball_x86_32.o: eightball.cc $(THIS_MAKE) | DBG
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS) -fPIC
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+lib32/libeightball.so: eightball_x86_32.o $(THIS_MAKE) | lib32
+ $(CXX) -o $@ $< -m32 $(CXXFLAGS) $(LDFLAGS) -shared
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+# Define 64 bit compile and link rules for loadable library
+eightball_x86_64.o: eightball.cc $(THIS_MAKE) | DBG
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS) -fPIC
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
+lib64/libeightball.so: eightball_x86_64.o $(THIS_MAKE) | lib64
+ $(CXX) -o $@ $< -m64 $(CXXFLAGS) $(LDFLAGS) -shared
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/load_progress/Makefile b/native_client_sdk/src/examples/load_progress/Makefile
index bf83856..2b3e58e 100644
--- a/native_client_sdk/src/examples/load_progress/Makefile
+++ b/native_client_sdk/src/examples/load_progress/Makefile
@@ -16,10 +16,8 @@
# the rest of the makefile is boilerplate for defining build rules.
#
PROJECT:=load_progress
-C_SOURCES:=
-CXX_SOURCES:=load_progress.cc
-COPY_FILES:=load_progress.html load_progress.nmf
LDFLAGS:=-lppapi_cpp -lppapi
+CXX_SOURCES:=$(PROJECT).cc
#
@@ -29,33 +27,19 @@ LDFLAGS:=-lppapi_cpp -lppapi
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -63,122 +47,30 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
-
-REL:
- $(MKDIR) -p $@
-
-REL/x86_32:
- $(MKDIR) -p $@
-
-REL/x86_64:
- $(MKDIR) -p $@
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+# Define 32 bit compile and link rules for C++ sources
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/load_progress/check_browser.js b/native_client_sdk/src/examples/load_progress/check_browser.js
new file mode 100644
index 0000000..0c54ba4
--- /dev/null
+++ b/native_client_sdk/src/examples/load_progress/check_browser.js
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2012 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * @fileoverview This file provides a BrowserChecker Javascript class.
+ * Users can create a BrowserChecker object, invoke checkBrowser(|version|),
+ * and then use getIsValidBrowser() and getBrowserSupportStatus()
+ * to determine if the browser version is greater than |version|
+ * and if the Native Client plugin is found.
+ */
+
+// Create a namespace object
+var browser_version = browser_version || {};
+
+/**
+ * Class to provide checking for version and NativeClient.
+ * @param {integer} arg1 An argument that indicates major version of Chrome we
+ * require, such as 14.
+ */
+
+/**
+ * Constructor for the BrowserChecker. Sets the major version of
+ * Chrome that is required to |minChromeVersion|.
+ * @param minChromeVersion The earliest major version of chrome that
+ * is supported. If the Chrome browser version is less than
+ * |minChromeVersion| then |isValidBrowswer| will be set to false.
+ * @param opt_maxChromeVersion Ignored. Retained for backwards compatibility.
+ * @param appVersion The application version string.
+ * @param plugins The plugins that exist in the browser.
+ * @constructor
+ */
+browser_version.BrowserChecker = function(minChromeVersion,
+ appVersion, plugins,
+ opt_maxChromeVersion) {
+ /**
+ * Version specified by the user. This class looks to see if the browser
+ * version is >= |minChromeVersion_|.
+ * @type {integer}
+ * @private
+ */
+ this.minChromeVersion_ = minChromeVersion;
+
+ /**
+ * List of Browser plugin objects.
+ * @type {Ojbect array}
+ * @private
+ */
+ this.plugins_ = plugins;
+
+ /**
+ * Application version string from the Browser.
+ * @type {integer}
+ * @private
+ */
+ this.appVersion_ = appVersion;
+
+ /**
+ * Flag used to indicate if the browser has Native Client and is if the
+ * browser version is recent enough.
+ * @type {boolean}
+ * @private
+ */
+ this.isValidBrowser_ = false;
+
+ /**
+ * Actual major version of Chrome -- found by querying the browser.
+ * @type {integer}
+ * @private
+ */
+ this.chromeVersion_ = null;
+
+ /**
+ * Browser support status. This allows the user to get a detailed status
+ * rather than using this.browserSupportMessage.
+ */
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.UNKNOWN;
+}
+
+/**
+ * The values used for BrowserChecker status to indicate success or
+ * a specific error.
+ * @enum {id}
+ */
+browser_version.BrowserChecker.StatusValues = {
+ UNKNOWN: 0,
+ NACL_ENABLED: 1,
+ UNKNOWN_BROWSER: 2,
+ CHROME_VERSION_TOO_OLD: 3,
+ NACL_NOT_ENABLED: 4,
+ NOT_USING_SERVER: 5
+};
+
+/**
+ * Determines if the plugin with name |name| exists in the browser.
+ * @param {string} name The name of the plugin.
+ * @param {Object array} plugins The plugins in this browser.
+ * @return {bool} |true| if the plugin is found.
+ */
+browser_version.BrowserChecker.prototype.pluginExists = function(name,
+ plugins) {
+ for (var index=0; index < plugins.length; index++) {
+ var plugin = this.plugins_[index];
+ var plugin_name = plugin['name'];
+ // If the plugin is not found, you can use the Javascript console
+ // to see the names of the plugins that were found when debugging.
+ if (plugin_name.indexOf(name) != -1) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * Returns browserSupportStatus_ which indicates if the browser supports
+ * Native Client. Values are defined as literals in
+ * browser_version.BrowserChecker.StatusValues.
+ * @ return {int} Level of NaCl support.
+ */
+browser_version.BrowserChecker.prototype.getBrowserSupportStatus = function() {
+ return this.browserSupportStatus_;
+}
+
+/**
+ * Returns isValidBrowser (true/false) to indicate if the browser supports
+ * Native Client.
+ * @ return {bool} If this browser has NativeClient and correct version.
+ */
+browser_version.BrowserChecker.prototype.getIsValidBrowser = function() {
+ return this.isValidBrowser_;
+}
+
+/**
+ * Checks to see if this browser can support Native Client applications.
+ * For Chrome browsers, checks to see if the "Native Client" plugin is
+ * enabled.
+ */
+browser_version.BrowserChecker.prototype.checkBrowser = function() {
+ var versionPatt = /Chrome\/(\d+)\.(\d+)\.(\d+)\.(\d+)/;
+ var result = this.appVersion_.match(versionPatt);
+
+ // |result| stores the Chrome version number.
+ if (!result) {
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.UNKNOWN_BROWSER;
+ } else {
+ this.chromeVersion_ = result[1];
+ // We know we have Chrome, check version and/or plugin named Native Client
+ if (this.chromeVersion_ >= this.minChromeVersion_) {
+ var found_nacl = this.pluginExists('Native Client', this.plugins_);
+ if (found_nacl) {
+ this.isValidBrowser_ = true;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.NACL_ENABLED;
+ } else {
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.NACL_NOT_ENABLED;
+ }
+ } else {
+ // We are in a version that is less than |minChromeVersion_|
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.CHROME_VERSION_TOO_OLD;
+ }
+ }
+ var my_protocol = window.location.protocol;
+ if (my_protocol.indexOf('file') == 0) {
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.NOT_USING_SERVER;
+ }
+}
+
diff --git a/native_client_sdk/src/examples/mouselock/Makefile b/native_client_sdk/src/examples/mouselock/Makefile
index 02ff22c..1ac8e4d 100644
--- a/native_client_sdk/src/examples/mouselock/Makefile
+++ b/native_client_sdk/src/examples/mouselock/Makefile
@@ -16,9 +16,8 @@
# the rest of the makefile is boilerplate for defining build rules.
#
PROJECT:=mouselock
-CXX_SOURCES:=mouselock.cc
-COPY_FILES:=mouselock.html mouselock.nmf ../common/check_browser.js
-LDFLAGS:=-lppapi_gles2 -lppapi_cpp -lppapi
+LDFLAGS:=-lppapi_cpp -lppapi
+CXX_SOURCES:=$(PROJECT).cc
#
@@ -28,33 +27,19 @@ LDFLAGS:=-lppapi_gles2 -lppapi_cpp -lppapi
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -62,122 +47,30 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
-
-REL:
- $(MKDIR) -p $@
-
-REL/x86_32:
- $(MKDIR) -p $@
-
-REL/x86_64:
- $(MKDIR) -p $@
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+# Define 32 bit compile and link rules for C++ sources
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/mouselock/check_browser.js b/native_client_sdk/src/examples/mouselock/check_browser.js
new file mode 100644
index 0000000..0c54ba4
--- /dev/null
+++ b/native_client_sdk/src/examples/mouselock/check_browser.js
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2012 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * @fileoverview This file provides a BrowserChecker Javascript class.
+ * Users can create a BrowserChecker object, invoke checkBrowser(|version|),
+ * and then use getIsValidBrowser() and getBrowserSupportStatus()
+ * to determine if the browser version is greater than |version|
+ * and if the Native Client plugin is found.
+ */
+
+// Create a namespace object
+var browser_version = browser_version || {};
+
+/**
+ * Class to provide checking for version and NativeClient.
+ * @param {integer} arg1 An argument that indicates major version of Chrome we
+ * require, such as 14.
+ */
+
+/**
+ * Constructor for the BrowserChecker. Sets the major version of
+ * Chrome that is required to |minChromeVersion|.
+ * @param minChromeVersion The earliest major version of chrome that
+ * is supported. If the Chrome browser version is less than
+ * |minChromeVersion| then |isValidBrowswer| will be set to false.
+ * @param opt_maxChromeVersion Ignored. Retained for backwards compatibility.
+ * @param appVersion The application version string.
+ * @param plugins The plugins that exist in the browser.
+ * @constructor
+ */
+browser_version.BrowserChecker = function(minChromeVersion,
+ appVersion, plugins,
+ opt_maxChromeVersion) {
+ /**
+ * Version specified by the user. This class looks to see if the browser
+ * version is >= |minChromeVersion_|.
+ * @type {integer}
+ * @private
+ */
+ this.minChromeVersion_ = minChromeVersion;
+
+ /**
+ * List of Browser plugin objects.
+ * @type {Ojbect array}
+ * @private
+ */
+ this.plugins_ = plugins;
+
+ /**
+ * Application version string from the Browser.
+ * @type {integer}
+ * @private
+ */
+ this.appVersion_ = appVersion;
+
+ /**
+ * Flag used to indicate if the browser has Native Client and is if the
+ * browser version is recent enough.
+ * @type {boolean}
+ * @private
+ */
+ this.isValidBrowser_ = false;
+
+ /**
+ * Actual major version of Chrome -- found by querying the browser.
+ * @type {integer}
+ * @private
+ */
+ this.chromeVersion_ = null;
+
+ /**
+ * Browser support status. This allows the user to get a detailed status
+ * rather than using this.browserSupportMessage.
+ */
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.UNKNOWN;
+}
+
+/**
+ * The values used for BrowserChecker status to indicate success or
+ * a specific error.
+ * @enum {id}
+ */
+browser_version.BrowserChecker.StatusValues = {
+ UNKNOWN: 0,
+ NACL_ENABLED: 1,
+ UNKNOWN_BROWSER: 2,
+ CHROME_VERSION_TOO_OLD: 3,
+ NACL_NOT_ENABLED: 4,
+ NOT_USING_SERVER: 5
+};
+
+/**
+ * Determines if the plugin with name |name| exists in the browser.
+ * @param {string} name The name of the plugin.
+ * @param {Object array} plugins The plugins in this browser.
+ * @return {bool} |true| if the plugin is found.
+ */
+browser_version.BrowserChecker.prototype.pluginExists = function(name,
+ plugins) {
+ for (var index=0; index < plugins.length; index++) {
+ var plugin = this.plugins_[index];
+ var plugin_name = plugin['name'];
+ // If the plugin is not found, you can use the Javascript console
+ // to see the names of the plugins that were found when debugging.
+ if (plugin_name.indexOf(name) != -1) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * Returns browserSupportStatus_ which indicates if the browser supports
+ * Native Client. Values are defined as literals in
+ * browser_version.BrowserChecker.StatusValues.
+ * @ return {int} Level of NaCl support.
+ */
+browser_version.BrowserChecker.prototype.getBrowserSupportStatus = function() {
+ return this.browserSupportStatus_;
+}
+
+/**
+ * Returns isValidBrowser (true/false) to indicate if the browser supports
+ * Native Client.
+ * @ return {bool} If this browser has NativeClient and correct version.
+ */
+browser_version.BrowserChecker.prototype.getIsValidBrowser = function() {
+ return this.isValidBrowser_;
+}
+
+/**
+ * Checks to see if this browser can support Native Client applications.
+ * For Chrome browsers, checks to see if the "Native Client" plugin is
+ * enabled.
+ */
+browser_version.BrowserChecker.prototype.checkBrowser = function() {
+ var versionPatt = /Chrome\/(\d+)\.(\d+)\.(\d+)\.(\d+)/;
+ var result = this.appVersion_.match(versionPatt);
+
+ // |result| stores the Chrome version number.
+ if (!result) {
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.UNKNOWN_BROWSER;
+ } else {
+ this.chromeVersion_ = result[1];
+ // We know we have Chrome, check version and/or plugin named Native Client
+ if (this.chromeVersion_ >= this.minChromeVersion_) {
+ var found_nacl = this.pluginExists('Native Client', this.plugins_);
+ if (found_nacl) {
+ this.isValidBrowser_ = true;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.NACL_ENABLED;
+ } else {
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.NACL_NOT_ENABLED;
+ }
+ } else {
+ // We are in a version that is less than |minChromeVersion_|
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.CHROME_VERSION_TOO_OLD;
+ }
+ }
+ var my_protocol = window.location.protocol;
+ if (my_protocol.indexOf('file') == 0) {
+ this.isValidBrowser_ = false;
+ this.browserSupportStatus_ =
+ browser_version.BrowserChecker.StatusValues.NOT_USING_SERVER;
+ }
+}
+
diff --git a/native_client_sdk/src/examples/multithreaded_input_events/Makefile b/native_client_sdk/src/examples/multithreaded_input_events/Makefile
index 1a54e0d..4222dfb 100644
--- a/native_client_sdk/src/examples/multithreaded_input_events/Makefile
+++ b/native_client_sdk/src/examples/multithreaded_input_events/Makefile
@@ -15,10 +15,9 @@
# only the list of sources and project name that will actually change and
# the rest of the makefile is boilerplate for defining build rules.
#
-PROJECT:=multithreaded_input_events
-CXX_SOURCES:=custom_events.cc mt_input_events.cc
+PROJECT:=mt_input_events
LDFLAGS:=-lppapi_cpp -lppapi
-COPY_FILES:=mt_input_events.html mt_input_events.nmf
+CXX_SOURCES:=$(PROJECT).cc custom_events.cc
#
@@ -28,33 +27,19 @@ COPY_FILES:=mt_input_events.html mt_input_events.nmf
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -62,122 +47,30 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
-
-REL:
- $(MKDIR) -p $@
-
-REL/x86_32:
- $(MKDIR) -p $@
-
-REL/x86_64:
- $(MKDIR) -p $@
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+# Define 32 bit compile and link rules for C++ sources
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/pi_generator/Makefile b/native_client_sdk/src/examples/pi_generator/Makefile
index 9e999f6..f80667f 100644
--- a/native_client_sdk/src/examples/pi_generator/Makefile
+++ b/native_client_sdk/src/examples/pi_generator/Makefile
@@ -16,9 +16,8 @@
# the rest of the makefile is boilerplate for defining build rules.
#
PROJECT:=pi_generator
-CXX_SOURCES:=pi_generator.cc pi_generator_module.cc
-COPY_FILES:=pi_generator.html pi_generator.nmf
LDFLAGS:=-lppapi_cpp -lppapi
+CXX_SOURCES:=$(PROJECT).cc pi_generator_module.cc
#
@@ -28,33 +27,19 @@ LDFLAGS:=-lppapi_cpp -lppapi
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -62,122 +47,30 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
-
-REL:
- $(MKDIR) -p $@
-
-REL/x86_32:
- $(MKDIR) -p $@
-
-REL/x86_64:
- $(MKDIR) -p $@
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+# Define 32 bit compile and link rules for C++ sources
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/pong/Makefile b/native_client_sdk/src/examples/pong/Makefile
index 7b02598..a6e8a79 100644
--- a/native_client_sdk/src/examples/pong/Makefile
+++ b/native_client_sdk/src/examples/pong/Makefile
@@ -16,10 +16,8 @@
# the rest of the makefile is boilerplate for defining build rules.
#
PROJECT:=pong
-CXX_SOURCES:=pong_module.cc pong.cc view.cc
-COPY_FILES:=pong.nmf pong.html
LDFLAGS:=-lppapi_cpp -lppapi
-
+CXX_SOURCES:=$(PROJECT).cc pong_module.cc view.cc
#
@@ -29,33 +27,19 @@ LDFLAGS:=-lppapi_cpp -lppapi
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -63,122 +47,30 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
-
-REL:
- $(MKDIR) -p $@
-
-REL/x86_32:
- $(MKDIR) -p $@
-
-REL/x86_64:
- $(MKDIR) -p $@
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+# Define 32 bit compile and link rules for C++ sources
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/sine_synth/Makefile b/native_client_sdk/src/examples/sine_synth/Makefile
index ca9a070..17ca8d9 100644
--- a/native_client_sdk/src/examples/sine_synth/Makefile
+++ b/native_client_sdk/src/examples/sine_synth/Makefile
@@ -16,9 +16,8 @@
# the rest of the makefile is boilerplate for defining build rules.
#
PROJECT:=sine_synth
-CXX_SOURCES:=sine_synth.cc
-COPY_FILES:=sine_synth.nmf sine_synth.html
LDFLAGS:=-lppapi_cpp -lppapi
+CXX_SOURCES:=$(PROJECT).cc
#
@@ -28,33 +27,19 @@ LDFLAGS:=-lppapi_cpp -lppapi
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -62,122 +47,30 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
-
-REL:
- $(MKDIR) -p $@
-
-REL/x86_32:
- $(MKDIR) -p $@
-
-REL/x86_64:
- $(MKDIR) -p $@
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+# Define 32 bit compile and link rules for C++ sources
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py
diff --git a/native_client_sdk/src/examples/tumbler/Makefile b/native_client_sdk/src/examples/tumbler/Makefile
index fb8f32c..ca4b5ac 100644
--- a/native_client_sdk/src/examples/tumbler/Makefile
+++ b/native_client_sdk/src/examples/tumbler/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
+# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -16,12 +16,10 @@
# the rest of the makefile is boilerplate for defining build rules.
#
PROJECT:=tumbler
-CXX_SOURCES:=transforms.cc shader_util.cc opengl_context.cc tumbler_module.cc
-CXX_SOURCES+=scripting_bridge.cc tumbler.cc cube.cc
-COPY_FILES:=tumbler.nmf tumbler.html bind.js dragger.js vector3.js tumbler.js
-COPY_FILES+=trackball.js
LDFLAGS:=-lppapi_gles2 -lppapi_cpp -lppapi
-
+CXX_SOURCES:=$(PROJECT).cc
+CXX_SOURCES+=transforms.cc shader_util.cc opengl_context.cc tumbler_module.cc
+CXX_SOURCES+=scripting_bridge.cc cube.cc
#
# Get pepper directory for toolchain and includes.
@@ -30,33 +28,19 @@ LDFLAGS:=-lppapi_gles2 -lppapi_cpp -lppapi
# from the default example directory location.
#
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
-PEPPER_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
+NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
-DEFINES:=
-INCLUDES:=
WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
-CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS) $(DEFINES) $(INCLUDES)
+CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
#
# Compute tool paths
#
#
-OSNAME:=$(shell python $(PEPPER_ROOT)/tools/getos.py)
-TC_PATH:=$(abspath $(PEPPER_ROOT)/toolchain/$(OSNAME)_x86_newlib)
-CC:=$(TC_PATH)/bin/i686-nacl-gcc
+OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
+TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
-STRIP:=$(TC_PATH)/bin/i686-nacl-strip
-
-#
-# Create shell aliases
-#
-# Create Python based aliases for common shell commands like copy or move.
-#
-COPY = python $(PEPPER_ROOT)/tools/oshelpers.py cp
-MKDIR = python $(PEPPER_ROOT)/tools/oshelpers.py mkdir
-RM = python $(PEPPER_ROOT)/tools/oshelpers.py rm
-MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
#
# Disable DOS PATH warning when using Cygwin based tools Windows
@@ -64,122 +48,30 @@ MV = python $(PEPPER_ROOT)/tools/oshelpers.py mv
CYGWIN ?= nodosfilewarning
export CYGWIN
-#
-# Define a macro for copying files to the configuration directory
-#
-# Copys a source file to the destination directory, removing the base path
-# from the source. Adds a dependency to the destination directory in case it
-# needs to be created.
-#
-# $(1) = Source file
-# $(2) = Destination directory
-define FILE_COPY
-$(2)/$(notdir $(1)) : $(1) | $(2)
- $(COPY) $(1) $(2)
-$(2)_COPIES+=$(2)/$(notdir $(1))
-endef
-
# Declare the ALL target first, to make the 'all' target the default build
-all: DEBUG RELEASE
-
-
-#
-# Debug Build rules.
-#
-DEBUG_x86_32_FLAGS:=-m32 -O0 -g
-DEBUG_x86_64_FLAGS:=-m64 -O0 -g
-DEBUG_x86_32_OBJS:=$(patsubst %.cc,DBG/x86_32/%.o,$(CXX_SOURCES))
-DEBUG_x86_64_OBJS:=$(patsubst %.cc,DBG/x86_64/%.o,$(CXX_SOURCES))
-
-# Create DBG configuration directories
-DBG:
- $(MKDIR) -p $@
-
-DBG/x86_32:
- $(MKDIR) -p $@
-
-DBG/x86_64:
- $(MKDIR) -p $@
-
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),DBG)))
-
-# Include generated dependencies
--include DBG/x86_32/*.d
--include DBG/x86_64/*.d
-
-# Define compile rule for all 32 bit debug objects
-DBG/x86_32/%.o : %.cc $(THIS_MAKE) | DBG/x86_32
- $(CXX) -o $@ -c $< $(DEBUG_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
-
-# Define compile rule for all 64 bit debug objects
-DBG/x86_64/%.o : %.cc $(THIS_MAKE) | DBG/x86_64
- $(CXX) -o $@ -c $< $(DEBUG_x86_64_FLAGS) $(CXXFLAGS)
-
-# Define Link rule for 32 bit debug NEXE
-DBG/$(PROJECT)_x86_32.nexe : $(DEBUG_x86_32_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_32_FLAGS) $(LDFLAGS)
-
-# Define Link rule for 64 bit debug NEXE
-DBG/$(PROJECT)_x86_64.nexe : $(DEBUG_x86_64_OBJS)
- $(CXX) -o $@ $^ $(DEBUG_x86_64_FLAGS) $(LDFLAGS)
-
-# Define a DEBUG alias to build the debug version
-.PHONY : DEBUG RUN_DEBUG
-DEBUG : DBG/$(PROJECT)_x86_32.nexe DBG/$(PROJECT)_x86_64.nexe $(DBG_COPIES)
-
-# Define a RUN_DEBUG alias to build and server the DEBUG version
-RUN_DEBUG: DEBUG
- cd DBG && python ../../httpd.py
-
-
-#
-# Release build rules.
-#
-RELEASE_x86_32_FLAGS:=-m32 -O2 -g
-RELEASE_x86_64_FLAGS:=-m64 -O2 -g
-RELEASE_x86_32_OBJS:=$(patsubst %.cc,REL/x86_32/%.o,$(CXX_SOURCES))
-RELEASE_x86_64_OBJS:=$(patsubst %.cc,REL/x86_64/%.o,$(CXX_SOURCES))
-
-REL:
- $(MKDIR) -p $@
-
-REL/x86_32:
- $(MKDIR) -p $@
-
-REL/x86_64:
- $(MKDIR) -p $@
+all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
-# Copy all files to that config
-$(foreach src,$(COPY_FILES),$(eval $(call FILE_COPY,$(src),REL)))
+# Define 32 bit compile and link rules for C++ sources
+x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
+$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m32 -O0 -g $(CXXFLAGS)
-# Include generated dependencies
--include REL/x86_32/*.d
--include REL/x86_64/*.d
+$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
+ $(CXX) -o $@ $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define compile rule for all 32 bit debug objects
-REL/x86_32/%.o : %.cc $(THIS_MAKE) | REL/x86_32
- $(CXX) -o $@ -c $< $(RELEASE_x86_32_FLAGS) $(CXXFLAGS) -MMD -MF $@.d
+# Define 64 bit compile and link rules for C++ sources
+x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
+$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
+ $(CXX) -o $@ -c $< -m64 -O0 -g $(CXXFLAGS)
-# Define compile rule for all 64 bit debug objects
-REL/x86_64/%.o : %.cc $(THIS_MAKE) | REL/x86_64
- $(CXX) -o $@ -c $< $(RELEASE_x86_64_FLAGS) $(CXXFLAGS)
+$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
+ $(CXX) -o $@ $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
-# Define Link rule for 32 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_32.nexe : $(RELEASE_x86_32_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_32_FLAGS) $(LDFLAGS)
- $(STRIP) $< -o $@
-# Define Link rule for 64 bit optimized and stripped NEXE
-REL/$(PROJECT)_x86_64.nexe : $(RELEASE_x86_64_OBJS)
- $(CXX) -o $@.unstripped $^ $(RELEASE_x86_64_FLAGS) $(LDFLAGS)
- $(STRIP) $@.unstripped -o $@
+# Define a phony rule so it always runs, to build nexe and start up server.
+.PHONY: RUN
+RUN: all
+ python ../httpd.py
-# Define a RELEASE alias to build the debug version
-.PHONY : RELEASE RUN_RELEASE
-RELEASE : REL/$(PROJECT)_x86_32.nexe REL/$(PROJECT)_x86_64.nexe $(REL_COPIES)
-# Define a RUN_RELEASE alias to build and server the RELEASE version
-RUN_RELEASE: RELEASE
- cd REL && python ../../httpd.py