Makefile 1016 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. NAME := epgsql
  2. VERSION := 1.2
  3. ERL := erl
  4. ERLC := erlc
  5. # ------------------------------------------------------------------------
  6. ERLC_FLAGS := -Wall -I include
  7. SRC := $(wildcard src/*.erl)
  8. TESTS := $(wildcard test_src/*.erl)
  9. RELEASE := $(NAME)-$(VERSION).tar.gz
  10. APPDIR := $(NAME)-$(VERSION)
  11. BEAMS := $(SRC:src/%.erl=ebin/%.beam)
  12. compile: $(BEAMS)
  13. app: compile
  14. @mkdir -p $(APPDIR)/ebin
  15. @cp -r ebin/* $(APPDIR)/ebin/
  16. @cp -r include $(APPDIR)
  17. release: app
  18. @tar czvf $(RELEASE) $(APPDIR)
  19. clean:
  20. @rm -f ebin/*.beam
  21. @rm -rf $(NAME)-$(VERSION) $(NAME)-*.tar.gz
  22. test: $(TESTS:test_src/%.erl=test_ebin/%.beam) $(BEAMS)
  23. @dialyzer --src -c src
  24. $(ERL) -pa ebin/ -pa test_ebin/ -noshell -s pgsql_tests run_tests -s init stop
  25. # ------------------------------------------------------------------------
  26. .SUFFIXES: .erl .beam
  27. .PHONY: app compile clean test
  28. ebin/%.beam : src/%.erl
  29. $(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<
  30. test_ebin/%.beam : test_src/%.erl
  31. $(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<