From 84709d49f53e9169b7325b53588e7ee28b8e2f3c Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Sat, 30 Jan 2016 14:41:36 -0800 Subject: [PATCH] [make] add a quick in dirty help target for the build system make help: a quick overview of how to use the build system make list: a list of all the buildable projects --- engine.mk | 5 ++++- make/help.mk | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 make/help.mk diff --git a/engine.mk b/engine.mk index 75beb7ba..47e8f248 100644 --- a/engine.mk +++ b/engine.mk @@ -31,6 +31,9 @@ make-make: endif endif +# some additional rules to print some help +include make/help.mk + ifeq ($(do-nothing),) ifeq ($(PROJECT),) @@ -38,7 +41,7 @@ ifeq ($(PROJECT),) ifneq ($(DEFAULT_PROJECT),) PROJECT := $(DEFAULT_PROJECT) else -$(error No project specified. Use "make projectname" or put "PROJECT := projectname" in local.mk) +$(error No project specified. Use 'make list' for a list of projects or 'make help' for additional help) endif endif diff --git a/make/help.mk b/make/help.mk new file mode 100644 index 00000000..d4402bed --- /dev/null +++ b/make/help.mk @@ -0,0 +1,53 @@ +# routines and rules to print some helpful stuff + + +#$(warning MAKECMDGOALS = $(MAKECMDGOALS)) + +# print some help and exit +ifeq ($(firstword $(MAKECMDGOALS)),help) +do-nothing=1 + +.PHONY: help +help: + @echo "LK build system quick help\n" \ + "Individual projects are built into a build- directory\n" \ + "Output binary is located at build-/lk.bin\n" \ + "Environment or command line variables controlling build:\n" \ + "PROJECT = \n" \ + "TOOLCHAIN_PREFIX = \n" \ + "\n" \ + "Special make targets:\n" \ + "make help: This help\n" \ + "make list: List of buildable projects\n" \ + "make clean: cleans build of current project\n" \ + "make spotless: removes all build directories\n" \ + "make : try to build project named \n" \ + "\n" \ + "Examples:\n" \ + "PROJECT=testproject make\n" \ + "PROJECT=testproject make clean\n" \ + "make testproject\n" \ + "make testproject clean\n" \ + "\n" \ + "output will be in build-testproject/\n" \ + +endif + +# list projects +ifeq ($(firstword $(MAKECMDGOALS)),list) +do-nothing=1 + +# get a list of all the .mk files in the top level project directories +PROJECTS:=$(basename $(strip $(foreach d,$(LKINC),$(wildcard $(d)/project/*.mk)))) +PROJECTS:=$(shell basename $(PROJECTS)) + +.PHONY: list +list: + @echo 'List of all buildable projects: (look in project/ directory)'; \ + for p in $(PROJECTS); do \ + echo $$p; \ + done + +endif + +# vim: set syntax=make noexpandtab