-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
71 lines (55 loc) · 1.53 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
65
66
67
68
69
70
##
## Template Makefile for MyCo build system
## Author: Martin Carlson <[email protected]>
##
# Versioning and Configuration
# (use ?= when defining variables to retain override effect)
sinclude $(TOP_DIR)/config.local.mk # (optional)
sinclude config.local.mk # (optional)
include config.mk
include vsn.mk
## Code layout
APPSRC = $(patsubst src/%.app.src,%.app.src,$(wildcard src/*.app.src))
ERLS = $(patsubst src/%.erl,%.erl,$(wildcard src/*.erl))
BEAMS = $(ERLS:.erl=.beam)
TEST_ERLS = $(patsubst test/%.erl,%.erl,$(wildcard test/*.erl))
TEST_BEAMS = $(TEST_ERLS:.erl=.beam)
MODS = $(BEAMS:.beam=)
APP = $(APPSRC:.app.src=.app)
## Dependecy Search Paths
VPATH = src:test:include:ebin
all: depend $(APP) $(BEAMS) c_src
doc:
@echo [EDOC] gen_httpd
@erl -noinput -eval 'edoc:application(gen_httpd, "./", [{doc, "doc/"}])' -s erlang halt
test: depend $(BEAMS) $(TEST_BEAMS)
.PHONY: all test clean c_src doc
.SUFFIXES: .erl .beam .app.src .app
clean:
@for i in $(wildcard ebin/*); do \
echo [RM] $$i; \
$(RM) $$i; \
done
@echo [RM] depend
@$(RM) depend
@if test -d c_src ; then \
$(MAKE) -C c_src clean; \
fi
%.beam: %.erl
@echo [ERLC] $<
@$(ERLC) -o ebin $(EFLAGS) \
-pa ../gen_tcpd/ebin \
-I include \
-DREV=$(REV) \
$(patsubst %,-pa $(TOP_DIR)/%/ebin, $(EDEPS)) $<
$(APP): $(APPSRC) vsn.mk
@echo [SED] $<
@$(SED) "s|%MODULES%|`echo $(MODS) | tr '[:blank:]' ','`|g" $< | \
$(SED) "s|%VSN%|$(VSN)|g" > ebin/$@
sinclude depend
depend: $(ERLS)
@(sh erldep src)
c_src:
@if test -d c_src ; then \
$(MAKE) -C c_src; \
fi