triq.mk 792 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (c) 2015, Loïc Hoguin <essen@ninenines.eu>
  2. # This file is part of erlang.mk and subject to the terms of the ISC License.
  3. .PHONY: triq
  4. # Targets.
  5. tests:: triq
  6. define triq_run
  7. $(ERL) -pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin \
  8. -eval "try $(1) of true -> halt(0); _ -> halt(1) catch error:undef -> io:format(\"Undefined property or module~n\"), halt() end."
  9. endef
  10. ifdef t
  11. ifeq (,$(findstring :,$(t)))
  12. triq: test-build
  13. @$(call triq_run,triq:check($(t)))
  14. else
  15. triq: test-build
  16. @echo Testing $(t)/0
  17. @$(call triq_run,triq:check($(t)()))
  18. endif
  19. else
  20. triq: test-build
  21. $(eval MODULES := $(shell find ebin -type f -name \*.beam \
  22. | sed "s/ebin\//'/;s/\.beam/',/" | sed '$$s/.$$//'))
  23. $(gen_verbose) $(call triq_run,[true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]]))
  24. endif