]>
Commit | Line | Data |
---|---|---|
1 | ## -*- makefile -*- | |
2 | ||
3 | ERL := erl | |
4 | ERLC := $(ERL)c | |
5 | ||
6 | INCLUDE_DIRS := ../include $(wildcard ../deps/*/include) | |
7 | EBIN_DIRS := $(wildcard ../deps/*/ebin) | |
8 | ERLC_FLAGS := -W $(INCLUDE_DIRS:../%=-I ../%) $(EBIN_DIRS:%=-pa %) | |
9 | ||
10 | ifndef no_debug_info | |
11 | ERLC_FLAGS += +debug_info | |
12 | endif | |
13 | ||
14 | ifdef debug | |
15 | ERLC_FLAGS += -Ddebug | |
16 | endif | |
17 | ||
18 | ifdef test | |
19 | ERLC_FLAGS += -DTEST | |
20 | endif | |
21 | ||
22 | EBIN_DIR := ../ebin | |
23 | DOC_DIR := ../doc | |
24 | EMULATOR := beam | |
25 | ||
26 | ERL_TEMPLATE := $(wildcard *.et) | |
27 | ERL_SOURCES := $(wildcard *.erl) | |
28 | ERL_HEADERS := $(wildcard *.hrl) $(wildcard ../include/*.hrl) | |
29 | ERL_OBJECTS := $(ERL_SOURCES:%.erl=$(EBIN_DIR)/%.beam) | |
30 | ERL_TEMPLATES := $(ERL_TEMPLATE:%.et=$(EBIN_DIR)/%.beam) | |
31 | ERL_OBJECTS_LOCAL := $(ERL_SOURCES:%.erl=./%.$(EMULATOR)) | |
32 | APP_FILES := $(wildcard *.app) | |
33 | EBIN_FILES = $(ERL_OBJECTS) $(APP_FILES:%.app=../ebin/%.app) $(ERL_TEMPLATES) | |
34 | MODULES = $(ERL_SOURCES:%.erl=%) | |
35 | ||
36 | ../ebin/%.app: %.app | |
37 | cp $< $@ | |
38 | ||
39 | $(EBIN_DIR)/%.$(EMULATOR): %.erl | |
40 | $(ERLC) $(ERLC_FLAGS) -o $(EBIN_DIR) $< | |
41 | ||
42 | $(EBIN_DIR)/%.$(EMULATOR): %.et | |
43 | $(ERL) -noshell -pa ../../elib/erltl/ebin/ -eval "erltl:compile(atom_to_list('$<'), [{outdir, \"../ebin\"}, report_errors, report_warnings, nowarn_unused_vars])." -s init stop | |
44 | ||
45 | ./%.$(EMULATOR): %.erl | |
46 | $(ERLC) $(ERLC_FLAGS) -o . $< | |
47 | ||
48 | $(DOC_DIR)/%.html: %.erl | |
49 | $(ERL) -noshell -run edoc file $< -run init stop | |
50 | mv *.html $(DOC_DIR) | |
51 |