forked from iamaleksey/common_lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (49 loc) · 1.81 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
###-----------------------------------------------------------------------------
### APPLICATION LAYOUT
###-----------------------------------------------------------------------------
APPNAME = common_lib
ERLS = $(patsubst src/%.erl,%.erl,$(wildcard src/*.erl))
MODS = $(subst $(space),$(comma)$(space),$(ERLS:.erl=))
DOCS = $(patsubst doc/%.ndoc,%.ndoc,$(wildcard doc/*.ndoc))
MANS = $(DOCS:.ndoc=.3)
HTMS = $(DOCS:.ndoc=.html)
TEXS = $(DOCS:.ndoc=.tex)
PDFS = $(DOCS:.ndoc=.pdf)
### Dependecy Search Paths
VPATH = src:include:ebin:doc
.PHONY: compile clean clobber test doc
.SUFFIXES: .erl .hrl .beam .app.src .app .rel .ndoc
###-----------------------------------------------------------------------------
### TARGETS
###-----------------------------------------------------------------------------
compile:
./rebar compile
clean:
./rebar clean
clobber: clean
@$(RM) -R doc/html
@$(RM) -R doc/man
@$(RM) -R doc/pdf
@$(RM) -R logs
@$(RM) -R test/*.beam
test:
./rebar ct
doc: man html pdf
man: $(MANS)
@$(MV) doc/man/$(APPNAME)_overview.3 doc/man/$(APPNAME).1
html: $(HTMS)
@$(MV) doc/html/$(APPNAME)_overview.html doc/html/index.html
pdf: $(PDFS)
## Rules
%.3: %.ndoc
@$(CD) doc; $(SED) "s|%MODULES%|`echo $(MODS)`|g" ../$^ | \
$(SED) "s|%VSN%|$(VSN)|g" | $(SED) "s|%APPLICATION%|$(APPNAME)|g" | \
$(ERLDOC) -i - -t man --no-toc --erl -o man/$@; $(CD) ..
%.html: %.ndoc
@$(CD) doc; $(SED) "s|%MODULES%|`echo $(MODS)`|g" ../$^ | \
$(SED) "s|%VSN%|$(VSN)|g" | $(SED) "s|%APPLICATION%|$(APPNAME)|g" | \
$(ERLDOC) -i - -t xhtml --erl -o html/$@; $(CD) ..
%.pdf: %.ndoc
@$(CD) doc; $(SED) "s|%MODULES%|`echo $(MODS)`|g" ../$^ | \
$(SED) "s|%VSN%|$(VSN)|g" | $(SED) "s|%APPLICATION%|$(APPNAME)|g" | \
$(ERLDOC) -i - -t pdf --no-toc --erl -o pdf/$@; $(CD) ..