+# Hacky makefile to compile everything and run the tests in some kind
+# of sane order.
+
+# Main targets:
+#
+# check: run tests on all ccan modules (use 'make check V=--verbose' for more)
+# Includes building libccan.a.
+# libccan.a: A library with all the ccan modules in it.
+# tools: build useful tools in tools/ dir.
+# Especially tools/ccanlint/ccanlint and tools/namespacize.
+# distclean: destroy everything back to pristine state
+
+# Trying to build the whole repo is usually a lose; there will be some
+# dependencies you don't have.
+EXCLUDE=ccan/wwviaudio ccan/ogg_to_pcm
+
+# Anything with an _info file is a module.
+ALL=$(filter-out $(EXCLUDE), $(patsubst ccan/%/_info, %, $(wildcard ccan/*/_info)))
+ALL_DEPENDS=$(patsubst %, ccan/%/.depends, $(ALL))
+# Not all modules have tests.
+ALL_TESTS=$(patsubst ccan/%/test/, %, $(foreach dir, $(ALL), $(wildcard ccan/$(dir)/test/)))