forked from MESYETI/ycraft-old3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (53 loc) · 1.31 KB
/
Makefile
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
# files
SRC = ${wildcard src/*.cc}
DEPS = ${wildcard headers/*}
DEPS += ${wildcard src/*.hh}
OBJ = ${addsuffix .o,${subst src/,bin/,${basename ${SRC}}}}
APP = ./bin/ycraft
# compiler related
ifeq (${platform}, windows)
CXX = x86_64-w64-mingw32-g++
else
CXX = clang++
endif
CCACHE = ccache
CXXVER = c++17
CXXFLAGS = \
-std=${CXXVER} \
-Wall \
-Wextra \
-pedantic \
-Wno-deprecated-declarations -Wno-missing-field-initializers
ifeq (${releasemode}, on)
CXXFLAGS += -O3 -s
else
CXXFLAGS += -O0 -g
endif
ifeq (${platform}, windows)
CXXFLAGS += -I./sdl2/x86_64-w64-mingw32/include/ -Dmain=SDL_main
else
CXXFLAGS += $(shell sdl2-config --cflags)
CXXFLAGS += $(shell pkg-config libcurl --cflags)
endif
ifeq (${debug}, on)
CXXFLAGS += -DDEBUG_EXCEPTION
endif
ifeq (${platform}, windows)
CXXLIBS += -L./sdl2/x86_64-w64-mingw32/lib -mwindows \
-L./sdl2image/x86_64-w64-mingw32/lib \
-L./sdl2ttf/x86_64-w64-mingw32/lib \
-L./curl/lib -lmingw32 -static-libgcc -static-libstdc++
endif
CXXLIBS += $(shell sdl2-config --libs) -lSDL2main -lSDL2_ttf -lSDL2_image -lSDL2_mixer -lm -lcurl
# rules
compile: ./bin ${OBJ} ${SRC}
${CCACHE} ${CXX} -o ${APP} ${OBJ} ${CXXLIBS}
./bin:
mkdir -p bin
bin/%.o: src/%.cc ${DEPS}
${CCACHE} ${CXX} -c $< ${CXXFLAGS} -o $@
clean:
rm bin/*.o $(APP)
all:
@echo compile
@echo clean