-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
76 lines (67 loc) · 1.68 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
70
71
72
73
74
75
76
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
#
## Variables
BIN=node_modules/.bin
BUILD=build
BUILD_ALL_CSS=$(BUILD)/all.css
SRC=src
CSS=$(SRC)/css
DIST=docs/
IMAGES=$(SRC)/images
PUBLIC=public
PUBLIC_ALL_CSS=$(PUBLIC)/css/all.css
SCRIPTS=scripts
# Targets
#
# The format goes:
#
# target: list of dependencies
# commands to build target
#
# If something isn't re-compiling double-check the changed file is in the
# target's dependencies list.
# Phony targets - these are for when the target-side of a definition
# (such as "all" below) isn't a file but instead a just label. Declaring
# it as phony ensures that it always run, even if a file by the same name
# exists.
.PHONY: all clean commit copy
all: $(PUBLIC_ALL_CSS) copy
clean:
# Delete build and output files:
rm -rf $(BUILD) $(PUBLIC)
commit:
rm -rf $(DIST)/
cp -r $(PUBLIC) $(DIST);
git add $(DIST);
git commit $(DIST);
copy:
# Fonts:
mkdir -p $(PUBLIC)/fonts/OpenSans
cp -r node_modules/open-sans-fontface/fonts/**/* $(PUBLIC)/fonts/OpenSans/
# Images:
mkdir -p $(PUBLIC)/images/
cp -r $(IMAGES)/* $(PUBLIC)/images/
# HTML files:
cp -r $(SRC)/*.html $(PUBLIC)/
CSS_FILES=$(CSS)/fonts.css\
$(CSS)/reset.css\
$(CSS)/style.css\
$(CSS)/pages/*.css
$(BUILD_ALL_CSS): $(CSS)/
mkdir -p $$(dirname $@)
rm -f $(BUILD_ALL_CSS)
for file in $(CSS_FILES); do \
echo "/* $$file */" >> $(BUILD_ALL_CSS); \
cat $$file >> $(BUILD_ALL_CSS); \
echo "" >> $(BUILD_ALL_CSS); \
done
$(PUBLIC_ALL_CSS): $(BUILD_ALL_CSS)
mkdir -p $(PUBLIC)/css/
cp $(BUILD_ALL_CSS) $(PUBLIC_ALL_CSS)