Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Sorting out a rather "interesting" build process
  • Loading branch information
Kevin Smith committed Sep 27, 2012
1 parent 1464108 commit 5c4a6877e47d08982dad6608c54141f5fc69ae87
Showing 4 changed files with 21 additions and 13 deletions.
@@ -1,11 +1,11 @@
all: compile

compile:
@ ./rebar compile
@rebar compile

tests:
@ ./rebar eunit
@rebar eunit

clean:
@ ./rebar clean
@rebar clean

@@ -0,0 +1,6 @@
compile:
env
$(CC) $(CFLAGS) $(ERL_CFLAGS) $(EXE_LDFLAGS) bcrypt_port.c bcrypt.o blowfish.o -o ../priv/bcrypt

clean:
@rm -f ../priv/bcrypt
BIN -102 KB rebar
Binary file not shown.
@@ -1,14 +1,16 @@
%% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
{erl_opts, [debug_info]}.
%% {erl_opts, [debug_info]}.

{so_specs,
[{"priv/bcrypt_nif.so",
["c_src/blowfish.o", "c_src/bcrypt.o", "c_src/bcrypt_nif.o", "c_src/async_queue.o"]}]}.
%% {so_specs,
%% [{"priv/bcrypt_nif.so",
%% ["c_src/*.c"]}]}.
{port_env,
[{"DRV_LDFLAGS","-shared $ERL_LDFLAGS -lpthread"},
{"darwin", "DRV_LDFLAGS", "-bundle -flat_namespace -undefined suppress $ERL_LDFLAGS -lpthread"},
{"DRV_CFLAGS","-Ic_src -Wall -fPIC $ERL_CFLAGS"}]}.

{port_specs, [{"priv/bcrypt_nif.so", ["c_src/*.c"]}]}.

{post_hooks,
[{clean, "rm -f priv/bcrypt"},
{compile,
"$CC $CFLAGS $ERL $ERL_CFLAGS "
"c_src/bcrypt_port.c c_src/bcrypt.o c_src/blowfish.o "
"$LDFLAGS $ERL_LDFLAGS -lpthread "
"-o priv/bcrypt"}]}.
[{clean, "make -C c_src clean"},
{compile, "make -C c_src"}]}.

0 comments on commit 5c4a687

Please sign in to comment.