Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. NAME := epgsql
  2. VERSION := 1.4
  3. ERL := erl
  4. ERLC := erlc
  5. # ------------------------------------------------------------------------
  6. ERLC_FLAGS := -Wall -I include +debug_info
  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) ebin/$(NAME).app
  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 -f ebin/$(NAME).app
  22. @rm -rf $(NAME)-$(VERSION) $(NAME)-*.tar.gz
  23. test: $(TESTS:test_src/%.erl=test_ebin/%.beam) compile
  24. @dialyzer -n --src -c src
  25. $(ERL) -pa ebin/ -pa test_ebin/ -noshell -s pgsql_tests run_tests -s init stop
  26. # ------------------------------------------------------------------------
  27. .SUFFIXES: .erl .beam
  28. .PHONY: app compile clean test
  29. ebin/%.beam : src/%.erl
  30. $(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<
  31. ebin/%.app : src/%.app.src Makefile
  32. sed -e s/VERSION/$(VERSION)/g $< > $@
  33. test_ebin/%.beam : test_src/%.erl
  34. $(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<