-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
87 lines (61 loc) · 2.54 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
include vsn.mk
APPNAME=erlguten
DOC_OPTS={def,{version,\"$(VSN)\"}}
ERLGUTEN=./erlguten
ERL=erl
ERLC=erlc
ERLC_FLAGS=+debug_info +nowarn_unused_vars
PERL=perl
APPSCRIPT = '$$vsn=shift; $$mods=""; while(@ARGV){ $$_=shift; s/^([A-Z].*)$$/\'\''$$1\'\''/; $$mods.=", " if $$mods; $$mods .= $$_; } while(<>) { s/%VSN%/$$vsn/; s/"%MODULES%"/$$mods/; print; }'
HYPHEN_DICTS = $(wildcard priv/hyphenation/hyph_*.dic)
HYPHEN_SOURCES = $(HYPHEN_DICTS:priv/hyphenation/hyph_%.dic=priv/src/eg_hyphen_rules_%.erl)
.PRECIOUS: $(HYPHEN_SOURCES)
HYPHEN_OBJECTS = $(HYPHEN_SOURCES:priv/src/%.erl=ebin/%.beam)
ERL_SOURCES = $(wildcard src/*.erl)
MODULES = $(ERL_SOURCES:src/%.erl=%)
ERL_OBJECTS = $(ERL_SOURCES:src/%.erl=ebin/%.beam) \
ebin/eg_font_map.beam $(HYPHEN_OBJECTS)
TEST_SOURCES = $(wildcard test/*.erl)
TEST_PDFS = $(TEST_SOURCES:test/%.erl=test/%.pdf)
TEST_OBJECTS = $(TEST_SOURCES:test/%.erl=test/%.beam)
.PRECIOUS: $(TEST_OBJECTS)
.PHONY: all test doc
all: $(ERL_OBJECTS) app
test: all $(TEST_PDFS)
docs: doc
doc: doc/index.html
app: ebin/$(APPNAME).app
clean:
-rm -f $(ERL_OBJECTS) ebin/$(APPNAME).app
-cd priv/src && $(MAKE) clean
-rm -f $(TEST_OBJECTS) $(TEST_PDFS)
-rm -f doc/*.html doc/stylesheet.css doc/erlang.png doc/edoc-info
doc/index.html: doc/overview.edoc $(ERL_SOURCES)
$(ERL) -noshell -eval "edoc:application($(APPNAME), \".\", [$(DOC_OPTS)])" -s init stop
ebin/%.app: src/%.app.src vsn.mk
$(PERL) -e $(APPSCRIPT) "$(VSN)" $(MODULES) < $< > $@
ebin/%.beam: src/%.erl
$(ERLC) $(ERLC_FLAGS) -o ebin $<
# eg_hyphen_rules_*.erl files are found in priv/src/, not src/
ebin/eg_hyphen_rules_%.beam: priv/src/eg_hyphen_rules_%.erl
$(ERLC) $(ERLC_FLAGS) -o ebin $<
# generate hyphenation modules from .dic files
priv/src/eg_hyphen_rules_%.erl: priv/hyphenation/hyph_%.dic \
ebin/eg_mk_hyphen.beam ebin/eg_lib.beam
$(ERL) -noshell -pa ebin -s eg_mk_hyphen start $* -s init stop
# the font mapping is treated specially with its own Makefile, since we
# can't know here how many font source files will be generated by eg_afm
ebin/eg_font_map.beam: priv/src/Makefile
-cd priv/src && $(MAKE)
priv/src/Makefile: ebin/eg_afm.beam ebin/eg_lib.beam ebin/eg_pdf_op.beam \
priv/font_locations
$(ERL) -noshell -pa ebin -s eg_afm make -s init stop
test1.pdf: test1.map galley_001.gal content1.con
$(ERLGUTEN) test1.map
test2.pdf: test2.xml galley_002.gal
$(ERLGUTEN) test2.xml
tmo_doc.pdf: tmo_doc.xml
test/%.pdf: test/%.beam $(ERL_OBJECTS)
cd test && erl -pa . -pa ../ebin -noshell -s $* test -s init stop
test/%.beam: test/%.erl
$(ERLC) $(ERLC_FLAGS) -o test $<