| 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 | |
| 11 # | 10 # |
| 12 # Toolchain | 11 # Toolchain |
| 13 # | 12 # |
| 14 # By default the VALID_TOOLCHAINS list contains newlib and glibc. If your | 13 # By default the VALID_TOOLCHAINS list contains newlib and glibc. If your |
| 15 # project only builds in one or the other then this should be overridden | 14 # project only builds in one or the other then this should be overridden |
| 16 # accordingly. | 15 # accordingly. |
| 17 # | 16 # |
| 18 VALID_TOOLCHAINS?=newlib glibc | 17 VALID_TOOLCHAINS?=newlib glibc |
| 19 TOOLCHAIN?=$(word 1,$(VALID_TOOLCHAINS)) | 18 TOOLCHAIN?=$(word 1,$(VALID_TOOLCHAINS)) |
| 20 | 19 |
| 21 | 20 |
| 22 # | 21 # |
| 23 # Top Make file, which we want to trigger a rebuild on if it changes | 22 # Top Make file, which we want to trigger a rebuild on if it changes |
| 24 # | 23 # |
| 25 TOP_MAKE:=$(word 1,$(MAKEFILE_LIST)) | 24 TOP_MAKE:=$(word 1,$(MAKEFILE_LIST)) |
| 26 | 25 |
| 27 | 26 |
| 28 # | 27 # |
| 29 # Figure out which OS we are running on. | 28 # Figure out which OS we are running on. |
| 30 # | 29 # |
| 31 GETOS=python $(NACL_SDK_ROOT)/tools/getos.py | 30 GETOS=python $(NACL_SDK_ROOT)/tools/getos.py |
| 32 OSNAME:=$(shell $(GETOS)) | 31 OSNAME:=$(shell $(GETOS)) |
| 33 | 32 |
| 34 | 33 |
| 35 # | 34 # |
| 35 # TOOLCHAIN=all recursively calls this Makefile for all VALID_TOOLCHAINS. |
| 36 # |
| 37 ifeq ($(TOOLCHAIN),all) |
| 38 |
| 39 # Define the default target |
| 40 all: |
| 41 |
| 42 # |
| 43 # Generate a new MAKE command for each TOOLCHAIN. |
| 44 # |
| 45 # Note: We use targets for each toolchain (instead of an explicit recipe) so |
| 46 # each toolchain can be built in parallel. |
| 47 # |
| 48 # $1 = Toolchain Name |
| 49 # |
| 50 define TOOLCHAIN_RULE |
| 51 TOOLCHAIN_TARGETS += $(1)_TARGET |
| 52 .PHONY: $(1)_TARGET |
| 53 $(1)_TARGET: |
| 54 +$(MAKE) TOOLCHAIN=$(1) $(MAKECMDGOALS) |
| 55 endef |
| 56 |
| 57 # |
| 58 # The target for all versions |
| 59 # |
| 60 USABLE_TOOLCHAINS=$(filter $(OSNAME) newlib glibc pnacl,$(VALID_TOOLCHAINS)) |
| 61 |
| 62 ifeq ($(NO_HOST_BUILDS),1) |
| 63 USABLE_TOOLCHAINS:=$(filter-out $(OSNAME),$(USABLE_TOOLCHAINS)) |
| 64 endif |
| 65 |
| 66 # Define the toolchain targets for all usable toolchains via the macro. |
| 67 $(foreach tool,$(USABLE_TOOLCHAINS),$(eval $(call TOOLCHAIN_RULE,$(tool)))) |
| 68 |
| 69 .PHONY: all clean install |
| 70 all: $(TOOLCHAIN_TARGETS) |
| 71 clean: $(TOOLCHAIN_TARGETS) |
| 72 install: $(TOOLCHAIN_TARGETS) |
| 73 |
| 74 else # TOOLCHAIN=all |
| 75 |
| 76 # |
| 36 # Verify we selected a valid toolchain for this example | 77 # Verify we selected a valid toolchain for this example |
| 37 # | 78 # |
| 38 ifeq (,$(findstring $(TOOLCHAIN),$(VALID_TOOLCHAINS))) | 79 ifeq (,$(findstring $(TOOLCHAIN),$(VALID_TOOLCHAINS))) |
| 39 $(warning Availbile choices are: $(VALID_TOOLCHAINS)) | 80 $(warning Availbile choices are: $(VALID_TOOLCHAINS)) |
| 40 $(error Can not use TOOLCHAIN=$(TOOLCHAIN) on this example.) | 81 $(error Can not use TOOLCHAIN=$(TOOLCHAIN) on this example.) |
| 41 endif | 82 endif |
| 42 | 83 |
| 43 | 84 |
| 44 # | 85 # |
| 45 # Build Configuration | 86 # Build Configuration |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 190 |
| 150 | 191 |
| 151 # | 192 # |
| 152 # The install target is used to install built libraries to thier final destinati
on. | 193 # The install target is used to install built libraries to thier final destinati
on. |
| 153 # By default this is the NaCl SDK 'lib' folder. | 194 # By default this is the NaCl SDK 'lib' folder. |
| 154 # | 195 # |
| 155 install: | 196 install: |
| 156 .PHONY: install | 197 .PHONY: install |
| 157 | 198 |
| 158 | 199 |
| 159 # | |
| 160 # Target a toolchain | |
| 161 # | |
| 162 # $1 = Toolchain Name | |
| 163 # | |
| 164 define TOOLCHAIN_RULE | |
| 165 .PHONY: all_$(1) | |
| 166 all_$(1): | |
| 167 +$(MAKE) TOOLCHAIN=$(1) | |
| 168 TOOLCHAIN_LIST+=all_$(1) | |
| 169 endef | |
| 170 | |
| 171 | |
| 172 # | |
| 173 # The target for all versions | |
| 174 # | |
| 175 USABLE_TOOLCHAINS=$(filter $(OSNAME) newlib glibc pnacl,$(VALID_TOOLCHAINS)) | |
| 176 | |
| 177 ifeq ($(NO_HOST_BUILDS),1) | |
| 178 USABLE_TOOLCHAINS:=$(filter-out $(OSNAME),$(USABLE_TOOLCHAINS)) | |
| 179 endif | |
| 180 | |
| 181 $(foreach tool,$(USABLE_TOOLCHAINS),$(eval $(call TOOLCHAIN_RULE,$(tool),$(dep))
)) | |
| 182 | |
| 183 .PHONY: all_versions | |
| 184 all_versions: $(TOOLCHAIN_LIST) | |
| 185 | |
| 186 | |
| 187 OUTBASE?=. | 200 OUTBASE?=. |
| 188 OUTDIR:=$(OUTBASE)/$(TOOLCHAIN)/$(CONFIG) | 201 OUTDIR:=$(OUTBASE)/$(TOOLCHAIN)/$(CONFIG) |
| 189 STAMPDIR?=$(OUTDIR) | 202 STAMPDIR?=$(OUTDIR) |
| 190 LIBDIR?=$(NACL_SDK_ROOT)/lib | 203 LIBDIR?=$(NACL_SDK_ROOT)/lib |
| 191 | 204 |
| 192 | 205 |
| 193 # | 206 # |
| 194 # Target to remove temporary files | 207 # Target to remove temporary files |
| 195 # | 208 # |
| 196 .PHONY: clean | 209 .PHONY: clean |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 --enable-nacl-debug \ | 433 --enable-nacl-debug \ |
| 421 --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" | 434 --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" |
| 422 | 435 |
| 423 | 436 |
| 424 # uppercase aliases (for backward compatibility) | 437 # uppercase aliases (for backward compatibility) |
| 425 .PHONY: CHECK_FOR_CHROME DEBUG LAUNCH RUN | 438 .PHONY: CHECK_FOR_CHROME DEBUG LAUNCH RUN |
| 426 CHECK_FOR_CHROME: check_for_chrome | 439 CHECK_FOR_CHROME: check_for_chrome |
| 427 DEBUG: debug | 440 DEBUG: debug |
| 428 LAUNCH: run | 441 LAUNCH: run |
| 429 RUN: run | 442 RUN: run |
| 443 |
| 444 endif # TOOLCHAIN=all |
| OLD | NEW |