| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # | 5 # |
| 6 # GNU Make based build file. For details on GNU Make see: | 6 # GNU Make based build file. For details on GNU Make see: |
| 7 # http://www.gnu.org/software/make/manual/make.html | 7 # http://www.gnu.org/software/make/manual/make.html |
| 8 # | 8 # |
| 9 | 9 |
| 10 # | 10 # |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 .PHONY: all | 218 .PHONY: all |
| 219 | 219 |
| 220 | 220 |
| 221 # | 221 # |
| 222 # The install target is used to install built libraries to thier final destinati
on. | 222 # The install target is used to install built libraries to thier final destinati
on. |
| 223 # By default this is the NaCl SDK 'lib' folder. | 223 # By default this is the NaCl SDK 'lib' folder. |
| 224 # | 224 # |
| 225 install: | 225 install: |
| 226 .PHONY: install | 226 .PHONY: install |
| 227 | 227 |
| 228 ifdef SEL_LDR |
| 229 STANDALONE = 1 |
| 230 endif |
| 228 | 231 |
| 229 OUTBASE ?= . | 232 OUTBASE ?= . |
| 230 ifdef SEL_LDR | 233 ifdef STANDALONE |
| 231 OUTDIR := $(OUTBASE)/$(TOOLCHAIN)/sel_ldr_$(CONFIG) | 234 OUTDIR := $(OUTBASE)/$(TOOLCHAIN)/standalone_$(CONFIG) |
| 232 else | 235 else |
| 233 OUTDIR := $(OUTBASE)/$(TOOLCHAIN)/$(CONFIG) | 236 OUTDIR := $(OUTBASE)/$(TOOLCHAIN)/$(CONFIG) |
| 234 endif | 237 endif |
| 235 STAMPDIR ?= $(OUTDIR) | 238 STAMPDIR ?= $(OUTDIR) |
| 236 LIBDIR ?= $(NACL_SDK_ROOT)/lib | 239 LIBDIR ?= $(NACL_SDK_ROOT)/lib |
| 237 | 240 |
| 238 | 241 |
| 239 # | 242 # |
| 240 # Target to remove temporary files | 243 # Target to remove temporary files |
| 241 # | 244 # |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 $(STAMPDIR)/$(1).stamp: rebuild_$(1) | 284 $(STAMPDIR)/$(1).stamp: rebuild_$(1) |
| 282 | 285 |
| 283 else | 286 else |
| 284 | 287 |
| 285 .PHONY: $(STAMPDIR)/$(1).stamp | 288 .PHONY: $(STAMPDIR)/$(1).stamp |
| 286 $(STAMPDIR)/$(1).stamp: | 289 $(STAMPDIR)/$(1).stamp: |
| 287 @echo Ignore $(1) | 290 @echo Ignore $(1) |
| 288 endif | 291 endif |
| 289 endef | 292 endef |
| 290 | 293 |
| 291 | |
| 292 ifeq ($(TOOLCHAIN),win) | 294 ifeq ($(TOOLCHAIN),win) |
| 295 ifdef STANDALONE |
| 296 HOST_EXT = .exe |
| 297 else |
| 293 HOST_EXT = .dll | 298 HOST_EXT = .dll |
| 299 endif |
| 300 else |
| 301 ifdef STANDALONE |
| 302 HOST_EXT = |
| 294 else | 303 else |
| 295 HOST_EXT = .so | 304 HOST_EXT = .so |
| 296 endif | 305 endif |
| 306 endif |
| 297 | 307 |
| 298 | 308 |
| 299 # | 309 # |
| 300 # Common Compile Options | 310 # Common Compile Options |
| 301 # | 311 # |
| 302 # For example, -DNDEBUG is added to release builds by default | 312 # For example, -DNDEBUG is added to release builds by default |
| 303 # so that calls to assert(3) are not included in the build. | 313 # so that calls to assert(3) are not included in the build. |
| 304 # | 314 # |
| 305 ifeq ($(CONFIG),Release) | 315 ifeq ($(CONFIG),Release) |
| 306 POSIX_FLAGS ?= -g -O2 -pthread -MMD -DNDEBUG | 316 POSIX_FLAGS ?= -g -O2 -pthread -MMD -DNDEBUG |
| 307 NACL_LDFLAGS ?= -O2 | 317 NACL_LDFLAGS ?= -O2 |
| 308 PNACL_LDFLAGS ?= -O2 | 318 PNACL_LDFLAGS ?= -O2 |
| 309 else | 319 else |
| 310 POSIX_FLAGS ?= -g -O0 -pthread -MMD -DNACL_SDK_DEBUG | 320 POSIX_FLAGS ?= -g -O0 -pthread -MMD -DNACL_SDK_DEBUG |
| 311 endif | 321 endif |
| 312 | 322 |
| 313 ifdef SEL_LDR | 323 ifdef STANDALONE |
| 314 POSIX_FLAGS += -DSEL_LDR=1 | 324 POSIX_FLAGS += -DSEL_LDR=1 |
| 315 endif | 325 endif |
| 316 | 326 |
| 317 NACL_CFLAGS ?= -Wno-long-long -Werror | 327 NACL_CFLAGS ?= -Wno-long-long -Werror |
| 318 NACL_CXXFLAGS ?= -Wno-long-long -Werror | 328 NACL_CXXFLAGS ?= -Wno-long-long -Werror |
| 319 NACL_LDFLAGS += -Wl,-as-needed | 329 NACL_LDFLAGS += -Wl,-as-needed -pthread |
| 320 | 330 |
| 321 # | 331 # |
| 322 # Default Paths | 332 # Default Paths |
| 323 # | 333 # |
| 324 ifeq (,$(findstring $(TOOLCHAIN),linux mac win)) | 334 ifeq (,$(findstring $(TOOLCHAIN),linux mac win)) |
| 325 INC_PATHS ?= $(NACL_SDK_ROOT)/include $(NACL_SDK_ROOT)/include/$(TOOLCHAIN) $(EX
TRA_INC_PATHS) | 335 INC_PATHS ?= $(NACL_SDK_ROOT)/include $(NACL_SDK_ROOT)/include/$(TOOLCHAIN) $(EX
TRA_INC_PATHS) |
| 326 else | 336 else |
| 327 INC_PATHS ?= $(NACL_SDK_ROOT)/include/$(OSNAME) $(NACL_SDK_ROOT)/include $(EXTRA
_INC_PATHS) | 337 INC_PATHS ?= $(NACL_SDK_ROOT)/include/$(OSNAME) $(NACL_SDK_ROOT)/include $(EXTRA
_INC_PATHS) |
| 328 endif | 338 endif |
| 329 | 339 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 424 |
| 415 # | 425 # |
| 416 # File to redirect to to in order to hide output. | 426 # File to redirect to to in order to hide output. |
| 417 # | 427 # |
| 418 ifeq ($(OSNAME),win) | 428 ifeq ($(OSNAME),win) |
| 419 DEV_NULL = nul | 429 DEV_NULL = nul |
| 420 else | 430 else |
| 421 DEV_NULL = /dev/null | 431 DEV_NULL = /dev/null |
| 422 endif | 432 endif |
| 423 | 433 |
| 424 # | |
| 425 # Assign a sensible default to CHROME_PATH. | |
| 426 # | |
| 427 CHROME_PATH ?= $(shell $(GETOS) --chrome 2> $(DEV_NULL)) | |
| 428 | |
| 429 # | |
| 430 # Verify we can find the Chrome executable if we need to launch it. | |
| 431 # | |
| 432 .PHONY: check_for_chrome | |
| 433 check_for_chrome: | |
| 434 ifeq (,$(wildcard $(CHROME_PATH))) | |
| 435 $(warning No valid Chrome found at CHROME_PATH=$(CHROME_PATH)) | |
| 436 $(error Set CHROME_PATH via an environment variable, or command-line.) | |
| 437 else | |
| 438 $(warning Using chrome at: $(CHROME_PATH)) | |
| 439 endif | |
| 440 | |
| 441 | 434 |
| 442 # | 435 # |
| 443 # Variables for running examples with Chrome. | 436 # Variables for running examples with Chrome. |
| 444 # | 437 # |
| 445 RUN_PY := python $(NACL_SDK_ROOT)/tools/run.py | 438 RUN_PY := python $(NACL_SDK_ROOT)/tools/run.py |
| 446 HTTPD_PY := python $(NACL_SDK_ROOT)/tools/httpd.py | 439 HTTPD_PY := python $(NACL_SDK_ROOT)/tools/httpd.py |
| 447 | 440 |
| 448 # Add this to launch Chrome with additional environment variables defined. | 441 # Add this to launch Chrome with additional environment variables defined. |
| 449 # Each element should be specified as KEY=VALUE, with whitespace separating | 442 # Each element should be specified as KEY=VALUE, with whitespace separating |
| 450 # key-value pairs. e.g. | 443 # key-value pairs. e.g. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 464 SYSARCH := $(shell $(GETOS) --nacl-arch) | 457 SYSARCH := $(shell $(GETOS) --nacl-arch) |
| 465 SEL_LDR_PATH := python $(NACL_SDK_ROOT)/tools/sel_ldr.py | 458 SEL_LDR_PATH := python $(NACL_SDK_ROOT)/tools/sel_ldr.py |
| 466 | 459 |
| 467 # | 460 # |
| 468 # Common Compile Options | 461 # Common Compile Options |
| 469 # | 462 # |
| 470 ifeq ($(CONFIG),Debug) | 463 ifeq ($(CONFIG),Debug) |
| 471 SEL_LDR_ARGS += --debug-libs | 464 SEL_LDR_ARGS += --debug-libs |
| 472 endif | 465 endif |
| 473 | 466 |
| 474 ifdef SEL_LDR | 467 ifndef STANDALONE |
| 475 run: all | 468 # |
| 476 ifndef NACL_ARCH | 469 # Assign a sensible default to CHROME_PATH. |
| 477 » $(error Cannot run in sel_ldr unless $$NACL_ARCH is set) | 470 # |
| 471 CHROME_PATH ?= $(shell $(GETOS) --chrome 2> $(DEV_NULL)) |
| 472 |
| 473 # |
| 474 # Verify we can find the Chrome executable if we need to launch it. |
| 475 # |
| 476 .PHONY: check_for_chrome |
| 477 check_for_chrome: |
| 478 ifeq (,$(wildcard $(CHROME_PATH))) |
| 479 » $(warning No valid Chrome found at CHROME_PATH=$(CHROME_PATH)) |
| 480 » $(error Set CHROME_PATH via an environment variable, or command-line.) |
| 481 else |
| 482 » $(warning Using chrome at: $(CHROME_PATH)) |
| 478 endif | 483 endif |
| 479 $(SEL_LDR_PATH) $(SEL_LDR_ARGS) $(OUTDIR)/$(TARGET)_$(NACL_ARCH).nexe --
$(NEXE_ARGS) | |
| 480 | |
| 481 debug: all | |
| 482 ifndef NACL_ARCH | |
| 483 $(error Cannot run in sel_ldr unless $$NACL_ARCH is set) | |
| 484 endif | |
| 485 $(SEL_LDR_PATH) -d $(SEL_LDR_ARGS) $(OUTDIR)/$(TARGET)_$(NACL_ARCH).nexe
-- $(NEXE_ARGS) | |
| 486 else | |
| 487 PAGE ?= index.html | 484 PAGE ?= index.html |
| 488 PAGE_TC_CONFIG ?= "$(PAGE)?tc=$(TOOLCHAIN)&config=$(CONFIG)" | 485 PAGE_TC_CONFIG ?= "$(PAGE)?tc=$(TOOLCHAIN)&config=$(CONFIG)" |
| 489 | 486 |
| 490 .PHONY: run | 487 .PHONY: run |
| 491 run: check_for_chrome all $(PAGE) | 488 run: check_for_chrome all $(PAGE) |
| 492 $(RUN_PY) -C $(CURDIR) -P $(PAGE_TC_CONFIG) \ | 489 $(RUN_PY) -C $(CURDIR) -P $(PAGE_TC_CONFIG) \ |
| 493 $(addprefix -E ,$(CHROME_ENV)) -- $(CHROME_PATH) $(CHROME_ARGS) \ | 490 $(addprefix -E ,$(CHROME_ENV)) -- $(CHROME_PATH) $(CHROME_ARGS) \ |
| 494 --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" | 491 --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" |
| 495 | 492 |
| 496 .PHONY: run_package | 493 .PHONY: run_package |
| 497 run_package: check_for_chrome all | 494 run_package: check_for_chrome all |
| 498 @echo "$(TOOLCHAIN) $(CONFIG)" > $(CURDIR)/run_package_config | 495 @echo "$(TOOLCHAIN) $(CONFIG)" > $(CURDIR)/run_package_config |
| 499 $(CHROME_PATH) --load-and-launch-app=$(CURDIR) $(CHROME_ARGS) | 496 $(CHROME_PATH) --load-and-launch-app=$(CURDIR) $(CHROME_ARGS) |
| 500 | 497 |
| 501 GDB_ARGS += -D $(TC_PATH)/$(OSNAME)_x86_newlib/bin/$(SYSARCH)-nacl-gdb | 498 GDB_ARGS += -D $(TC_PATH)/$(OSNAME)_x86_newlib/bin/$(SYSARCH)-nacl-gdb |
| 502 GDB_ARGS += -D --eval-command="nacl-manifest $(abspath $(OUTDIR))/$(TARGET).nmf" | 499 GDB_ARGS += -D --eval-command="nacl-manifest $(abspath $(OUTDIR))/$(TARGET).nmf" |
| 503 GDB_ARGS += -D $(GDB_DEBUG_TARGET) | 500 GDB_ARGS += -D $(GDB_DEBUG_TARGET) |
| 504 | 501 |
| 505 .PHONY: debug | 502 .PHONY: debug |
| 506 debug: check_for_chrome all $(PAGE) | 503 debug: check_for_chrome all $(PAGE) |
| 507 $(RUN_PY) $(GDB_ARGS) \ | 504 $(RUN_PY) $(GDB_ARGS) \ |
| 508 -C $(CURDIR) -P $(PAGE_TC_CONFIG) \ | 505 -C $(CURDIR) -P $(PAGE_TC_CONFIG) \ |
| 509 $(addprefix -E ,$(CHROME_ENV)) -- $(CHROME_PATH) $(CHROME_ARGS) \ | 506 $(addprefix -E ,$(CHROME_ENV)) -- $(CHROME_PATH) $(CHROME_ARGS) \ |
| 510 --enable-nacl-debug \ | 507 --enable-nacl-debug \ |
| 511 --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" | 508 --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" |
| 512 endif | |
| 513 | 509 |
| 514 .PHONY: serve | 510 .PHONY: serve |
| 515 serve: all | 511 serve: all |
| 516 $(HTTPD_PY) -C $(CURDIR) | 512 $(HTTPD_PY) -C $(CURDIR) |
| 517 | 513 endif |
| 518 | 514 |
| 519 # uppercase aliases (for backward compatibility) | 515 # uppercase aliases (for backward compatibility) |
| 520 .PHONY: CHECK_FOR_CHROME DEBUG LAUNCH RUN | 516 .PHONY: CHECK_FOR_CHROME DEBUG LAUNCH RUN |
| 521 CHECK_FOR_CHROME: check_for_chrome | 517 CHECK_FOR_CHROME: check_for_chrome |
| 522 DEBUG: debug | 518 DEBUG: debug |
| 523 LAUNCH: run | 519 LAUNCH: run |
| 524 RUN: run | 520 RUN: run |
| 525 | 521 |
| 526 endif # TOOLCHAIN is valid... | 522 endif # TOOLCHAIN is valid... |
| 527 | 523 |
| 528 endif # TOOLCHAIN=all | 524 endif # TOOLCHAIN=all |
| OLD | NEW |