Ery Lee 12 years ago
parent
commit
1013a3420c
1 changed files with 21 additions and 0 deletions
  1. 21 0
      Makefile

+ 21 - 0
Makefile

@@ -1,6 +1,15 @@
 NAME		:= epgsql
 NAME		:= epgsql
 VERSION		:= $(shell git describe --always --tags)
 VERSION		:= $(shell git describe --always --tags)
 
 
+ERL         := erl
+ERLC        := erlc
+
+# ------------------------------------------------------------------------
+
+ERLC_FLAGS  := -Wall -I include +debug_info
+
+TESTS       := $(wildcard test_src/*.erl)
+
 all: compile ebin/$(NAME).app
 all: compile ebin/$(NAME).app
 
 
 compile:
 compile:
@@ -11,3 +20,15 @@ ebin/%.qpp: src/%.app.src
 
 
 clean:
 clean:
 	rebar clean
 	rebar clean
+
+test: $(TESTS:test_src/%.erl=test_ebin/%.beam) compile
+	@dialyzer -n --src -c src
+	$(ERL) -config etc/epgsql_test.config -pa ebin/ -pa test_ebin/ -noshell -s pgsql_tests run_tests -s init stop
+
+# ------------------------------------------------------------------------
+
+.SUFFIXES: .erl .beam
+.PHONY:    all compile clean test
+
+test_ebin/%.beam : test_src/%.erl
+	$(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<