blob: 58990fd0cec319755ebdf96759b58380238eb343 (
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
|
#!/usr/bin/env -S gmake -f
GLAD ?= glad
MKDIR ?= mkdir -p
libs ::= SDL2 openmpt fluidsynth
cflags ::= -I . -g -Og ${CFLAGS}
ldflags ::= -Wl,--rpath,'$$ORIGIN' $(addprefix -l,${libs}) ${LDFLAGS}
srcs ::= $(wildcard src/modules/*.c)
objs ::= $(addprefix out/,$(notdir ${srcs:.c=.o}))
deps ::= $(addprefix out/,$(notdir ${srcs:.c=.d}))
.PHONY: all run clean
all: out/mu-sdl
run: out/mu-sdl
./$<
clean:
${RM} -r out/
out/:
${MKDIR} $@
out/%.o: src/modules/%.c out/%.d | out/
${CC} -c -o $@ $< ${cflags}
out/%.d: src/modules/%.c | out/
${CC} ${cflags} ${CPPFLAGS} -MM -MG -MF $@ -MT "${@:.d=.o} $@" $<
out/%.o: src/%.c out/%.d | out/
${CC} -c -o $@ $< ${cflags}
out/%.d: src/%.c | out/
${CC} ${cflags} ${CPPFLAGS} -MM -MG -MF $@ -MT "${@:.d=.o} $@" $<
out/mu-%: out/%.o ${objs} | out/
${CC} -o $@ $^ ${cflags} ${ldflags}
include ${deps}
|