-
Notifications
You must be signed in to change notification settings - Fork 32
/
main.make
57 lines (41 loc) · 1.18 KB
/
main.make
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
# I personally don't care if you steal this makefile. --GM
TOOLS =
ifndef RENDERER
RENDERER = gl
endif
SRCDIR = src
INCDIR = include
INCLUDES = $(INCDIR)/common.h
OBJS = \
$(OBJDIR)/main.o \
$(OBJDIR)/vecmath.o \
$(OBJDIR)/dsp.o \
$(OBJDIR)/map.o $(OBJDIR)/model.o \
$(OBJDIR)/img.o \
$(OBJDIR)/$(RENDERER)/render.o $(OBJDIR)/$(RENDERER)/render_img.o \
$(OBJDIR)/$(RENDERER)/glad.o \
$(OBJDIR)/png.o \
$(OBJDIR)/lua.o $(OBJDIR)/network.o \
$(OBJDIR)/path.o $(OBJDIR)/json.o \
$(OBJDIR)/random.o \
$(OBJDIR)/wav.o \
$(OBJDIR)/external/bit.o
# TODO: make the renderer part not depend on, say, render_img.o
all: $(BINNAME) $(TOOLS)
clean:
rm -f $(OBJS)
$(OBJDIR):
mkdir -p $(OBJDIR)
$(OBJDIR)/$(RENDERER):
mkdir -p $(OBJDIR)/$(RENDERER)
$(OBJDIR)/external:
mkdir -p $(OBJDIR)/external
$(BINNAME): $(OBJDIR) $(OBJDIR)/$(RENDERER) $(OBJDIR)/external $(OBJS)
$(CC) -o $(BINNAME) $(LDFLAGS) $(OBJS) $(LIBS)
$(OBJDIR)/lua.o: $(SRCDIR)/lua.c $(SRCDIR)/lua_*.h $(INCLUDES)
$(CC) -c -o $@ $(CFLAGS) $<
$(OBJDIR)/$(RENDERER)/%.o: $(SRCDIR)/$(RENDERER)/%.c $(INCLUDES)
$(CC) -c -o $@ $(CFLAGS) $<
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(INCLUDES)
$(CC) -c -o $@ $(CFLAGS) $<
.PHONY: all clean