/
Makefile
64 lines (48 loc) · 1.23 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
61
62
63
64
# Makefile for LFE
# This simple Makefile uses rebar to compile/clean if it
# exists, else does it explicitly.
BINDIR = ebin
SRCDIR = src
INCDIR = include
DOCDIR = doc
EMACSDIR = emacs
VPATH = $(SRCDIR)
ERLCFLAGS = -W0 +debug_info
ERLC = erlc
## The .erl and .beam files
SRCS = $(notdir $(wildcard $(SRCDIR)/*.erl))
EBINS = $(SRCS:.erl=.beam)
## Where we install LFE, in the ERL_LIBS directory.
INSTALLDIR = $(ERL_LIBS)/lfe
.SUFFIXES: .erl .beam
$(BINDIR)/%.beam: %.erl
$(ERLC) -I $(INCDIR) -o $(BINDIR) $(ERLCFLAGS) $<
$(SRCDIR)/%.erl: %.xrl
$(ERLC) -o $(SRCDIR) $<
$(SRCDIR)/%.erl: %.yrl
$(ERLC) -o $(SRCDIR) $<
all: compile docs
.PHONY: compile erlc_compile install docs clean
## Compile using rebar if it exists else using make
compile:
if which -s rebar; \
then rebar compile; \
else $(MAKE) $(MFLAGS) erlc_compile; \
fi
## Compile using erlc
erlc_compile: $(addprefix $(BINDIR)/, $(EBINS))
install:
if [ "$$ERL_LIBS" != "" ]; \
then mkdir -p $(INSTALLDIR)/$(BINDIR) ; \
cp -pPR $(BINDIR) $(INSTALLDIR); \
cp -pPR $(EMACSDIR) $(INSTALLDIR); \
cp -pPR $(INCDIR) $(INSTALLDIR); \
else exit 1; \
fi
docs:
clean:
if which -s rebar; \
then rebar clean; \
else rm -rf $(BINDIR)/*.beam; \
fi
rm -rf erl_crash.dump