Move port executable linking to rebar post compile hook
diff --git a/Makefile b/Makefile
index c7371a9..5d1630b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,5 @@
-CC = gcc
-CFLAGS = -g -O2 -Wall
-ERLANG_LIBS = -lerl_interface -lei -lpthread
-
-BCRYPTLIBS = c_src/bcrypt_port.o c_src/bcrypt.o c_src/blowfish.o
-
all: compile
-compile_port: priv/bcrypt
-
-priv/bcrypt: $(BCRYPTLIBS)
- $(CC) $(CFLAGS) $(BCRYPTLIBS) $(ERLANG_LIBS) -o $@
-
compile:
@ ./rebar compile
diff --git a/rebar.config b/rebar.config
index 72a0f86..68cf7bd 100644
--- a/rebar.config
+++ b/rebar.config
@@ -1,8 +1,15 @@
%% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
-{so_name, "bcrypt_nif.so"}.
-{port_sources, ["c_src/blowfish.c", "c_src/bcrypt.c", "c_src/bcrypt_nif.c"]}.
+{so_specs,
+ [{"priv/bcrypt_nif.so",
+ ["c_src/blowfish.c", "c_src/bcrypt.c", "c_src/bcrypt_nif.c"]},
+ {"priv/bcrypt_port.so",
+ ["c_src/bcrypt_port.c"]}]}.
{erl_opts, [debug_info]}.
-{pre_hooks, [{clean, "rm -f priv/bcrypt c_src/bcrypt_port.o"},
- {compile, "make compile_port"}]}.
+{pre_hooks, [{clean, "rm -f priv/bcrypt c_src/bcrypt_port.o"}]}.
+{post_hooks,
+ [{compile,
+ "gcc -g -O2 -Wall c_src/bcrypt_port.o c_src/bcrypt.o"
+ " c_src/blowfish.o -lerl_interface -lei -lpthread"
+ " -o priv/bcrypt"}]}.