Makefile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. NAME := epgsql
  2. VERSION := 1.3
  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) 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,app}
  21. @rm -rf $(NAME)-$(VERSION) $(NAME)-*.tar.gz
  22. test: $(TESTS:test_src/%.erl=test_ebin/%.beam) compile
  23. @dialyzer -n --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. ebin/%.app : src/%.app.src
  31. sed -e s/VERSION/$(VERSION)/g $< > $@
  32. test_ebin/%.beam : test_src/%.erl
  33. $(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<