1# routines and rules to print some helpful stuff
2
3
4#$(warning MAKECMDGOALS = $(MAKECMDGOALS))
5
6# print some help and exit
7ifeq ($(firstword $(MAKECMDGOALS)),help)
8do-nothing=1
9
10.PHONY: help
11help:
12	@echo "LK build system quick help"
13	@echo "Individual projects are built into a build-<project> directory"
14	@echo "Output binary is located at build-<project>/lk.bin"
15	@echo ""
16	@echo "Environment or command line variables controlling build:"
17	@echo "PROJECT = <project name>"
18	@echo "TOOLCHAIN_PREFIX = <absolute path to toolchain or relative path with prefix>"
19	@echo "WERROR = 1 : treat warnings as errors"
20	@echo "DEBUG = 0,1,2 : set debug level (0=NONE, 1=INFO, 2=DEBUG), default is 2"
21	@echo "BUILDDIR = <path to build directory> (default is build-<project>)"
22	@echo "BUILDDIR_SUFFIX = <suffix to add to build directory> (default is empty)"
23	@echo ""
24	@echo "Special make targets:"
25	@echo "make help: This help"
26	@echo "make list: List of buildable projects"
27	@echo "make clean: cleans build of current project"
28	@echo "make spotless: removes all build directories"
29	@echo "make tags: run ctags on all of the source files for the current project"
30	@echo "make <project>: try to build project named <project>"
31	@echo ""
32	@echo "make list-arch: print the architecture of the current project"
33	@echo "make list-toolchain: print the computed toolchain prefix of the current project"
34	@echo ""
35	@echo "Examples:"
36	@echo "PROJECT=testproject make"
37	@echo "PROJECT=testproject make clean"
38	@echo "make testproject"
39	@echo "make testproject clean"
40	@echo ""
41	@echo "output will be in build-testproject/"
42	@echo ""
43	@echo "Check the project/ directory for available projects"
44	@echo "and their rules.mk files for more information."
45
46endif
47
48# list projects
49ifeq ($(firstword $(MAKECMDGOALS)),list)
50do-nothing=1
51
52# get a list of all the .mk files in the top level project directories
53PROJECTS:=$(basename $(strip $(foreach d,$(LKINC),$(wildcard $(d)/project/*.mk))))
54PROJECTS:=$(shell basename -a $(PROJECTS))
55
56.PHONY: list
57list:
58	@echo 'List of all buildable projects: (look in project/ directory)'; \
59	for p in $(sort $(PROJECTS)); do \
60		echo $$p; \
61	done
62
63endif
64
65# vim: set syntax=make noexpandtab
66