Permalink
Browse files

Move port executable linking to rebar post compile hook

  • Loading branch information...
Hunter Morris
Hunter Morris committed Apr 3, 2011
1 parent 273298f commit 0d1bd8195f2b02c87a1a4acb2a675a26e85c52e2
Showing with 11 additions and 15 deletions.
  1. +0 −11 Makefile
  2. +11 −4 rebar.config
View
@@ -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
View
@@ -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"}]}.

0 comments on commit 0d1bd81

Please sign in to comment.