-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
executable file
·70 lines (48 loc) · 1.62 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
top := $(CURDIR)
build = $(top)/build
# List all modules that participate in the build
modules := . lib apitest
modules += frontend/lib
modules += frontend/catalog
modules += frontend/index
modules += modules/core
modules += modules/auth
modules += modules/event
modules += modules/search
modules += scripts
# Modules should add files to be checked with jshint
jshint-files =
# Modules should add files to be run as unit tests
mocha-files =
# Modules should add files and dirs to be cleaned away
clean-files =
clean-dirs = build
# Tools etc
JSHINT = $(top)/node_modules/.bin/jshint
MOCHA = $(top)/node_modules/.bin/mocha
STYLUS = $(top)/node_modules/.bin/stylus
JSHINT_REPORTER =
MOCHA_COLORS =
ifeq ($(EMACS),t)
JSHINT_REPORTER = --reporter=$(top)/.jshint-emacs.js
MOCHA_COLORS = --no-colors
endif
SET_DEBUG =
DO_MOCHA = NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_ENV=development $(SET_DEBUG) $(MOCHA) $(MOCHA_COLORS) --reporter spec $(MOCHA_FLAGS)
# The submodules can add dependencies to these to do specific stuff.
# But do not add commands directly to these top-level targets!
all: lint
test: $(mocha-files)
$(DO_MOCHA) $(mocha-files)
clean:
rm -f $(clean-files)
rm -rf $(clean-dirs)
.PHONY: all lint test clean
# Include module-specific stuff to populate the variables
include $(modules:%=%/include.mk)
# Lint file-by-file to get better feedback. Slower on a fresh checkout, but
# faster when working.
lint: $(patsubst $(top)/%.js,$(build)/jshint/%.hint,$(wildcard $(jshint-files)))
$(build)/jshint/%.hint: $(top)/%.js
@echo '[jshint] $(patsubst $(top)/%,%,$<)'
@mkdir -p $(dir $@) && $(JSHINT) $(JSHINT_REPORTER) $< && touch $@