aboutsummaryrefslogtreecommitdiffstats
path: root/GNUmakefile
blob: 93f17279c1cdd7e4902d30937c715bdf31a4cf5b (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
pcms := 5m.pcm 10m.pcm 15m.pcm
oggs := $(pcms:.pcm=.ogg)
mp3s := $(pcms:.pcm=.mp3)

artist := "Tomasz Kramkowski"
genre := Electronic
album := Beeps
year := 2024
tracknum_5m := 3
title_5m := "Large Beeps"
tracknum_10m := 2
title_10m := "Versatile Beeps"
tracknum_15m := 1
title_15m := "Medium Beeps"

get = $($(1)_$(2))

all: ogg mp3
ogg: $(oggs)
mp3: $(mp3s)

5m.pcm: duration := 300
10m.pcm: duration := 600
15m.pcm: duration := 900

%.ogg: %.pcm GNUmakefile
	oggenc --quiet --raw --raw-bits=8 --raw-chan=1 --raw-rate=8000 --quality=5 \
		--artist=$(artist) --genre=$(genre) --date=$(year) \
		--tracknum=$(call get,tracknum,$*) --title=$(call get,title,$*) \
		--album=$(album) --output=$@ $<

%.mp3: %.pcm GNUmakefile
	lame --quiet -r -s 8 --bitwidth 8 --unsigned -m m -V 4 \
		--tt $(call get,title,$*) --ta $(artist) --tl $(album) --ty $(year) \
		--tn $(call get,tracknum,$*) --tg $(genre) --noreplaygain $< $@

$(pcms): target/release/beeps GNUmakefile
	$< $(duration) >$@

target/release/beeps: Cargo.lock Cargo.toml beeps.rs GNUmakefile
	cargo build --release

clean:
	rm $(oggs) $(mp3s) $(pcms)
	cargo clean

.PHONY: all ogg mp3 clean