• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15HTTPD_PY := python {{rel_sdk}}/tools/httpd.py
16
17ifeq ($(TOOLCHAIN),all)
18TOOLCHAIN_ARG:=TOOLCHAIN=all
19endif
20
21# Define the default target
22all:
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#
33define TARGET
34ALL_TARGET_LIST+=$(1)_ALL_TARGET
35.PHONY: $(1)_ALL_TARGET
36$(1)_ALL_TARGET:
37	+$(MAKE) -C $(1) $(TOOLCHAIN_ARG) all
38
39CLEAN_TARGET_LIST+=$(1)_CLEAN_TARGET
40.PHONY: $(1)_CLEAN_TARGET
41$(1)_CLEAN_TARGET:
42	+$(MAKE) -C $(1) $(TOOLCHAIN_ARG) clean
43endef
44
45
46# Define the various targets via the Macro
47$(foreach proj,$(PROJECTS),$(eval $(call TARGET,$(proj))))
48
49.PHONY: all
50all: $(ALL_TARGET_LIST)
51	@echo Done building targets.
52
53.PHONY: clean
54clean: $(CLEAN_TARGET_LIST)
55	@echo Done cleaning targets.
56
57.PHONY: serve
58serve: all
59	@echo Starting up python webserver.
60	@$(HTTPD_PY)
61
62# Phony aliases for backward compatibility
63RUN: run
64run: serve
65
66all_versions:
67	+$(MAKE) TOOLCHAIN=all
68
69.PHONY: RUN all_versions
70