Commits

Sean Wilkinson committed e3fa127

Default target is now "help"

Comments (0)

Files changed (2)

 .PHONY: all clean clobber distclean reset run
 .SILENT: ;
 
+'': help;
+
 all: run
 
 clean: reset
 	@   $(RM) $(addprefix $(PROJECT_ROOT)/, \
                 .d8_history .v8_history ./node_modules/ npm-debug.log *.tgz)
 
+help:
+	@   $(call show-usage-info)
+
 reset:
 	@   $(call contingent, clear)
 

tools/macros.make

 #   in general, I recommend that you not edit these unless you absolutely must!
 #
 #                                                       ~~ (c) SRW, 03 Sep 2011
+#                                                   ~~ last updated 17 Nov 2012
 
 SHELL   :=  sh
 
     )
 endef
 
+define show-usage-info
+    printf '%s\n' 'Usage: $(MAKE) [options] [target] ...'               ;   \
+    printf '%s\n' '  where "high-level" targets include'                ;   \
+    $(SED) -n 's/^.PHONY:\([^$$]*\)$$/\1/p' $(MAKEFILE_LIST) | \
+        $(XARGS) printf '    %s\n' $(APPS) | $(SORT)
+endef
+
+SED     :=  $(call contingent, gsed sed)
+SORT    :=  $(call contingent, gsort sort) -u
+XARGS   :=  $(call contingent, xargs)
+
 #-  vim:set syntax=make: