Browse files

Rebarize

Simplify build process using rebar. Put the rebar script in the repository
for now; it'd better if only 1 version of rebar was kept in the user's
path.
  • Loading branch information...
1 parent b72eaba commit f9da8e398d754136f6732606867c2dc26471a3fb @msantos committed Sep 12, 2010
Showing with 24 additions and 35 deletions.
  1. +5 −35 Makefile
  2. +15 −0 ebin/cerck.app
  3. BIN rebar
  4. +4 −0 rebar.config
View
40 Makefile
@@ -1,39 +1,9 @@
-ERL=erl
-APP=cerck
+REBAR=$(shell which rebar || echo ./rebar)
-CC=gcc
-
-# Use "-m64" for 64-bit Erlang installs
-ARCH=-m32
-
-# Mac OS X
-#FLAGS=$(ARCH) -O3 -fPIC -bundle -flat_namespace -undefined suppress -fno-common
-
-# Linux
-FLAGS=-fPIC -shared
-
-ERL_ROOT=/usr/local/lib/erlang
-CFLAGS=-g -Wall
-
-LIB=-lcrack
-
-all: dir erl nif
-
-dir:
- -@mkdir -p ebin
-
-erl:
- @$(ERL) -noinput +B \
- -eval 'case make:all() of up_to_date -> halt(0); error -> halt(1) end.'
-
-nif:
- (cd c_src && \
- $(CC) $(ARCH) -g -Wall $(LIB) $(FLAGS) -o ../priv/cerck.so \
- cerck.c -I $(ERL_ROOT)/usr/include/ )
-
-
-clean:
- @rm -fv ebin/*.beam priv/$(APP) priv/$(APP).so c_src/*.a c_src/*.o
+compile:
+ @$(REBAR) compile
+clean:
+ @$(REBAR) clean
View
15 ebin/cerck.app
@@ -0,0 +1,15 @@
+{application, cerck,
+ [
+ {description, "cracklib NIF"},
+ {vsn, "0.01"},
+ {modules, [
+ cerck
+ ]},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib
+ ]},
+ {env, []}
+ ]}.
+
View
BIN rebar
Binary file not shown.
View
4 rebar.config
@@ -0,0 +1,4 @@
+{port_envs, [
+ {"LDFLAGS", "-lcrack $LDFLAGS"}
+ ]}.
+{so_name, "cerck.so"}.

0 comments on commit f9da8e3

Please sign in to comment.