Permalink
Browse files

Now with more rebar!

  • Loading branch information...
1 parent db6f4b6 commit 5db82435307728d8c67af59d770f51f943325820 @msantos committed Sep 13, 2010
Showing with 32 additions and 30 deletions.
  1. +11 −30 Makefile
  2. +16 −0 ebin/notify.app
  3. BIN rebar
  4. +5 −0 rebar.config.tmpl
View
@@ -1,39 +1,20 @@
-ERL=erl
-APP=notify
+REBAR=$(shell which rebar || echo ./rebar)
+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
-ARCH=-m32
+all: config compile
-# 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=$(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/ )
+config:
+ @sed -e 's:@LDFLAGS@:$(LDFLAGS):' -e 's:@CFLAGS@:$(CFLAGS):' $(TEMPLATE) > $(CONFIG)
+compile:
+ $(REBAR) compile
clean:
- @rm -fv ebin/*.beam priv/$(APP) priv/$(APP).so c_src/*.a c_src/*.o
+ @$(REBAR) clean
View
@@ -0,0 +1,16 @@
+{application, notify,
+ [
+ {description, "libnotify interface"},
+ {vsn, "0.01"},
+ {modules, [
+ notify,
+ rss
+ ]},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib
+ ]},
+ {env, []}
+ ]}.
+
View
Binary file not shown.
View
@@ -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.