Makefile 905 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 -Iccan -I.
  4. ALL=$(patsubst ccan/%/test, ccan/%, $(wildcard ccan/*/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 tools/run_tests $(V) ccan/$* | grep ^'not ok'; then exit 1; else exit 0; fi
  16. ccanlint: tools/ccanlint/ccanlint
  17. clean: tools-clean
  18. rm -f `find . -name '*.o'` `find . -name '.depends'`
  19. include tools/Makefile