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 3 # found in the LICENSE file. 4 5 # 6 # GNU Make based build file. For details on GNU Make see: 7 # http://www.gnu.org/software/make/manual/make.html 8 # 9 10 PROJECTS:= \ 11 [[for project in projects:]] 12 {{project}} \ 13 [[]] 14 15 HTTPD:={{rel_sdk}}/tools/httpd.py 16 17 ifeq ($(TOOLCHAIN),all) 18 TOOLCHAIN_ARG:=TOOLCHAIN=all 19 endif 20 21 # Define the default target 22 all: 23 24 # 25 # Target Macro 26 # 27 # Macro defines a phony target for each example, and adds it to a list of 28 # targets. 29 # 30 # Note: We use targets for each project (instead of an explicit recipe) so 31 # each project can be built in parallel. 32 # 33 define TARGET 34 ALL_TARGET_LIST+=$(1)_ALL_TARGET 35 .PHONY: $(1)_ALL_TARGET 36 $(1)_ALL_TARGET: 37 +$(MAKE) -C $(1) $(TOOLCHAIN_ARG) all 38 39 CLEAN_TARGET_LIST+=$(1)_CLEAN_TARGET 40 .PHONY: $(1)_CLEAN_TARGET 41 $(1)_CLEAN_TARGET: 42 +$(MAKE) -C $(1) $(TOOLCHAIN_ARG) clean 43 endef 44 45 46 # Define the various targets via the Macro 47 $(foreach proj,$(PROJECTS),$(eval $(call TARGET,$(proj)))) 48 49 .PHONY: all 50 all: $(ALL_TARGET_LIST) 51 @echo Done building targets. 52 53 .PHONY: clean 54 clean: $(CLEAN_TARGET_LIST) 55 @echo Done cleaning targets. 56 57 .PHONY: run 58 run: all 59 @echo Starting up python webserver. 60 python $(HTTPD) 61 62 # Phony aliases for backward compatibility 63 RUN: run 64 65 all_versions: 66 +$(MAKE) TOOLCHAIN=all 67 68 .PHONY: RUN all_versions 69