Verified Commit 2f47ed4b authored by Xueshan Feng's avatar Xueshan Feng
Browse files

Update to reverse makefiles display so the current directory's makefile is shown first.

parent c6d06cb3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ ifneq ($(missing_vars),)
	_ := $(error )
endif

function_reverse = $(if $(1),$(call function_reverse,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))

all: help

.PHONY: help
@@ -29,7 +31,7 @@ help: ## show this help page
	@echo
	@printf '¯\_(ツ)_/¯ \e[1;35m%-6s\e[m ¯\_(ツ)_/¯\n' "MAKEFILE TARGETS FOR DIRECTORY: $$(basename $$PWD)/"
	@#for f in ${MAKEFILE_LIST} 
	@for f in ${MAKEFILE_LIST}; do \
	@for f in $(call function_reverse,$(MAKEFILE_LIST)); do \
		 if [ -f $$f ] && grep -qE '^[a-zA-Z_-]+:.*?## .*$$' $$f; then \
		 	echo; \
		 	simple_path="$${f/$$HOME/~}"; \
@@ -40,7 +42,7 @@ help: ## show this help page
			cat $$f | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' || true; \
		fi; \
	done
	@make check-tools no-pull=true
	@make check-tools no_pull=true

.PHONY: show-makefile
show-makefile: ## show complete makefile w/ includes