-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (27 loc) · 821 Bytes
/
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
BUILD := build
SOURCES := src
MAIN := giferly
ERLFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.erl)))
TARGETS := $(ERLFILES:%.erl=%.beam)
ERL := erl
ERLC := erlc
IN := gfx/rgb-stripes-transparent.gif
.PHONY: all run test clean
all: $(TARGETS)
run:
# Once the module has been compiled, run the module's entry function, then
# run `init:stop` to end the process.
#
# Notice the `-noshell` to prevent a sub-shell from starting.
$(ERL) -pa $(BUILD) -noshell -run $(MAIN) go "$(IN)" -run init stop
test: TEST=1
test: $(TARGETS)
$(ERL) -noshell -run eunit test $(BUILD) -run init stop
$(BUILD):
@echo creating build directory...
@[ -d $@ ] || mkdir -p $@
%.beam: $(SOURCES)/%.erl $(BUILD)
$(ERLC) $(if $(TEST),-DTEST) -W -bbeam -o$(BUILD) $<
clean:
@echo cleaning...
@rm -fr $(BUILD)