summaryrefslogtreecommitdiff
path: root/makefile
blob: ad71e1854ab2144831dbf5f511c023135cb73c65 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
CC=gcc
CPPFLAGS= -Wall -c # -I
LIBS= -Wall -O2 -L /usr/local/lib -lavutil -lavcodec -lavformat # -L /Users/durand/Desktop/Centre/A\ propos\ de\ programmes/C/player/lib -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -L /usr/local/lib -lavutil -lswscale -lavcodec
out=output.mp3
SOURCES=main.c instrument.c util.c parser.c mix.c

all: main TAGS

%.d: %.c
	@echo "Remaking makefiles..."
	@set -e; rm -f $@; \
	$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
	rm -f $@.$$$$
	@echo "Done"

include $(SOURCES:.c=.d)

TAGS: *.c *.h
	etags $+

# parser.o : parser.c parser.h util.h instrument.h mix.h
# 	$(CC) $(CPPFLAGS) $< -o $@

main: $(SOURCES:.c=.o)
	$(CC) $(LIBS) -o $@ $+

.PHONY: clean all play clear cat tur coffin tetris

clean:
	@echo "Cleaning..."
	-@rm -rf *.o main TAGS *.dYSM 2>/dev/null || true
	@echo "Done."

$(out): main
	./main

# play: $(out)
# 	ffplay -f f32le -ar 44100 -showmode 1 -autoexit output.mkv

play: $(out)
	mpv $<

tetris: main
	@echo "making tetris song..."
	-@rm notes.txt
	@ln -s "tetris/tetris notes.txt" notes.txt
	@./main
	@echo "Done."

tur: main
	@echo "making turkish march..."
	-@rm notes.txt
	@ln -s turkish/turkish\ notes.txt notes.txt
	@./main
	@echo "Done."

marble: main
	@echo "making marble machine..."
	-@rm notes.txt
	@ln -s marble\ machine/marble\ machine\ notes.txt notes.txt
	@./main
	@echo "Done."

cat: main
	@echo "making cat vibing..."
	-@rm notes.txt
	@ln -s cat/part\ of\ cat\ vibing.txt notes.txt
	@./main
	@echo "Done."

coffin: main
	@echo "making coffin dance..."
	-@rm notes.txt
	@ln -s coffin/part\ of\ coffin\ dance.txt notes.txt
	@./main
	@echo "Done."

elise: main
	@echo "making Für Elise..."
	-@rm notes.txt
	@ln -s "Für Elise/Für Elise notes.txt" notes.txt
	@./main
	@echo "Done."

single: main
	@echo "making Single Notes..."
	-@rm notes.txt
	@ln -s "test.txt" notes.txt
	@./main
	@echo "Done."


clear:
	@echo "Deleting $(out)..."
	-@rm $(out)
	@echo "Done."

test-parser.o: parser.c parser.h util.h
	$(CC) -Wall -c -DTEST -o $@ $<

test: util.o test-parser.o instrument.o
	$(CC) -Wall -O2 -o $@ $+