-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
137 lines (97 loc) · 4.6 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
PHOTOS_FULL = $(shell find dist/photos/full -name '*.jpg')
PHOTOS_HD = $(PHOTOS_FULL:dist/photos/full/%=dist/photos/hd/%)
PHOTOS_SD = $(PHOTOS_FULL:dist/photos/full/%=dist/photos/sd/%)
PHOTOS_THUMB = $(PHOTOS_FULL:dist/photos/full/%=dist/photos/thumb/%)
PHOTOS_HTML = $(PHOTOS_FULL:dist/photos/full/%.jpg=dist/photos/%.html)
MD = $(shell find . -name '*.md' ! -path './node_modules/*' ! -path './dist/*' ! -path './README.md' | sed 's,^./,,')
HTML = $(MD:%.md=dist/%.html)
SCRIPTS = $(shell find js -name '*.js')
ICONS = dist/img/icons/403-instagram.svg dist/img/icons/407-twitter.svg dist/img/icons/414-youtube.svg dist/img/icons/433-github.svg dist/img/icons/452-soundcloud.svg dist/img/icons/219-heart.svg
ASSETS = dist/css/normalize.css dist/css/codejam-20220520.css dist/css/main-20220520.css dist/js/main-20211017.js $(ICONS)
build: dist $(PHOTOS_HD) $(PHOTOS_SD) $(PHOTOS_THUMB) $(PHOTOS_HTML) $(HTML) $(ASSETS)
watch:
npm run watch
dist:
git worktree add dist gh-pages
clean:
# Purposedly not cleaning generated photos, do it manually if you really need.
rm -f $(HTML) $(ASSETS)
clean-html:
rm -f $(HTML)
clean-orphans:
make orphans | xargs ./scripts/delete-photo
new:
./scripts/new
rotate-css:
./scripts/rotate css
rotate-codejam-css:
./scripts/rotate css codejam
rotate-js:
./scripts/rotate js
orphans: .photos .references
@comm -23 .photos .references
@rm .photos .references
missing: .photos .references
@comm -13 .photos .references
@rm .photos .references
.photos: $(PHOTOS_FULL)
@printf '%s\n' $(^:dist/photos/full/%=%) | sort | uniq > $@
.references: $(HTML)
@grep --no-filename -Eo '/photos/[^\.]*\.(jpg|html)' $^ | sed 's/\.html$$/.jpg/;s/.*\///' | sort | uniq > $@
dist/photos/hd/%.jpg: dist/photos/full/%.jpg
convert $< -resize 1920x1080^ $@
dist/photos/sd/%.jpg: dist/photos/full/%.jpg
convert $< -resize 960x540^ $@
dist/photos/thumb/%.jpg: dist/photos/full/%.jpg
convert $< -resize 300x200^ -gravity center -extent 300x200 $@
dist/photos/%.html: cache/render-photo-pages-flag
@# Avoid slowing down `make` by looking up for implicit targets.
@echo $@
cache/render-photo-pages-flag: $(PHOTOS_HD) head.html foot.html
touch $@
./scripts/render-photo-pages
dist/%.html: %.md head.html foot.html | $(PHOTOS_HD) $(PHOTOS_THUMB)
mkdir -p $$(dirname $@)
./scripts/render $< > $@
dist/css/normalize.css: node_modules/normalize.css/normalize.css
cp $< $@
dist/css/codejam-20220520.css:
curl \
https://raw.githubusercontent.com/valeriangalliat/blog/master/css/colors.css \
https://raw.githubusercontent.com/valeriangalliat/blog/master/css/base.css \
https://raw.githubusercontent.com/valeriangalliat/blog/master/css/components/footer.css \
https://raw.githubusercontent.com/valeriangalliat/blog/master/css/components/header.css \
https://raw.githubusercontent.com/valeriangalliat/blog/master/css/components/nav.css \
https://raw.githubusercontent.com/valeriangalliat/blog/master/css/components/social.css \
> $@
dist/css/main-20220520.css: css/main.css css/slide.css css/photo.css
cat $^ > $@
dist/js/main-20211017.js: $(SCRIPTS)
npm run build
dist/photos/thumb/P2680620-Pano-0.jpg: dist/photos/full/P2680620-Pano.jpg
convert $< -resize 600x200^ -gravity center -extent 300x200-150+0 $@
dist/photos/thumb/P2680620-Pano-1.jpg: dist/photos/full/P2680620-Pano.jpg
convert $< -resize 600x200^ -gravity center -extent 300x200+150+0 $@
dist/img/val-1.jpg: dist/photos/full/IMG_20181204_184340.jpg
magick $< -resize 1280x -crop '1280x512+0+%[fx:45/100*(h-512)]' $@
dist/img/val-2.jpg: dist/photos/full/IMG_20190103_111123.jpg
magick $< -resize 1280x -crop '1280x512+0+%[fx:10/100*(h-512)]' $@
dist/img/val-3.mp4: VID_20181121_141159.mp4
ffmpeg -i $< -s 1280x540 -c:a copy $@
dist/img/val-3.jpg: VID_20181121_141159.mp4
ffmpeg -v error -nostdin -accurate_seek -ss 00:00:01.933 -i $< -vf scale=iw*sar:ih -frames:v 1 -f image2 - \
| magick - -resize 1280x $@
dist/img/val-4.jpg: dist/photos/full/242989947_902803300666398_4415379739264788769_n.jpg
magick $< -resize 1280x -crop '1280x512+0+%[fx:40/100*(h-512)]' $@
dist/img/icons/%.svg: node_modules/icomoon-free-npm/SVG/%.svg
cat $< | sed 's/<svg /<svg id="icon" /;s/ fill="#000000"//' > $@
dist/img/icons/instagram.png:
curl 'https://www.instagram.com/static/images/ico/favicon-192.png/68d99ba29cc8.png' | convert - -resize 16x $@
dist/img/icons/twitter.png:
curl 'https://abs.twimg.com/responsive-web/client-web/icon-ios.b1fc7275.png' | convert - -resize 16x $@
dist/img/icons/gmail.png:
curl 'https://ssl.gstatic.com/ui/v1/icons/mail/rfr/gmail.ico' | convert 'ico:-[3]' -resize 16x $@
serve:
cd dist && python3 -m http.server 8001
dev:
make watch & make serve