-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathMakefile
52 lines (35 loc) · 1.13 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
SOURCE = source
SCRIPT_FILES := $(SOURCE)/shadowbox.js \
$(SOURCE)/shadowbox-flash.js \
$(SOURCE)/shadowbox-video.js
STYLE_FILES := $(SOURCE)/shadowbox.css \
$(SOURCE)/shadowbox-video.css
IMAGE_FILES := $(SOURCE)/shadowbox-icons.png \
$(SOURCE)/shadowbox-controls.png
TARGET ?= build
NODE_BIN = node_modules/.bin
all: setup build
setup: $(NODE_BIN)/uglifyjs $(NODE_BIN)/autoprefixer $(NODE_BIN)/csso
$(NODE_BIN)/uglifyjs:
npm install uglify-js
$(NODE_BIN)/autoprefixer:
npm install autoprefixer
$(NODE_BIN)/csso:
npm install csso
build: $(TARGET)/shadowbox.min.js $(TARGET)/shadowbox.min.css $(TARGET)/shadowbox-icons.png $(TARGET)/shadowbox-controls.png
$(TARGET)/shadowbox.js: $(SCRIPT_FILES)
mkdir -p $(TARGET)
cat $^ > $@
$(TARGET)/shadowbox.min.js: $(TARGET)/shadowbox.js
$(NODE_BIN)/uglifyjs $< -cmo $@
$(TARGET)/shadowbox.css: $(STYLE_FILES)
mkdir -p $(TARGET)
cat $^ | $(NODE_BIN)/autoprefixer -o $@
$(TARGET)/shadowbox.min.css: $(TARGET)/shadowbox.css
$(NODE_BIN)/csso -i $< -o $@
$(TARGET)/%.png: $(SOURCE)/%.png
mkdir -p $(TARGET)
cp $< $@
clean:
rm -rf node_modules $(TARGET)
.PHONY: all setup build clean