-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTupfile
69 lines (56 loc) · 1.89 KB
/
Tupfile
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
# source files (minus main function)
SRC=src/geom/ball.cpp\
src/geom/vec.cpp\
src/geom/mat.cpp\
src/math/random.cpp\
src/common/char.cpp\
src/exception/exception.cpp\
src/common/string.cpp\
src/common/file.cpp\
src/draw/image.cpp\
src/draw/tga.cpp\
src/draw/sdlWindow.cpp\
src/draw/gl/texture.cpp\
src/draw/gl/framebuffer.cpp\
src/draw/gl/program.cpp\
src/draw/gl/mesh.cpp\
src/draw/gl/mdl.cpp\
src/draw/gl/drawDevice.cpp\
src/draw/scene.cpp\
src/entity/entity.cpp\
src/ring_automaton.cpp\
src/object.cpp
# test files
TST=test/ball_test.cpp\
test/vec_test.cpp\
test/tga_test.cpp\
test/mat_test.cpp\
test/string_test.cpp
CXXFLAGS=-Isrc -g -O0 -fPIC --std=c++11
LDFLAGS=-shared -lGL -lSDL -lGLEW -lSDL_mixer
EXE=bslib.so
TESTEXE=test/test
TEST_LDFLAGS=-lgtest -lgtest_main -pthread -lGL -lSDL -lGLEW -lSDL_mixer
ifeq (@(TUP_PLATFORM),win32)
LDFLAGS+=-lmingw32
EXE=bslib.exe
TESTEXE=test/test.exe
TEST_LDFLAGS+=-lmingw32
endif
SAMPLESRC = src/main.cpp
SAMPLEEXE = ggj
SAMPLE_LDFLAGS = -pthread -lGL -lSDL -lGLEW -lSDL_mixer
# compile source files into .o files
: foreach $(SRC) |> g++ -c $(CXXFLAGS) %f -o %o |> build/%B.o {OBJS}
# compile cpp file with main function into .o
: $(MAIN) |> g++ -c $(CXXFLAGS) %f -o %o |> build/%B.o {MAIN}
# compile test files into .o files
: foreach $(TST) |> g++ -c $(CXXFLAGS) %f -o %o |> build/test/%B.o {TESTOBJS}
# compile objects into executable
: {OBJS} {MAIN} |> g++ %f -o $(EXE) $(LDFLAGS) |> $(EXE)
# compile objects (minus main function) into test executable
: {OBJS} {TESTOBJS} |> g++ %f -o $(TESTEXE) $(TEST_LDFLAGS) |> $(TESTEXE)
# compile sample file into .o
: foreach $(SAMPLESRC) |> g++ -c $(CXXFLAGS) %f -o %o |> build/test/%B.o {SAMPLEOBJ}
# compile objects (minus main function) into test executable
: {OBJS} {SAMPLEOBJ} |> g++ %f -o $(SAMPLEEXE) $(SAMPLE_LDFLAGS) |> $(SAMPLEEXE)