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 "Environment or command line variables controlling build:"
16	@echo "PROJECT = <project name>"
17	@echo "TOOLCHAIN_PREFIX = <absolute path to toolchain or relative path with prefix>"
18	@echo ""
19	@echo "Special make targets:"
20	@echo "make help: This help"
21	@echo "make list: List of buildable projects"
22	@echo "make clean: cleans build of current project"
23	@echo "make spotless: removes all build directories"
24	@echo "make <project>: try to build project named <project>"
25	@echo ""
26	@echo "Examples:"
27	@echo "PROJECT=testproject make"
28	@echo "PROJECT=testproject make clean"
29	@echo "make testproject"
30	@echo "make testproject clean"
31	@echo ""
32	@echo "output will be in build-testproject/"
33
34endif
35
36# list projects
37ifeq ($(firstword $(MAKECMDGOALS)),list)
38do-nothing=1
39
40# get a list of all the .mk files in the top level project directories
41PROJECTS:=$(basename $(strip $(foreach d,$(LKINC),$(wildcard $(d)/project/*.mk))))
42PROJECTS:=$(shell basename -a $(PROJECTS))
43
44.PHONY: list
45list:
46	@echo 'List of all buildable projects: (look in project/ directory)'; \
47	for p in $(PROJECTS); do \
48		echo $$p; \
49	done
50
51endif
52
53# vim: set syntax=make noexpandtab
54