-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
60 lines (45 loc) · 1.28 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
57
58
59
60
# Makefile for spell1
# This simple Makefile uses rebar3 (in Unix) or rebar3.cmd (in Windows)
# to compile/clean if it exists, else does it explicitly.
EBINDIR = ebin
SRCDIR = src
INCDIR = include
VPATH = $(SRCDIR)
ERLCFLAGS = -W1
ERLC = erlc
LFEC = lfec
## The .erl, .xrl, .yrl and .beam files
ESRCS = $(notdir $(wildcard $(SRCDIR)/*.erl))
LSRCS = $(notdir $(wildcard $(SRCDIR)/*.lfe))
EBINS = $(ESRCS:.erl=.beam) $(LSRCS:.lfe=.beam)
.SUFFIXES: .erl .lfe .beam
$(EBINDIR)/%.beam: $(SRCDIR)/%.erl
$(ERLC) -I $(INCDIR) -o $(EBINDIR) $(ERLCFLAGS) $<
$(EBINDIR)/%.beam: $(SRCDIR)/%.lfe
$(LFEC) -I $(INCDIR) -o $(EBINDIR) $(ERLCFLAGS) $<
all: compile docs
.PHONY: compile erlc-compile install docs clean
## Compile using rebar3 if it exists else using make
compile:
if which rebar3.cmd > /dev/null; \
then rebar3.cmd compile; \
elif which rebar3 > /dev/null; \
then rebar3 compile; \
else $(MAKE) $(MFLAGS) erlc-compile; \
fi
## Compile using erlc
erlc-compile: $(addprefix $(EBINDIR)/, $(EBINS)) $(addprefix $(BINDIR)/, $(BINS))
docs:
clean:
if which rebar3.cmd > /dev/null; \
then rebar3.cmd clean; \
elif which rebar3 > /dev/null; \
then rebar3 clean; \
else rm -rf $(EBINDIR)/*.beam; \
fi
rm -rf maps.mk
rm -rf erl_crash.dump
echo:
@ echo $(ESRCS)
@ echo $(LSRCS)
@ echo $(EBINS)