forked from faye/faye
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (46 loc) · 1.53 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
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
source_files := $(shell find src -name '*.js')
spec_files := $(shell find spec -name '*_spec.js')
webpack_config := webpack.config.js
name := faye-browser
browser_global := Faye
bundles := $(name).js $(name).js.map $(name)-min.js $(name)-min.js.map
client_dir := build/client
client_bundles := $(bundles:%=$(client_dir)/%)
top_files := package.json src CHANGELOG.md README.md
top_level := $(top_files:%=build/%)
.PHONY: all gem test clean
all: $(client_bundles) $(top_level)
gem: all
gem build faye.gemspec
clean:
rm -rf build *.gem spec/*_bundle.js spec/*.map
$(client_dir)/$(name).js: $(webpack_config) $(source_files)
mkdir -p $(dir $@)
webpack . $@ \
--config $< \
--display-modules \
--output-library $(browser_global)
$(client_dir)/$(name).js.map: $(client_dir)/$(name).js
$(client_dir)/$(name)-min.js: $(client_dir)/$(name).js $(client_dir)/$(name).js.map
uglifyjs $< \
--in-source-map $(word 2,$^) \
--compress \
--mangle \
--output $@ \
--source-map $@.map \
--source-map-url $(notdir $@.map)
$(client_dir)/$(name)-min.js.map: $(client_dir)/$(name)-min.js
test: spec/browser_bundle.js
spec/browser_bundle.js: $(webpack_config) $(source_files) $(spec_files)
webpack spec/browser.js $@ \
--config $< \
--display-modules \
--watch
build/src: $(source_files) build
rsync -a src/ $@/
build/%: % build
cp $< $@
build:
mkdir -p $@