|
@@ -1,58 +1,23 @@
|
|
|
-NAME := epgsql
|
|
|
-VERSION := $(shell git describe --always --tags)
|
|
|
+REBAR = rebar
|
|
|
|
|
|
-ERL := erl
|
|
|
-ERLC := erlc
|
|
|
+all: compile
|
|
|
|
|
|
-# ------------------------------------------------------------------------
|
|
|
-
|
|
|
-ERLC_FLAGS := -Wall -I include +debug_info
|
|
|
-
|
|
|
-SRC := $(wildcard src/*.erl)
|
|
|
-TESTS := $(wildcard test/*.erl)
|
|
|
-RELEASE := $(NAME)-$(VERSION).tar.gz
|
|
|
-
|
|
|
-APPDIR := $(NAME)-$(VERSION)
|
|
|
-BEAMS := $(SRC:src/%.erl=ebin/%.beam)
|
|
|
-
|
|
|
-compile: $(BEAMS) ebin/$(NAME).app
|
|
|
-
|
|
|
-app: compile
|
|
|
- @mkdir -p $(APPDIR)/ebin
|
|
|
- @cp -r ebin/* $(APPDIR)/ebin/
|
|
|
- @cp -r include $(APPDIR)
|
|
|
-
|
|
|
-release: app
|
|
|
- @tar czvf $(RELEASE) $(APPDIR)
|
|
|
+compile:
|
|
|
+ @$(REBAR) compile
|
|
|
|
|
|
clean:
|
|
|
- @rm -f ebin/*.beam
|
|
|
- @rm -f ebin/$(NAME).app
|
|
|
- @rm -f test/*.beam
|
|
|
- @rm -rf $(NAME)-$(VERSION) $(NAME)-*.tar.gz
|
|
|
+ @$(REBAR) clean
|
|
|
|
|
|
create_testdbs:
|
|
|
psql template1 < ./test_data/test_schema.sql
|
|
|
|
|
|
-test: $(TESTS:test/%.erl=test/%.beam) compile
|
|
|
- $(ERL) -pa ebin/ -pa test/ -noshell -s pgsql_tests run_tests -s init stop
|
|
|
-
|
|
|
-# ------------------------------------------------------------------------
|
|
|
-
|
|
|
-.SUFFIXES: .erl .beam
|
|
|
-.PHONY: app compile clean test
|
|
|
-
|
|
|
-ebin/%.beam : src/%.erl
|
|
|
- $(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<
|
|
|
-
|
|
|
-ebin/%.app : src/%.app.src Makefile
|
|
|
- sed -e 's|git|\"$(VERSION)\"|g' $< > $@
|
|
|
-
|
|
|
-test/%.beam : test/%.erl
|
|
|
- $(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<
|
|
|
+test:
|
|
|
+ @$(REBAR) eunit
|
|
|
|
|
|
dialyzer: build.plt compile
|
|
|
dialyzer --plt $< ebin
|
|
|
|
|
|
build.plt:
|
|
|
dialyzer -q --build_plt --apps kernel stdlib ssl --output_plt $@
|
|
|
+
|
|
|
+.PHONY: all compile release clean create_testdbs test dialyzer build.plt
|