-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_definitions
276 lines (231 loc) · 7.45 KB
/
make_definitions
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
### Project ###
PNAME = myabcs
PNAME_T = MyABCs
VER_MAJ = 0
VER_MIN = 4
VER_REL = 7
VERSION = $(VER_MAJ).$(VER_MIN).$(VER_REL)
# comment-out for release
VER_DEV = 1
ifdef REL_SUFFIX
REL_NAME = "$(PNAME)-$(VERSION)-$(REL_SUFFIX)"
else
REL_NAME = "$(PNAME)-$(VERSION)"
endif
### Help ###
t_bold = $(shell tput bold)
t_normal = $(shell tput sgr0)
t_green = $(shell tput setaf 2)
t_hilight = $(t_bold)$(t_green)
HELP_STRING = "\n\
Building $(PNAME_T) $(VERSION):\n\
\n\
Requirements:\n\
\tGNU Make\tBSD Make was previously supported but may no\n\t\t\tlonger work.\n\
\twxWidgets 3.x\thttps://wxwidgets.org/\n\
\twxSVG\t\thttp://wxsvg.sourceforge.net/\n\
\tSDL2\t\thttps://libsdl.org/\n\
\tPThreads\tLinux: Check your package manager for a library\n\t\t\timplementation.\n\t\t\tWindows: If your compiler does not have an\n\t\t\timplementation you can download Pthreads-w32\n\t\t\t( http://sourceware.org/pthreads-win32/ ).\n\
\n\
Make targets:\n\
\thelp\t\tShow this help information.\n\
\tall (default)\tCompile & link executable.\n\
\tinstall\t\tInstall or stage files for release.\n\
\tstage\t\tSame as $(t_hilight)install$(t_normal).\n\
\tuninstall\tRemove files from system or stage directory.\n\
\tpack\t\tZip contents of stage directory into archive\n\t\t\tfor release.\n\
\tbuild-libs\tCompile bundled libraries.\n\
\n\
Environment variables:\n\
\tSTATIC\t\tDefine to create static build (note: SDL\n\t\t\tlibraries are still linked dynamically).\n\
\tWXVERSION\tUse a version of wxWidgets other than the default.\n\
\tEXTRA_LIBS\tUse this variable to manually link to libraries\n\t\t\t(example: EXTRA_LIBS=\"-lpng -lz\"). This should only\n\t\t\tbe used if linker errors are encountered.\n\
\tREL_SUFFIX\tAppends text to filename of release archive when\n\t\t\t$(t_hilight)make pack$(t_normal) is called.\n\
\tBUILD_LIBS\tOnly build specified bundled libs with $(t_hilight)build-libs$(t_normal) target.\n\
\tUSE_BUNDLED\tSet to non-zero to link to bundled libs. Only works if\n\
\t\t\tlibraries previously built with $(t_hilight)build-libs$(t_normal) target called.\n\
\tWXCONFIG\tUse a custom $(t_hilight)wx-config$(t_normal)\n\
\tSDLCONFIG\tUse a custom $(t_hilight)sdl2-config$(t_normal)\n\
\tAFORMAT=format\tConvert audio to $(t_hilight)format$(t_normal) in $(t_hilight)pack/install$(t_normal) target (requires\n\
\t\t\t$(t_hilight)ffmpeg$(t_normal)). Leave this value unset to install lossless .flac audio files.\n\
\t\t\tSupported formats:\n\
\t\t\t - vorbis / ogg / oga\n\
\t\t\t - mp3"
### Environment ###
OS_WIN = false
EXE_EXT =
ifeq ($(OS), Windows_NT)
OS_WIN = true
EXE_EXT = .exe
STAGEDIR = build/stage
ifndef DESTDIR
DESTDIR = $(STAGEDIR)
endif
ifeq ($(shell echo $${OSTYPE}), msys)
# HACK!
ifeq ($(MSYSTEM), MINGW64)
BUILD_STRING = win32-x86_64
else
BUILD_STRING = win32-i686
endif
else
BUILD_STRING = $(shell echo "win32-$$(uname -m)")
endif
else
PREFIX := /usr/local
DATADIR = $(PREFIX)/share
BUILD_STRING = $(shell echo "$$(uname -s | tr A-Z a-z)-$$(uname -m)")
endif
LIB_PREFIX = libraries/libprefix-$(BUILD_STRING)
BINDIR = $(DESTDIR)/bin
INCLDIR = $(DESTDIR)/include
LIBDIR = $(DESTDIR)/lib
### Compiling & Linking ###
CPPFLAGS += -Iinclude
ifdef USE_BUNDLED
ifneq ("$(USE_BUNDLED)", "0")
CPPFLAGS += -I$(LIB_PREFIX)/include
LDFLAGS += -L$(LIB_PREFIX)/lib
ifndef WXCONFIG
WXCONFIG = $(LIB_PREFIX)/bin/wx-config
endif
ifndef SDLCONFIG
SDLCONFIG = $(LIB_PREFIX)/bin/sdl2-config
endif
endif
export PATH := $(LIB_PREFIX)/bin:$(shell printenv PATH)
endif
ifndef WXCONFIG
WXCONFIG = wx-config
endif
ifndef SDLCONFIG
SDLCONFIG = sdl2-config
endif
CC = g++
CFLAGS = -c -std=c++11
CXXFLAGS = $(CFLAGS)
OBJ_SUF = .o
LINKEROPTS = -Wl,--strip-all
### Toolkits ###
WXFLAGS = $(WXCONFIG) --cxxflags
SVGFLAGS = pkg-config libwxsvg --cflags
SDLFLAGS = $(SDLCONFIG) --cflags
MIXFLAGS = pkg-config SDL2_mixer --cflags
ifdef STATIC
WXLIBS = $(WXCONFIG) --libs std,richtext --static
SVGLIBS = pkg-config libwxsvg --libs --static
SDLLIBS = $(SDLCONFIG) --libs --static
MIXLIBS = pkg-config SDL2_mixer --libs --static
LINKEROPTS += -static-libgcc -static-libstdc++
else
WXLIBS = $(WXCONFIG) --libs std,richtext
SVGLIBS = pkg-config libwxsvg --libs
SDLLIBS = $(SDLCONFIG) --libs
MIXLIBS = pkg-config SDL2_mixer --libs
endif
ifdef WXVERSION
WXFLAGS += --version=$(WXVERSION)
WXLIBS += --version=$(WXVERSION)
endif
#ifeq ($(OS_WIN), true)
# LINKEROPTS += -static-libgcc -static-libstdc++
#endif
# Debugging
ifdef DEBUG
CXXFLAGS += -O0 -g -Wall -DDEBUG
WXFLAGS += --debug=yes
WXLIBS += --debug=yes | sed -e 's|--subsystem,windows|--subsystem,console|'
LINKEROPTS += -v
endif
WXFLAGS := `$(shell echo $(WXFLAGS))` `$(SVGFLAGS)`
SDLFLAGS := `$(shell echo $(SDLFLAGS))` `$(MIXERFLAGS)`
LIBS = `$(WXLIBS)` `$(SVGLIBS)` `$(SDLLIBS)` `$(MIXLIBS)` -lpthread
ifdef EXTRA_LIBS
LIBS += $(EXTRA_LIBS)
endif
### Installation ###
EXE = $(PNAME)$(EXE_EXT)
ABCDIR = $(PREFIX)/share/myabcs
PIXMAPDIR = $(PREFIX)/share/pixmaps
# not sure why quotes need to be escaped here
DEFINES = \
-DPIXMAPDIR=\"$(PIXMAPDIR)\" \
-DABCDIR=\"$(ABCDIR)\" \
-DVERSION=\"$(VERSION)\" \
-DWXSVG_VERSION=\"`pkg-config libwxsvg --modversion`\"
ifdef VER_DEV
DEFINES += -DVER_DEV=\"$(VER_DEV)\"
endif
CXXFLAGS += $(DEFINES)
### Files & headers ###
FAILSAFE_IMG = include/res/failsafe_img.h
FONT_MAIN = include/res/sniglet_ttf.h
FONT_MONO = include/res/pixeloperatormono_ttf.h
WINRESOURCES_O = win_resources.o
ID_H = include/id.h
ID_C = src/id.cpp
ID_O = id.o
ID_D = $(ID_H)
EVENT_H = include/event.h
EVENT_C = src/event.cpp
EVENT_O = event.o
EVENT_D = $(EVENT_H)
LOG_H = include/log.h
LOG_C = src/log.cpp
LOG_O = log.o
LOG_D = $(LOG_H)
PATHS = paths
PATHS_H = include/$(PATHS).h
PATHS_C = src/$(PATHS).cpp
PATHS_O = $(PATHS).o
PATHS_D = $(PATHS_H) $(LOG_H)
FONTS = fonts
FONTS_H = include/$(FONTS).h
FONTS_C = src/$(FONTS).cpp
FONTS_O = $(FONTS).o
FONTS_D = $(FONTS_H) $(FONT_MAIN) $(FONT_MONO)
SOUND_H = include/sound.h
SOUND_C = src/sound.cpp
SOUND_O = sound.o
SOUND_D = $(SOUND_H) $(LOG_H) $(EVENT_H)
RESOBJ= resourceobject
RESOBJ_H = include/$(RESOBJ).h
RESOBJ_C = src/$(RESOBJ).cpp
RESOBJ_O = $(RESOBJ).o
RESOBJ_D = $(RESOBJ_H) $(LOG_H) $(FAILSAFE_IMG) $(SOUND_H) $(PATHS_H)
RESLIST = resourcelist
RESLIST_H = include/$(RESLIST).h
RESLIST_C = src/$(RESLIST).cpp
RESLIST_O = $(RESLIST).o
RESLIST_D = $(RESLIST_H) $(RESOBJ_H) $(LOG_H)
CATEGORY = category
CATEGORY_H = include/$(CATEGORY).h
CATEGORY_C = src/$(CATEGORY).cpp
CATEGORY_O = $(CATEGORY).o
CATEGORY_D = $(CATEGORY_H) $(RESLIST_H) $(RESOBJ_H) $(ID_H)
CREDPANEL = creditspanel
CREDPANEL_H = include/$(CREDPANEL).h
CREDPANEL_C = src/$(CREDPANEL).cpp
CREDPANEL_O = $(CREDPANEL).o
CREDPANEL_D = $(CREDPANEL_H)
GNRCABT_H = include/gnrcabt.h
GNRCABT_C = src/gnrcabt.cpp
GNRCABT_O = gnrcabt.o
GNRCABT_D = $(GNRCABT_H) $(ID_H) $(FONTS_H) $(LOG_H) $(CREDPANEL_H) $(RESOBJ_H) $(PATHS_H) \
include/res/logo.h include/res/logo_sdl.h include/res/logo_wx.h include/res/logo_wxsvg.h
ABC_H = include/abc.h
ABC_C = src/abc.cpp
ABC_O = abc.o
ABC_D = $(ABC_H) $(PATHS_H) $(ID_H) $(LOG_H) $(GNRCABT_H) $(SOUND_H) $(RESOBJ_H) $(RESLIST_H) $(CATEGORY_H) $(EVENT_H) $(FONTS_H) \
include/res/ani_loading.h
MAIN_H = include/main.h
MAIN_C = src/main.cpp
MAIN_O = main.o
MAIN_D = $(MAIN_H) $(LOG_H) $(SOUND_H) $(ABC_H) $(FONTS_H) $(ID_H)
OBJECTS = \
$(LOG_O) $(FONTS_O) $(RESOBJ_O) $(RESLIST_O) $(CATEGORY_O) $(CREDPANEL_O) $(GNRCABT_O) $(SOUND_O) $(PATHS_O) $(EVENT_O) $(ID_O) $(ABC_O) $(MAIN_O)
ifeq ($(OS), Windows_NT)
OBJECTS += $(WINRESOURCES_O)
endif
F_DATA = \
changelog.txt license-MIT.txt myabcs.png