-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
57 lines (41 loc) · 1.09 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
PREPROCESS = cpp -P -C -w -x c
JISON = jison -m js
UGLIFY = uglifyjs
UGLIFYARGS = -c -m --comments
SRCDIR = $(CURDIR)/src
PARSER = $(SRCDIR)/parser.js
GRAMMAR = $(SRCDIR)/beard.yy
LEXER = $(SRCDIR)/beard.l
SRC = $(filter-out $(PARSER), $(wildcard $(SRCDIR)/*.js))
SRC_ENTRY_POINT = $(SRCDIR)/main.js
ALLSRC = $(wildcard $(SRCDIR)/*.js)
DESTDIR = $(CURDIR)/lib
LIBDEBUG = $(DESTDIR)/beard.debug.js
LIBPROD = $(DESTDIR)/beard.js
LIBPRODMIN = $(DESTDIR)/beard.min.js
DOCSDIR = $(CURDIR)/docs
DOCS = $(DOCSDIR)/beard.html
SPECDIR = $(CURDIR)/spec
all: $(LIBDEBUG) $(LIBPRODMIN) $(DOCS) specs
$(DESTDIR):
mkdir $@
$(LIBDEBUG): $(ALLSRC) | $(DESTDIR)
$(PREPROCESS) -DDEBUG $(SRC_ENTRY_POINT) -o $@
$(LIBPROD): $(ALLSRC) | $(DESTDIR)
$(PREPROCESS) $(SRC_ENTRY_POINT) -o $@
$(LIBPRODMIN): $(LIBPROD)
$(UGLIFY) $? $(UGLIFYARGS) -o $@
$(SRC): $(PARSER)
$(PARSER): $(GRAMMAR) $(LEXER)
$(JISON) $^ -o $@
$(DOCS): $(LIBPROD) | $(DOCSDIR)
docco -o $(DOCSDIR) $<
$(DOCSDIR):
mkdir $@
specs:
cd $(SPECDIR); ${MAKE} || exit; cd ..
clean:
rm -rf $(DESTDIR)
rm -f $(PARSER)
rm -rf $(DOCSDIR)
.PHONY: clean specs