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 "make list-arch: print the architecture of the current project" 27 @echo "make list-toolchain: print the computed toolchain prefix of the current project" 28 @echo "" 29 @echo "Examples:" 30 @echo "PROJECT=testproject make" 31 @echo "PROJECT=testproject make clean" 32 @echo "make testproject" 33 @echo "make testproject clean" 34 @echo "" 35 @echo "output will be in build-testproject/" 36 37endif 38 39# list projects 40ifeq ($(firstword $(MAKECMDGOALS)),list) 41do-nothing=1 42 43# get a list of all the .mk files in the top level project directories 44PROJECTS:=$(basename $(strip $(foreach d,$(LKINC),$(wildcard $(d)/project/*.mk)))) 45PROJECTS:=$(shell basename -a $(PROJECTS)) 46 47.PHONY: list 48list: 49 @echo 'List of all buildable projects: (look in project/ directory)'; \ 50 for p in $(sort $(PROJECTS)); do \ 51 echo $$p; \ 52 done 53 54endif 55 56# vim: set syntax=make noexpandtab 57