Makefile 872 B

12345678910111213141516171819202122232425262728
  1. # Hacky makefile to compile everything and run the tests in some kind of sane order.
  2. # V=--verbose for verbose tests.
  3. CFLAGS=-O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Werror -I.
  4. ALL=$(patsubst %/test, %, $(wildcard */test))
  5. ALL_DEPENDS=$(patsubst %, %/.depends, $(ALL))
  6. test-all: $(ALL_DEPENDS)
  7. $(MAKE) `for f in $(ALL); do echo test-$$f test-$$f; while read d; do echo test-$$d test-$$f; done < $$f/.depends; done | tsort`
  8. distclean: clean
  9. rm -f */_info
  10. rm -f $(ALL_DEPENDS)
  11. $(ALL_DEPENDS): %/.depends: %/_info
  12. @$< depends > $@ || ( rm -f $@; exit 1 )
  13. test-%: ccan_tools/run_tests
  14. @echo Testing $*...
  15. @if ccan_tools/run_tests $(V) $* | grep ^'not ok'; then exit 1; else exit 0; fi
  16. ccanlint: ccan_tools/ccanlint/ccanlint
  17. clean: ccan_tools-clean
  18. rm -f `find . -name '*.o'`
  19. include ccan_tools/Makefile