-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
179 lines (126 loc) · 4.85 KB
/
Makefile
File metadata and controls
179 lines (126 loc) · 4.85 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
####### Platform specifics
PLATFORM_OS := $(shell uname)
PLATFORM_ARCH := $(shell getconf LONG_BIT)
####### Compiler, tools and options
DEL_FILE = rm -f
CHKDIR = test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_DIR = cp -f -R
DEL_DIR = rmdir
MOVE = mv -f
STRIP = strip
####### Flags
CC = gcc-4.8
GXX = g++-4.8
CFLAGS = -pipe -Wall -Wextra -pedantic -fmessage-length=0 -std=c99 $(DEFINES) -fstack-protector-all
CXXFLAGS = -pipe -Wall -Wextra -pedantic -fmessage-length=0 -std=c++11 $(DEFINES) -fstack-protector-all
DEFINES = -D_BSD_SOURCE -D_GNU_SOURCE
####### Files, Folders and Paths to app
DIR_OBJ = build
DIR_SRC = src
APP_NAME = Duck Tales
APP_FILE = app
APP_EXEC = ducktales
DIR_APP = src/App
SRC_APP = $(wildcard $(DIR_SRC)/*/*.cpp)
INC_APP = $(wildcard $(DIR_SRC)/*/*.h)
OBJ_APP = $(addsuffix .o, $(basename $(subst $(DIR_APP)/, $(DIR_OBJ)/$(DIR_APP)/, $(SRC_APP))))
####### Files, Folders and Paths to keygen
KGN_NAME = Key Gen
KGN_FILE = keygen
KGN_EXEC = keygen
DIR_KGN = src/Keygen
SRC_KGN = $(wildcard $(DIR_SRC)/*/*.cpp)
INC_KGN = $(wildcard $(DIR_SRC)/*/*.h)
OBJ_KGN = $(addsuffix .o, $(basename $(subst $(DIR_KGN)/, $(DIR_OBJ)/$(DIR_KGN)/, $(SRC_KGN))))
####### Includes and Libraries
ifeq ($(PLATFORM_ARCH), 32)
INCS = -Ilib/TinyEngine/include -Isrc -Isrc/FrameWork -I./src/SceneGame -I/usr/include/freetype2 -I/usr/include/GL -I/usr/include/SDL -fabi-version=2 -fno-omit-frame-pointer -I/usr/include/mysql
LIBS = -L/usr/lib -L/usr/lib/i386-linux-gnu -lcrypto -lssl -lblkid -lSDL -lSDL_gfx -lSDL_image -lSDL_mixer -lSDL_net -lSDL_ttf -lX11 -lXrandr -lmysqlclient -lsqlite3 -lpthread -lz -m32
else ifeq ($(PLATFORM_ARCH), 64)
INCS = -Ilib/TinyEngine/include -Isrc -Isrc/FrameWork -I./src/SceneGame -I/usr/include/freetype2 -I/usr/include/GL -I/usr/include/SDL -fabi-version=2 -fno-omit-frame-pointer -I/usr/include/mysql
LIBS = -L/usr/lib/ -L/usr/lib/x86_64-linux-gnu/ -lcrypto -lssl -lblkid -lSDL -lSDL_gfx -lSDL_image -lSDL_mixer -lSDL_net -lSDL_ttf -lX11 -lXrandr -lmysqlclient -lsqlite3 -lpthread -lz -m64
endif
####### Build rules
.PHONY: all light hard app gdb upload download
.SECONDARY: build-pre build-post build-debug build-app build-game build-key build-keygen all exec-pre exec-post exec-gdb exec-run run gdb git-pre git-post git-upload git-download upload download
####### Compiling all
all: build-debug
light: build-light
hard: build-hard
print:
@echo $(OBJ_APP)
####### Compiling objects
build-game: build-pre $(DIR_OBJ)/$(APP_FILE)
build-keygen: build-pre $(DIR_OBJ)/$(KGN_FILE)
$(DIR_OBJ)/$(APP_FILE): $(OBJ_APP)
@$(GXX) $(CXXFLAGS) $(DIR_APP).cpp -o $(DIR_OBJ)/$(APP_EXEC) $(DEFINES) $(OBJ_APP) $(INCS) $(LIBS)
$(DIR_OBJ)/$(KGN_FILE): $(OBJ_KGN)
@$(GXX) $(CXXFLAGS) $(DIR_KGN).cpp -o $(DIR_OBJ)/$(KGN_EXEC) $(DEFINES) $(OBJ_KGN) $(INCS) $(LIBS)
####### Compiling apps
build-app: build-pre $(OBJ_APP)
build-key: build-pre $(OBJ_KGN)
$(DIR_OBJ)/$(DIR_APP)/%.o: $(DIR_APP)/%.cpp $(DIR_APP)/%.h
@$(CHKDIR) $(DIR_OBJ) | $(MKDIR) $(DIR_OBJ)
@$(CHKDIR) $(dir $@) | $(MKDIR) $(dir $@)
@$(GXX) $(CXXFLAGS) -c $< -o $@ $(DEFINES) $(INCS) $(LIBS)
@echo Done $< in $@
$(DIR_OBJ)/$(DIR_KGN)/%.o: $(DIR_KGN)/%.cpp $(DIR_KGN)/%.h
@$(CHKDIR) $(DIR_OBJ) | $(MKDIR) $(DIR_OBJ)
@$(CHKDIR) $(dir $@) | $(MKDIR) $(dir $@)
@$(GXX) $(CXXFLAGS) -c $< -o $@ $(DEFINES) $(INCS) $(LIBS)
@echo Done $< in $@
####### Build
build-pre:
@echo Building ...
build-post:
@echo Done.
build-light: CFLAGS += -g0
build-light: DEFINES += -DLIGHT
build-light: build-app build-key build-game build-keygen
@$(MAKE) --no-print-directory build-post
build-hard: CFLAGS += -g0
build-hard: DEFINES += -DHARD
build-hard: build-app build-key build-game build-keygen
@$(MAKE) --no-print-directory build-post
build-debug: DEFINES += -DDEBUG -DLIGHT
build-debug: CFLAGS += -O0 -g3 -g -ggdb -O0 -Wall -W
build-debug: CXXFLAGS += -O0 -g3 -g -ggdb -O0 -Wall -W
build-debug: build-app build-key build-game build-keygen
@$(MAKE) --no-print-directory build-post
####### Clearing
clean-pre:
@echo Cleaning ...
clean-post:
@echo Cleaned.
clean-key:
@$(DEL_FILE) $(DIR_OBJ)/$(DIR_KGN)/*/*
clean-app:
@$(DEL_FILE) $(DIR_OBJ)/$(APP_FILE)/*/*
@$(DEL_FILE) $(DIR_OBJ)/$(APP_EXEC)
clean: clean-pre clean-key clean-app clean-post
####### Execute
exec-pre:
@echo Running ...
exec-post:
@echo Done.
exec-dbg:
@gdb ./$(DIR_OBJ)/$(APP_EXEC)
exec-run:
./$(DIR_OBJ)/$(APP_EXEC)
run: exec-pre exec-run exec-post
dbg: exec-pre exec-dbg exec-post
####### Update and Download
git-pre:
@echo GitHub ...
git-post:
@echo Done.
git-upload:
@git add conf src resources Makefile INFO INSTALL; git commit -m "Compile and update autmatic"; git push origin master;
git-download:
@git pull --recurse-submodules
@git submodule update --remote --recursive
@git submodule foreach git pull origin master
upload: git-pre git-upload git-post
download: git-pre git-download git-post