-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
56 lines (43 loc) · 1.33 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
NODENAME=openmoko
OPENMOKO_ARGS=
SOURCE_DIR=src
EBIN_DIR=ebin
INCLUDE_DIR=include
SOURCES=$(wildcard $(SOURCE_DIR)/*.erl)
TARGETS=$(patsubst $(SOURCE_DIR)/%.erl, $(EBIN_DIR)/%.beam,$(SOURCES))
ERLC_OPTS=-I $(INCLUDE_DIR) -o $(EBIN_DIR) -Wall -v +debug_info
MNESIA_DIR=/tmp/openmoko-$(NODENAME)-mnesia
LOG_FILE=/tmp/openmoko-$(NODENAME).log
SASL_LOG_FILE=/tmp/openmoko-$(NODENAME)-sasl.log
ERL_CMD=erl \
-boot start_sasl \
-sname $(NODENAME) \
+W w \
-pa $(EBIN_DIR) \
+K true \
+A10 \
-kernel inet_default_listen_options '[{sndbuf, 16384}, {recbuf, 4096}]' \
-sasl errlog_type error \
-sasl sasl_error_logger '{file,"/tmp/'${NODENAME}'-sasl.log"}' \
-mnesia dir '"$(MNESIA_DIR)"' \
$(OPENMOKO_ARGS)
ERL_CALL=erl_call -sname $(NODENAME) -e
all: $(TARGETS)
$(EBIN_DIR)/%.beam: $(SOURCE_DIR)/%.erl
erlc $(ERLC_OPTS) $<
clean: cleandb
rm -f $(TARGETS)
rm -f ebin/*.beam
cleandb: stop-node
erl -mnesia dir '"$(MNESIA_DIR)"' -noshell -eval 'lists:foreach(fun file:delete/1, filelib:wildcard(mnesia:system_info(directory) ++ "/*")), halt().'
############ various tasks to interact with erlang-openmoko ###################
run: all
$(ERL_CMD) -s openmoko
run-node: all
$(ERL_CMD)
start-openmoko-on-node: all
echo "openmoko:start()." | $(ERL_CALL)
stop-openmoko-on-node: all
echo "openmoko:stop()." | $(ERL_CALL)
stop-node:
-$(ERL_CALL) -q