Skip to content

Commit

Permalink
Now with more rebar!
Browse files Browse the repository at this point in the history
  • Loading branch information
msantos committed Sep 13, 2010
1 parent db6f4b6 commit 5db8243
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 30 deletions.
41 changes: 11 additions & 30 deletions Makefile
@@ -1,39 +1,20 @@


ERL=erl REBAR=$(shell which rebar || echo ./rebar)
APP=notify TEMPLATE=rebar.config.tmpl
CONFIG=rebar.config


CC=gcc CFLAGS=$(shell pkg-config --cflags libnotify)
LDFLAGS=$(shell pkg-config --libs libnotify)


# Use "-m64" for 64-bit Erlang installs all: config compile
ARCH=-m32


# Mac OS X config:
#FLAGS=$(ARCH) -O3 -fPIC -bundle -flat_namespace -undefined suppress -fno-common @sed -e 's:@LDFLAGS@:$(LDFLAGS):' -e 's:@CFLAGS@:$(CFLAGS):' $(TEMPLATE) > $(CONFIG)

# Linux
FLAGS=-fPIC -shared

ERL_ROOT=/usr/local/lib/erlang
CFLAGS=-g -Wall

LIB=$(shell pkg-config --libs --cflags libnotify)

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/notify.so \
notify.c -I $(ERL_ROOT)/usr/include/ )


compile:
$(REBAR) compile


clean: clean:
@rm -fv ebin/*.beam priv/$(APP) priv/$(APP).so c_src/*.a c_src/*.o @$(REBAR) clean




16 changes: 16 additions & 0 deletions ebin/notify.app
@@ -0,0 +1,16 @@
{application, notify,
[
{description, "libnotify interface"},
{vsn, "0.01"},
{modules, [
notify,
rss
]},
{registered, []},
{applications, [
kernel,
stdlib
]},
{env, []}
]}.

Binary file added rebar
Binary file not shown.
5 changes: 5 additions & 0 deletions rebar.config.tmpl
@@ -0,0 +1,5 @@
{so_name, "notify.so"}.
{port_envs, [
{"LDFLAGS", "$LDFLAGS @LDFLAGS@"},
{"CFLAGS", "$CFLAGS @CFLAGS@"}
]}.

0 comments on commit 5db8243

Please sign in to comment.