summary refs log tree commit diff
path: root/Makefile
blob: 718f7999795477cd1e2c208d3dace0de6d114c5a (plain)
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
MEDIA_DIR := /srv/media
TEST_DIR := /srv/www/pdp8-test
PUB_DIR := /srv/www/pdp8

MUSIC_DIR := $(MEDIA_DIR)/music
FLAC := $(wildcard $(MUSIC_DIR)/*/*.flac)
MP3 := $(subst flac,mp3,$(FLAC))

IMG_DIR := $(MEDIA_DIR)/pictures
WWW_DIR := $(IMG_DIR)/www
IMG := $(wildcard $(SRC_DIR)/*.jpeg)
IMG_WWW := $(subst $(SRC_DIR), $(WWW_DIR), $(subst jpeg,webp, $(IMG)))

VIDEO_DIR := /srv/media/videos
VIDEO_WEBM := $(wildcard $(VIDEO_DIR)/*/*.webm)
VIDEO_MP4 := $(subst webm,mp4, $(VIDEO_WEBM))
VIDEO_WEBP := $(subst webm,webp, $(VIDEO_WEBM))
VIDEO_PNG := $(subst webm,png, $(VIDEO_WEBM))

CLIMBING_DIR := /srv/media/climbing
CLIMBING_WEBM := $(wildcard $(CLIMBING_DIR)/*.webm)
CLIMBING_MP4 := $(subst webm,mp4, $(CLIMBING_WEBM))
CLIMBING_WEBP := $(subst webm,webp, $(CLIMBING_WEBM))

HTML := index.html music.html pictures.html videos.html climbing.html about.html code.html contact.html social/create.html social/announce.html 
OTHER := pdp8.png 540px-PDP-8_.jpg style.css robots.txt sitemap.txt rss.xml

TEST_HTML := $(addprefix $(TEST_DIR)/, $(HTML))
TEST_OTHER := $(addprefix $(TEST_DIR)/, $(OTHER))
PUB_HTML := $(addprefix $(PUB_DIR)/, $(HTML))

all: test
	cd $(TEST_DIR); git commit -am "$$(date)"; git push; cd $(PUB_DIR); git pull

test: $(TEST_HTML) $(TEST_OTHER)

$(TEST_DIR)/rss.xml: $(TEST_HTML)
	./rss.rb 

$(TEST_DIR)/index.html: $(TEST_DIR)/music.html
	cp $< $@

$(TEST_DIR)/music.html: $(MP3)
	./music.rb

$(TEST_DIR)/pictures.html: /srv/social/outbox/create/ $(IMG_WWW)
	./pictures.rb
	
$(TEST_DIR)/videos.html: $(VIDEO_MP4) $(VIDEO_WEBP)
	./videos.rb
	
$(TEST_DIR)/climbing.html: $(CLIMBING_MP4) $(CLIMBING_WEBP)
	./climbing.rb

$(TEST_DIR)/%.html: ./html/%.html
	./file.rb $< 

$(TEST_DIR)/%.png: ./html/%.png
	cp $< $@

$(TEST_DIR)/%.jpg: ./html/%.jpg
	cp $< $@

$(TEST_DIR)/%.css: ./html/%.css
	cp $< $@

$(TEST_DIR)/%.txt: ./html/%.txt
	cp $< $@

%.mp3: %.flac
	ffmpeg -i $< -y -vsync 0 -ab 256k -map_metadata 0 -id3v2_version 3 $@

%.webp: %.webm
	ffmpeg -i $< -HIDE_BANNER -loglevel error -vf thumbnail -frames:v 1 -c:v png -f image2pipe - | convert - $@

$(WWW_DIR)/%.webp: $(IMG_DIR)/%.jpeg
	convert $< -resize 1536x1024 -quality 85 $@

%.mp4: %.webm
	ffmpeg -i $< -vf scale=1280:-2 -c:v h264 -c:a aac -b:a 128k -strict -2 -movflags faststart $@