summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-20 20:11:10 +0000
committerbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-20 20:11:10 +0000
commit38e691a7ab6c7ad4f27ea946e1ccc1bcfff6330a (patch)
tree33960aec4a57a27d8a20cf21f5ddf45f61302370 /native_client_sdk
parente53cc1f7b49bf35bfbb435cd0764f66278d47e55 (diff)
downloadchromium_src-38e691a7ab6c7ad4f27ea946e1ccc1bcfff6330a.zip
chromium_src-38e691a7ab6c7ad4f27ea946e1ccc1bcfff6330a.tar.gz
chromium_src-38e691a7ab6c7ad4f27ea946e1ccc1bcfff6330a.tar.bz2
[NaCl SDK] Add "make serve" PHONY target.
* getting_started/part1 only allows "make serve" not "make run", nor "make debug". * All examples now support "make serve", which will only run the server, not launch Chrome. * example directories' Makefiles now support "make serve" as well. We never really supported "make run" from a directory anyway, it would just launch the server. Now it's more explicit. BUG=none R=eliben@chromium.org, noelallen@chromium.org Review URL: https://codereview.chromium.org/24246010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224470 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/src/getting_started/part1/Makefile41
-rw-r--r--native_client_sdk/src/resources/Makefile.index.template11
-rw-r--r--native_client_sdk/src/tools/common.mk5
3 files changed, 16 insertions, 41 deletions
diff --git a/native_client_sdk/src/getting_started/part1/Makefile b/native_client_sdk/src/getting_started/part1/Makefile
index f35cef5..2efe770 100644
--- a/native_client_sdk/src/getting_started/part1/Makefile
+++ b/native_client_sdk/src/getting_started/part1/Makefile
@@ -54,41 +54,10 @@ hello_tutorial.pexe: hello_tutorial.bc
#
-# File to redirect to to in order to hide output.
+# Makefile target to run the SDK's simple HTTP server and serve this example.
#
-ifeq ($(OSNAME),win)
-DEV_NULL = nul
-else
-DEV_NULL = /dev/null
-endif
+HTTPD_PY := python $(NACL_SDK_ROOT)/tools/httpd.py
-#
-# Assign a sensible default to CHROME_PATH.
-#
-CHROME_PATH ?= $(shell $(GETOS) --chrome 2> $(DEV_NULL))
-
-#
-# Verify we can find the Chrome executable if we need to launch it.
-#
-.PHONY: check_for_chrome
-check_for_chrome:
-ifeq (,$(wildcard $(CHROME_PATH)))
- $(warning No valid Chrome found at CHROME_PATH=$(CHROME_PATH))
- $(error Set CHROME_PATH via an environment variable, or command-line.)
-else
- $(warning Using chrome at: $(CHROME_PATH))
-endif
-
-#
-# Variables for running examples with Chrome.
-#
-RUN_PY := python $(NACL_SDK_ROOT)/tools/run.py
-
-# Additional arguments to pass to Chrome.
-CHROME_ARGS += --enable-pnacl --no-first-run
-CHROME_ARGS += --user-data-dir=$(CURDIR)/user-data-dir
-
-# Define a phony rule so it always runs, to run the pexe.
-.PHONY: run
-run: check_for_chrome all
- $(RUN_PY) -C $(CURDIR) -P index.html -- $(CHROME_PATH) $(CHROME_ARGS)
+.PHONY: serve
+serve: all
+ $(HTTPD_PY) -C $(CURDIR)
diff --git a/native_client_sdk/src/resources/Makefile.index.template b/native_client_sdk/src/resources/Makefile.index.template
index 84110b5..10a2e31 100644
--- a/native_client_sdk/src/resources/Makefile.index.template
+++ b/native_client_sdk/src/resources/Makefile.index.template
@@ -7,12 +7,12 @@
#   http://www.gnu.org/software/make/manual/make.html
#
-PROJECTS:= \
+PROJECTS := \
[[for project in projects:]]
{{project}} \
[[]]
-HTTPD:={{rel_sdk}}/tools/httpd.py
+HTTPD_PY := python {{rel_sdk}}/tools/httpd.py
ifeq ($(TOOLCHAIN),all)
TOOLCHAIN_ARG:=TOOLCHAIN=all
@@ -54,13 +54,14 @@ all: $(ALL_TARGET_LIST)
clean: $(CLEAN_TARGET_LIST)
@echo Done cleaning targets.
-.PHONY: run
-run: all
+.PHONY: serve
+serve: all
@echo Starting up python webserver.
- python $(HTTPD)
+ @$(HTTPD_PY)
# Phony aliases for backward compatibility
RUN: run
+run: serve
all_versions:
+$(MAKE) TOOLCHAIN=all
diff --git a/native_client_sdk/src/tools/common.mk b/native_client_sdk/src/tools/common.mk
index 6182faa..313d270 100644
--- a/native_client_sdk/src/tools/common.mk
+++ b/native_client_sdk/src/tools/common.mk
@@ -426,6 +426,7 @@ endif
# Variables for running examples with Chrome.
#
RUN_PY := python $(NACL_SDK_ROOT)/tools/run.py
+HTTPD_PY := python $(NACL_SDK_ROOT)/tools/httpd.py
# Add this to launch Chrome with additional environment variables defined.
# Each element should be specified as KEY=VALUE, with whitespace separating
@@ -492,6 +493,10 @@ debug: check_for_chrome all $(PAGE)
--register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)"
endif
+.PHONY: serve
+serve: all
+ $(HTTPD_PY) -C $(CURDIR)
+
# uppercase aliases (for backward compatibility)
.PHONY: CHECK_FOR_CHROME DEBUG LAUNCH RUN