-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
37 lines (25 loc) · 1006 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
#
# (c) Peralta Informatics 2010
#
SOURCE_DIRS=src contrib
VPATH=$(SOURCE_DIRS) # http://www.ipp.mpg.de/~dpc/gmake/make_27.html#SEC26
EBIN_DIR=ebin
ET_DIR=et
CONTRIBS = $(shell echo `ls -d contrib/*/`)
CONTRIB_PATH=$(foreach dir, ${CONTRIBS}, -pa $(dir)ebin)
CONTRIB_INCLUDES=$(foreach dir, ${CONTRIBS}, -I"$(dir)include")
INCLUDE_DIRS=include
INCLUDES=$(foreach dir, $(INCLUDE_DIRS), $(wildcard $(dir)/*.hrl))
INCLUDE_FLAGS += $(foreach dir, $(INCLUDE_DIRS), -I $(dir))
SOURCES=$(foreach dir, $(SOURCE_DIRS), $(wildcard $(dir)/*.erl))
TARGETS=$(foreach dir, $(SOURCE_DIRS), $(patsubst $(dir)/%.erl, $(EBIN_DIR)/%.beam, $(wildcard $(dir)/*.erl)))
ERLC_OPTS=$(INCLUDE_FLAGS) $(CONTRIB_INCLUDES) $(CONTRIB_PATH) -o $(EBIN_DIR) -Wall +debug_info # +native -v
MODULES=$(shell echo $(basename $(notdir $(TARGETS))) | sed 's_ _,_g')
all: $(EBIN_DIR) $(TARGETS)
$(EBIN_DIR)/%.beam: %.erl $(INCLUDES)
erlc $(ERLC_OPTS) $<
$(EBIN_DIR):
mkdir -p $(EBIN_DIR)
clean:
rm -f ebin/*.beam
rm -f $(TARGETS)