-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathMakefile
58 lines (43 loc) · 1.23 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
# TODO Actually we could just use `npm link`, but we don't really want to rely
# on npm. Ideally we would even check-in the dependencies, but then people
# wouldn't take us seriously.
CURRENT_DIR = $(shell pwd)
INSTALL_DIR = $(HOME)/.node_modules
BIN_DIR = /usr/local/bin
BIN = ied
DEPS_BIN_DIR = ./node_modules/.bin
SRC = $(wildcard src/*.js)
LIB = $(SRC:src/%.js=lib/%.js)
.PHONY: link install uninstall clean lint dev watch test
# http://blog.jgc.org/2015/04/the-one-line-you-should-add-to-every.html
print-%: ; @echo $*=$($*)
lib: $(LIB) node_modules
lib/%.js: src/%.js
mkdir -p $(@D)
$(DEPS_BIN_DIR)/babel $< -o $@
node_modules: package.json
npm install
install_dirs:
mkdir -p $(INSTALL_DIR)
mkdir -p $(BIN_DIR)
link: install_dirs
ln -s $(CURRENT_DIR) $(INSTALL_DIR)/$(BIN)
ln -s $(INSTALL_DIR)/ied/lib/cmd.js $(BIN_DIR)/ied
install: node_modules install_dirs
cp -R $(CURRENT_DIR) $(INSTALL_DIR)/$(BIN)
chmod +x $(INSTALL_DIR)/$(BIN)
ln -s $(INSTALL_DIR)/ied/lib/cmd.js $(BIN_DIR)/ied
uninstall:
rm -rf $(INSTALL_DIR)/$(BIN) $(BIN_DIR)/$(BIN)
clean:
rm -rf lib test/test
docs: src
$(DEPS_BIN_DIR)/esdoc -c esdoc.json
test:
./lib/cmd.js test
lint:
./lib/cmd.js run lint
dev:
./lib/cmd.js start
watch:
./lib/cmd.js compile:watch