Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
32 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 | ||
|
|
||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
{application, notify, | |||
[ | |||
{description, "libnotify interface"}, | |||
{vsn, "0.01"}, | |||
{modules, [ | |||
notify, | |||
rss | |||
]}, | |||
{registered, []}, | |||
{applications, [ | |||
kernel, | |||
stdlib | |||
]}, | |||
{env, []} | |||
]}. | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
{so_name, "notify.so"}. | |||
{port_envs, [ | |||
{"LDFLAGS", "$LDFLAGS @LDFLAGS@"}, | |||
{"CFLAGS", "$CFLAGS @CFLAGS@"} | |||
]}. |