1# Copyright 2016 The Fuchsia Authors
2# Copyright (c) 2008-2015 Travis Geiselbrecht
3#
4# Use of this source code is governed by a MIT-style
5# license that can be found in the LICENSE file or at
6# https://opensource.org/licenses/MIT
7
8# routines and rules to print some helpful stuff
9
10
11#$(warning MAKECMDGOALS = $(MAKECMDGOALS))
12
13# print some help and exit
14ifeq ($(firstword $(MAKECMDGOALS)),help)
15do-nothing=1
16
17.PHONY: help
18help:
19	@echo "Zircon build system quick help"
20	@echo "Individual projects are built into a build-<project> directory"
21	@echo "Environment or command line variables controlling build:"
22	@echo "PROJECT = <project name>"
23	@echo "TOOLCHAIN_PREFIX = <absolute path to toolchain or relative path with prefix>"
24	@echo "EXTERNAL_DEFINES = <additional defines to add to GLOBAL_DEFINES>"
25	@echo "EXTERNAL_KERNEL_DEFINES = <additional defines to add to the kernel build>"
26	@echo "EXTERNAL_MODULES = <additional modules to include in the project build>"
27	@echo "HOST_TARGET = <host target to build the host tools for>"
28	@echo ""
29	@echo "These variables may be also placed in a file called local.mk in the"
30	@echo "root of the zircon build system. local.mk is sourced by the build system"
31	@echo "if present."
32	@echo ""
33	@echo "Special make targets:"
34	@echo "make help: This help"
35	@echo "make list: List of buildable projects"
36	@echo "make clean: cleans build of current project"
37	@echo "make spotless: removes all build directories"
38	@echo "make gigaboot: build the x86 UEFI bootloader"
39	@echo "make bootloader: build the project's bootloader"
40	@echo "make kernel: build the kernel"
41	@echo "make sysroot: build and populate the sysroot"
42	@echo "make tools: build all the host tools"
43	@echo "make <project>: try to build project named <project>"
44	@echo ""
45	@echo "Examples:"
46	@echo "PROJECT=testproject make"
47	@echo "PROJECT=testproject make clean"
48	@echo "make testproject"
49	@echo "make testproject clean"
50	@echo ""
51	@echo "output will be in build-testproject/"
52
53endif
54
55# list projects
56ifeq ($(firstword $(MAKECMDGOALS)),list)
57do-nothing=1
58
59# get a list of all the .mk files in the top level project directories
60PROJECTS:=$(basename $(strip $(foreach d,kernel,$(wildcard $(d)/project/*.mk))))
61PROJECTS:=$(shell basename -a $(PROJECTS))
62
63.PHONY: list
64list:
65	@echo 'List of all buildable projects: (look in project/ directory)'; \
66	for p in $(PROJECTS); do \
67		echo $$p; \
68	done
69
70endif
71
72# vim: set syntax=make noexpandtab
73