Browse Source

Move test code to separate directory; rework Makefile.

Tim Fletcher 16 years ago
parent
commit
2a514aa069
3 changed files with 20 additions and 17 deletions
  1. 19 15
      Makefile
  2. 0 0
      test/oauth_termie.erl
  3. 1 2
      test/oauth_unit.erl

+ 19 - 15
Makefile

@@ -1,31 +1,35 @@
-EFLAGS=-pa ebin -pa ../erlang-fmt/ebin -pa ../eunit/ebin -I../ -Iinclude
+SOURCE_FILES := $(wildcard src/*.erl)
 
-ERL := erl $(EFLAGS)
+ERLC := erlc -W +debug_info -o ebin
 
-ERL_SOURCES := $(wildcard src/*.erl)
+ERL := erl -pa ebin -pa ../erlang-fmt/ebin -s crypto
 
-ERL_OBJECTS := $(ERL_SOURCES:src/%.erl=ebin/%.beam)
 
+all: beam_files
 
-all: objects
-
-objects: $(ERL_OBJECTS)
+beam_files: $(SOURCE_FILES:src/%.erl=ebin/%.beam)
 
 ebin/%.beam: src/%.erl
 	@test -d ebin || mkdir ebin
-	erlc $(EFLAGS) -W +debug_info -o ebin $<
+	$(ERLC) $<
+
+ebin/oauth_unit.beam:
+	$(ERLC) -pa ../eunit/ebin -I../ -Iinclude test/oauth_unit.erl
+
+ebin/oauth_termie.beam:
+	$(ERLC) test/oauth_termie.erl
 
 clean:
 	rm -rf ebin/*.beam erl_crash.dump
 
-test: objects
-	$(ERL) -noshell -s crypto -s oauth_unit test -s init stop
+test: beam_files ebin/oauth_unit.beam
+	@$(ERL) -noshell -s oauth_unit test -s init stop
 
-termie: objects
-	$(ERL) -noshell -s crypto -s inets -s oauth_termie test -s init stop
+termie: beam_files ebin/oauth_termie.beam
+	@$(ERL) -noshell -s inets -s oauth_termie test -s init stop
 
-shell: objects
-	@$(ERL) -s crypto -s inets
+shell: beam_files
+	@$(ERL) -s inets
 
 dialyzer:
-	dialyzer $(EFLAGS) --src -c src/
+	dialyzer --no_check_plt --src -c src/

+ 0 - 0
src/oauth_termie.erl → test/oauth_termie.erl


+ 1 - 2
src/oauth_unit.erl → test/oauth_unit.erl

@@ -1,7 +1,7 @@
 -module(oauth_unit).
 
--ifdef(TEST).
 -include_lib("eunit/include/eunit.hrl").
+
 -include("oauth_test_macros.hrl").
 
 
@@ -78,4 +78,3 @@ hmac_signature_test_() -> [
     "oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal"
   ])
 ].
--endif.