forked from rethinkdb/rethinkdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.mk
76 lines (58 loc) · 2.38 KB
/
build.mk
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
# Copyright 2010-2013 RethinkDB, all rights reserved.
JS_SRC_DIR=$(TOP)/drivers/javascript
DRIVER_COFFEE_BUILD_DIR=$(JS_BUILD_DIR)/coffee
PROTO_FILE_DIR := $(TOP)/src/rdb_protocol
PROTO_BASE := ql2
PROTO_FILE := $(PROTO_FILE_DIR)/$(PROTO_BASE).proto
PROTO_MODULE := $(JS_BUILD_DIR)/proto-def.js
DRIVER_COFFEE_FILES := $(wildcard $(JS_SRC_DIR)/*.coffee)
DRIVER_COMPILED_COFFEE := $(patsubst $(JS_SRC_DIR)/%.coffee,$(DRIVER_COFFEE_BUILD_DIR)/%.js,$(DRIVER_COFFEE_FILES))
JS_PKG_DIR := $(PACKAGES_DIR)/js
$(PROTO_MODULE): $(PROTO_FILE) | $(JS_BUILD_DIR)/.
$P CONVERT_PROTOFILE
$(JS_SRC_DIR)/../convert_protofile --language javascript --input-file $(PROTO_FILE) --output-file $(PROTO_MODULE)
# Must be synced with the list in package.json
JS_PKG_FILES := $(DRIVER_COMPILED_COFFEE) $(JS_SRC_DIR)/README.md $(PROTO_MODULE) $(JS_SRC_DIR)/package.json
.SECONDARY: $(DRIVER_COFFEE_BUILD_DIR)/.
$(DRIVER_COFFEE_BUILD_DIR)/%.js: $(JS_SRC_DIR)/%.coffee | $(DRIVER_COFFEE_BUILD_DIR)/. $(COFFEE_BIN_DEP)
$P COFFEE
$(COFFEE) -b -p -c $< > $@
.PHONY: js-dist
js-dist: $(JS_PKG_DIR) $(JS_PKG_DIR)/node_modules
$(JS_PKG_DIR): $(JS_PKG_FILES)
$P CP $(JS_PKG_DIR)
rm -rf $(JS_PKG_DIR)
mkdir -p $(JS_PKG_DIR)
cp $(JS_PKG_FILES) $(JS_PKG_DIR)
.PHONY: js-publish
js-publish: TMPFILE=$(shell mktemp)
js-publish: $(JS_PKG_DIR)
$P PUBLISH-JS $(JS_PKG_DIR)
cd $(JS_PKG_DIR) && npm publish
.PHONY: js-clean
js-clean:
$P RM $(JS_BUILD_DIR)
rm -rf $(JS_BUILD_DIR)
$P RM $(JS_PKG_DIR)
rm -rf $(JS_PKG_DIR)
.PHONY: js-install
js-install: NPM_PREFIX=.
js-install: $(JS_PKG_DIR) | $(NPM_BIN_DEP)
$P NPM-INSTALL $(JS_PKG_DIR)
MAKEFLAGS= $(NPM) install $(JS_PKG_DIR) --prefix $(NPM_PREFIX)
.PHONY: js-dependencies
js-dependencies: $(JS_PKG_DIR)/node_modules
BLUEBIRD_MODULE_DIR := $(SUPPORT_BUILD_DIR)/bluebird_$(bluebird_VERSION)/node_modules/packed-bluebird/node_modules/bluebird
$(BLUEBIRD_MODULE_DIR): $(SUPPORT_BUILD_DIR)/bluebird_$(bluebird_VERSION)/install.witness
touch $@
$(JS_PKG_DIR)/node_modules: $(BLUEBIRD_MODULE_DIR) $(JS_PKG_DIR) | $(NPM_BIN_DEP)
$P CP $@/bluebird
mkdir -p $@/bluebird
cp -a $(BLUEBIRD_MODULE_DIR)/. $@/bluebird
touch $@
$(JS_BUILD_DIR)/rethinkdb.js: $(JS_PKG_DIR) $(JS_PKG_DIR)/node_modules | $(BROWSERIFY_BIN_DEP)
$P BROWSERIFY
cd $(JS_PKG_DIR) && \
$(abspath $(BROWSERIFY)) --require ./rethinkdb:rethinkdb --outfile $(abspath $@)
.PHONY: js-driver
js-driver: $(JS_BUILD_DIR)/rethinkdb.js