summary refs log tree commit diff
path: root/Makefile
blob: 86792a4c0ba94b328843156a8991cec5ae4ec1f2 (plain) (blame)
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
CXX := g++
LINKER := g++
SRCDIR := ./src
BINDIR := ./build
EXE := $(BINDIR)/blackshades

CXXFLAGS := -O2 -Wall -g -I$(SRCDIR)
LDFLAGS := -lSDL -lGL -lGLU -lopenal -lalut -lvorbisfile

SRCS := Camera.cpp \
        Decals.cpp \
        Fog.cpp \
        Frustum.cpp \
        GameDraw.cpp \
        GameInitDispose.cpp \
        GameLoop.cpp \
        GameTick.cpp \
        Globals.cpp \
        MacInput.cpp \
        Main.cpp \
        Models.cpp \
        Person.cpp \
        Quaternions.cpp \
        Serialize.cpp \
        Skeleton.cpp \
        Sprites.cpp \
        Support.cpp \
        TGALoader.cpp \
        Text.cpp \
        Timer.cpp \
        Textures.cpp

OBJS := $(foreach f,$(SRCS:.cpp=.o),$(BINDIR)/$(f))
SRCS := $(foreach f,$(SRCS),$(SRCDIR)/$(f))

CLEANUP = $(wildcard *.exe) $(wildcard *.obj) \
          $(wildcard $(BINDIR)/*.exe) $(wildcard $(BINDIR)/*.obj) \
          $(wildcard *~) $(wildcard *.err) \
          $(wildcard .\#*) $(EXE)

# Rules for compiling individual source files...

$(BINDIR)/%.o: $(SRCDIR)/%.cpp
	$(CXX) -c -o $@ $< $(CXXFLAGS)

.PHONY: all clean
all: $(EXE)

$(EXE): $(BINDIR) $(OBJS)
	$(LINKER) -o $(EXE) $(OBJS) $(LDFLAGS)

$(BINDIR):
	mkdir -p $(BINDIR)
	make $(BINDIR)

clean:
	rm -f $(CLEANUP)
	rm -rf $(BINDIR)