-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
205 lines (156 loc) · 6.83 KB
/
Copy pathMakefile
File metadata and controls
205 lines (156 loc) · 6.83 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
TERMPAINT := termpaint
BUILD := build
CC ?= cc
CFLAGS ?= -O2 -g
CFLAGS += -std=gnu11 -Wall -Wextra -I$(TERMPAINT)
LDLIBS += -lm
# defines meson normally supplies; -include stdarg.h papers over a missing
# include in termpaintx_ttyrescue.c that only bites on macOS
LIB_CFLAGS := -DTERMPAINT_RESCUE_EMBEDDED -DTERMPAINT_RESCUE_PATH='"/usr/libexec"' \
-include stdarg.h -Wno-unused-parameter
LIB_SRCS := termpaint.c termpaint_event.c termpaint_input.c \
termpaintx.c termpaintx_ttyrescue.c ttyrescue.c
LIB_OBJS := $(LIB_SRCS:%.c=$(BUILD)/termpaint/%.o)
EFFECTS := fireworks fireworks-gfx matrix matrix-gfx ripples ripples-gfx \
fire fire-gfx starfield starfield-gfx
APPS := taskman taskman-gfx filer filer-gfx 2048 2048-gfx sysmon sysmon-gfx \
extracer extracer-gfx
all: submodules $(addprefix $(BUILD)/,$(EFFECTS) $(APPS)) $(BUILD)/kitty_probe
submodules:
@test -f $(TERMPAINT)/termpaint.h || git submodule update --init
$(BUILD)/fireworks: $(BUILD)/fireworks.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/fireworks-gfx: $(BUILD)/fireworks-gfx.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/fireworks.o: fireworks.c | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/fireworks-gfx.o: fireworks-gfx.c kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/matrix: $(BUILD)/matrix.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/matrix.o: matrix.c kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/matrix-gfx: $(BUILD)/matrix-gfx.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/matrix-gfx.o: matrix-gfx.c kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/ripples: $(BUILD)/ripples.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/ripples.o: ripples.c | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/ripples-gfx: $(BUILD)/ripples-gfx.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/ripples-gfx.o: ripples-gfx.c kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/fire: $(BUILD)/fire.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/fire.o: fire.c | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/fire-gfx: $(BUILD)/fire-gfx.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/fire-gfx.o: fire-gfx.c kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/starfield: $(BUILD)/starfield.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/starfield.o: starfield.c | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/starfield-gfx: $(BUILD)/starfield-gfx.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/starfield-gfx.o: starfield-gfx.c kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/kitty_gfx.o: kitty_gfx.c kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
# --- menu-driven TUI apps (termpaint cells + a kitty graphics backdrop) ---
# Each <app>.c is the cell program; <app>-gfx.c is a one-line shim that
# #defines the gfx build and #includes <app>.c, so the pair stays DRY.
$(BUILD)/tui.o: tui.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/taskman: $(BUILD)/taskman.o $(BUILD)/tui.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/taskman-gfx: $(BUILD)/taskman-gfx.o $(BUILD)/tui.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/taskman.o: taskman.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/taskman-gfx.o: taskman-gfx.c taskman.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/filer: $(BUILD)/filer.o $(BUILD)/tui.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/filer-gfx: $(BUILD)/filer-gfx.o $(BUILD)/tui.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/filer.o: filer.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/filer-gfx.o: filer-gfx.c filer.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/2048: $(BUILD)/2048.o $(BUILD)/tui.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/2048-gfx: $(BUILD)/2048-gfx.o $(BUILD)/tui.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/2048.o: 2048.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/2048-gfx.o: 2048-gfx.c 2048.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/sysmon: $(BUILD)/sysmon.o $(BUILD)/tui.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/sysmon-gfx: $(BUILD)/sysmon-gfx.o $(BUILD)/tui.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/sysmon.o: sysmon.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/sysmon-gfx.o: sysmon-gfx.c sysmon.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/extracer: $(BUILD)/extracer.o $(BUILD)/tui.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/extracer-gfx: $(BUILD)/extracer-gfx.o $(BUILD)/tui.o $(BUILD)/kitty_gfx.o $(LIB_OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
$(BUILD)/extracer.o: extracer.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/extracer-gfx.o: extracer-gfx.c extracer.c tui.h kitty_gfx.h | $(BUILD)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/termpaint/%.o: $(TERMPAINT)/%.c | $(BUILD)/termpaint
$(CC) $(CFLAGS) $(LIB_CFLAGS) -c -o $@ $<
$(BUILD) $(BUILD)/termpaint:
mkdir -p $@
run: $(BUILD)/fireworks
./$(BUILD)/fireworks
$(BUILD)/kitty_probe: kitty_probe.c | $(BUILD)
$(CC) $(CFLAGS) -o $@ $<
run-gfx: $(BUILD)/fireworks-gfx
./$(BUILD)/fireworks-gfx
run-matrix: $(BUILD)/matrix
./$(BUILD)/matrix
run-matrix-gfx: $(BUILD)/matrix-gfx
./$(BUILD)/matrix-gfx
run-ripples: $(BUILD)/ripples
./$(BUILD)/ripples
run-ripples-gfx: $(BUILD)/ripples-gfx
./$(BUILD)/ripples-gfx
run-fire: $(BUILD)/fire
./$(BUILD)/fire
run-fire-gfx: $(BUILD)/fire-gfx
./$(BUILD)/fire-gfx
run-starfield: $(BUILD)/starfield
./$(BUILD)/starfield
run-starfield-gfx: $(BUILD)/starfield-gfx
./$(BUILD)/starfield-gfx
run-taskman: $(BUILD)/taskman
./$(BUILD)/taskman
run-taskman-gfx: $(BUILD)/taskman-gfx
./$(BUILD)/taskman-gfx
run-filer: $(BUILD)/filer
./$(BUILD)/filer
run-filer-gfx: $(BUILD)/filer-gfx
./$(BUILD)/filer-gfx
run-2048: $(BUILD)/2048
./$(BUILD)/2048
run-2048-gfx: $(BUILD)/2048-gfx
./$(BUILD)/2048-gfx
run-sysmon: $(BUILD)/sysmon
./$(BUILD)/sysmon
run-sysmon-gfx: $(BUILD)/sysmon-gfx
./$(BUILD)/sysmon-gfx
run-extracer: $(BUILD)/extracer
./$(BUILD)/extracer
run-extracer-gfx: $(BUILD)/extracer-gfx
./$(BUILD)/extracer-gfx
clean:
rm -rf $(BUILD)
.PHONY: all submodules run run-gfx run-matrix run-matrix-gfx run-ripples run-ripples-gfx run-fire run-fire-gfx run-starfield run-starfield-gfx run-taskman run-taskman-gfx run-filer run-filer-gfx run-2048 run-2048-gfx run-sysmon run-sysmon-gfx run-extracer run-extracer-gfx clean