| 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 PROJECTS:= \ | 10 PROJECTS:= \ |
| 11 [[for project in projects:]] | 11 [[for project in projects:]] |
| 12 {{project}} \ | 12 {{project}} \ |
| 13 [[]] | 13 [[]] |
| 14 | 14 |
| 15 HTTPD:={{rel_sdk}}/tools/httpd.py | 15 HTTPD:={{rel_sdk}}/tools/httpd.py |
| 16 | 16 |
| 17 ifeq ($(TOOLCHAIN),all) |
| 18 TOOLCHAIN_ARG:=TOOLCHAIN=all |
| 19 endif |
| 20 |
| 17 # Define the default target | 21 # Define the default target |
| 18 all: | 22 all: |
| 19 | 23 |
| 20 # | 24 # |
| 21 # Target Macro | 25 # Target Macro |
| 22 # | 26 # |
| 23 # Macro defines a phony target for each example, and adds it to a list of | 27 # Macro defines a phony target for each example, and adds it to a list of |
| 24 # targets. | 28 # targets. |
| 25 # | 29 # |
| 30 # Note: We use targets for each project (instead of an explicit recipe) so |
| 31 # each project can be built in parallel. |
| 32 # |
| 26 define TARGET | 33 define TARGET |
| 27 TARGET_LIST+=$(1)_TARGET | 34 TARGET_LIST+=$(1)_TARGET |
| 28 .PHONY: $(1)_TARGET | 35 .PHONY: $(1)_TARGET |
| 29 $(1)_TARGET: | 36 $(1)_TARGET: |
| 30 » +$(MAKE) -C $(1) | 37 » +$(MAKE) -C $(1) $(TOOLCHAIN_ARG) $(MAKECMDGOALS) |
| 31 | |
| 32 VERSIONS_LIST+=$(1)_VERSIONS | |
| 33 .PHONY: $(1)_VERSIONS | |
| 34 $(1)_VERSIONS: | |
| 35 » +$(MAKE) -C $(1) all_versions | |
| 36 | |
| 37 CLEAN_LIST+=$(1)_CLEAN | |
| 38 .PHONY: $(1)_CLEAN | |
| 39 $(1)_CLEAN: | |
| 40 » +$(MAKE) -C $(1) clean | |
| 41 endef | 38 endef |
| 42 | 39 |
| 43 | 40 |
| 44 # Define the various targets via the Macro | 41 # Define the various targets via the Macro |
| 45 $(foreach proj,$(PROJECTS),$(eval $(call TARGET,$(proj)))) | 42 $(foreach proj,$(PROJECTS),$(eval $(call TARGET,$(proj)))) |
| 46 | 43 |
| 44 .PHONY: all |
| 47 all: $(TARGET_LIST) | 45 all: $(TARGET_LIST) |
| 48 @echo Done building targets. | 46 @echo Done building targets. |
| 49 | 47 |
| 50 all_versions: $(VERSIONS_LIST) | 48 .PHONY: clean |
| 51 » @echo Done building all versions. | 49 clean: $(TARGET_LIST) |
| 52 | |
| 53 clean: $(CLEAN_LIST) | |
| 54 @echo Done cleaning targets. | 50 @echo Done cleaning targets. |
| 55 | 51 |
| 52 .PHONY: run |
| 56 run: all | 53 run: all |
| 57 @echo Starting up python webserver. | 54 @echo Starting up python webserver. |
| 58 python $(HTTPD) | 55 python $(HTTPD) |
| 59 | 56 |
| 60 # uppercase aliases (for backward compatibility) | 57 # Phony aliases for backward compatibility |
| 61 RUN: run | 58 RUN: run |
| 62 | 59 |
| 63 .PHONY: RUN run | 60 all_versions: |
| 61 » +$(MAKE) TOOLCHAIN=all |
| 62 |
| 63 .PHONY: RUN all_versions |
| OLD | NEW |