-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
72 lines (55 loc) · 1.44 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
68
69
70
71
72
GAME = comet
MAIN = ./src/main.cpp
OBJ = $(subst .cpp,.o,$(subst ./src/,./build/, $(filter-out $(MAIN), $(wildcard ./src/*.cpp))))
CC = g++
CFLAGS = `sdl2-config --cflags`\
-g
CXXFLAGS = `sdl2-config --cflags` \
-std=c++11 \
-std=c++11 \
-Wall \
-g \
LDFLAGS = `sdl2-config --libs` \
-lSDL2_mixer \
-lSDL2_image \
-lSDL2_ttf \
-lSDL2_gfx \
-lm
INCLUDE = -I"/usr/include/SDL"
MKDIR = mkdir -p
RM = rm -rf
ifeq ($(OS), Windows_NT)
ECHO = ECHO
MKDIR =
RM =
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
ECHO = echo -e -n
endif
endif
all: build $(GAME)
build:
@ $(ECHO) "Creating build folder...\n"
@ $(MKDIR) build
$(GAME): $(OBJ)
@ $(ECHO) "Linking everything...\n"
@ $(CC) $(MAIN) $^ -o $(GAME) $(LDFLAGS)
@ $(ECHO) "Executable created: $@\n"
./build/%.o: ./src/%.cpp ./include/%.h
@ $(ECHO) "Compiling $< in $@...\n"
@ $(CC) $(CXXFLAGS) $(INCLUDE) $< -c -o $@
@ $(ECHO) "Compiled $@\n"
./build/tinyxmlerror.o: ./src/tinyxmlerror.cpp ./include/tinyxml.h
@ $(ECHO) "Compiling $< in $@...\n"
@ $(CC) $(CXXFLAGS) $(INCLUDE) $< -c -o $@
@ $(ECHO) "Compiled $@\n"
./build/tinyxmlparser.o: ./src/tinyxmlparser.cpp ./include/tinyxml.h
@ $(ECHO) "Compiling $< in $@...\n"
@ $(CC) $(CXXFLAGS) $(INCLUDE) $< -c -o $@
@ $(ECHO) "Compiled $@\n"
clean:
@ $(ECHO) "Cleaning workspace...\n"
@ $(RM) build/ $(GAME)
@ $(ECHO) "Workspace clean\n"
.PHONY: all clean