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