-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·86 lines (65 loc) · 1.92 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
77
78
79
80
81
82
83
84
85
86
# Customization point: where make build (the default target) sends things to.
BUILD_DIR := staging
# Default target - build a staging tree.
all: build
# Generated files from the SVG of the favicon.
favicon := favicon_16.png favicon_32.png favicon_48.png favicon.ico
# PHP files we should copy and lint.
phpfiles := \
common.php \
download.php \
family.php \
generate.php \
index.php \
support/attachment.php \
support/sanitize.php \
external/guid.php
# Source template files
templatefiles := $(wildcard templates/*.tpl)
# Optional flies that may or may not be here.
optional_files := \
config.php \
defaultauthor.txt \
defaultindentation.txt \
defaultlicense.txt
present_optional_files := $(foreach file,$(optional_files),$(wildcard $(file)))
# All files that should be copied to a staging tree.
build_sources := \
ICanHaz.min.js \
$(favicon) \
$(phpfiles) \
$(templatefiles) \
$(present_optional_files)
# Subdirectories we need created in the build directory
out_dirs := support external templates
build_dirs := $(BUILD_DIR) $(patsubst %,$(BUILD_DIR)/%,$(out_dirs))
# Create directories for build/staging tree
$(build_dirs):
mkdir -p $@
# Copy files into build/staging tree
build_files := $(patsubst %,$(BUILD_DIR)/%,$(build_sources))
$(build_files): $(BUILD_DIR)/% : %
cp $< $@
build: $(build_dirs) $(build_files)
icon: recurse $(favicon)
check: phplint
./dotest.sh asdf h
./dotest.sh asdf ch
./dotest.sh asdf cpp
$(patsubst %,sources/favicon/%,$(favicon)): sources/favicon/% : sources/favicon/favicon.svg sources/favicon/Makefile
${MAKE} -C sources/favicon/ $*
recurse:
${MAKE} -C sources/favicon/
@for fn in $(favicon); do \
cp sources/favicon/$$fn $$fn ;\
done
#$(favicon): % : sources/favicon/%
# cp $< $@
clean:
${MAKE} -C sources/favicon/ clean
rm -rf $(BUILD_DIR)
phplint:
@for fn in $(phpfiles) test-locally; do \
php -l $$fn ;\
done
.PHONY: all build icon recurse clean check phplint