summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2020-08-17 22:05:29 +0300
committerRasmus Andersson <rasmus@notion.se>2020-08-17 22:05:29 +0300
commit427828ca388194075344724e18317a2c6c601332 (patch)
tree71e5542f6398e17fe7fad12450ff290a7dd25360 /Makefile
parent57d7d00d50c54dbbd351fc4ee0788469c3b86a9e (diff)
downloadinter-427828ca388194075344724e18317a2c6c601332.tar.xz
makefile: adds "list" command for listing all targets
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 22 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 3640bf65a..72332d8d0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
+# To list all targets:
+# make list
+#
# High-level make targets:
# all Build everything
# all_text Build all Inter (non-dislay) fonts
@@ -71,6 +74,25 @@ all_var_display: \
# Hinted variable font disabled. See https://github.com/rsms/inter/issues/75
# all_var_hinted: $(FONTDIR)/var-hinted/Inter.var.otf $(FONTDIR)/var-hinted/Inter.var.woff2
+# list make targets
+# We copy the Makefile (first in MAKEFILE_LIST) and disable the include to only list
+# primary targets, avoiding the generated targets.
+.PHONY: list list_all
+list:
+ @mkdir -p build/etc \
+ && cat $(firstword $(MAKEFILE_LIST)) \
+ | sed 's/include /#include /g' > build/etc/Makefile-list \
+ && $(MAKE) -pRrq -f build/etc/Makefile-list : 2>/dev/null \
+ | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
+ | sort \
+ | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
+# list_all is like list, but includes generated targets
+list_all:
+ @$(MAKE) -pRrq -f $(firstword $(MAKEFILE_LIST)) : 2>/dev/null \
+ | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
+ | sort \
+ | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
+
export PATH := $(PWD)/build/venv/bin:$(PATH)
# generated.make is automatically generated by init.sh and defines depenencies for