Mirai's Miscellaneous Misadventures
M3 / Makefile
1engine ?= sdl2
2
3ifeq ($(engine),sdl2)
4libs += -lSDL2
5endif
6
7src = game.c engines/$(engine).c
8
9mimimi: $(src:.c=.o)
10 $(CC) $(LDFLAGS) -o $@ $^ $(libs)
11
12.PHONY: clean
13clean:
14 $(RM) mimimi $(src:.c=.o) $(src:.c=.d)
15
16%.d: %.c
17 $(CC) -MM -MP -MT '$(@:.d=.o) $@' -MF $@ engines/sdl2.c
18
19include $(src:.c=.d)