-
-
Notifications
You must be signed in to change notification settings - Fork 76
/
Makefile
343 lines (252 loc) · 11.8 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
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# Makefile for fre:ac
include $(dir $(firstword $(MAKEFILE_LIST)))/Makefile-options
INCLUDE = "$(SRCDIR)"/include
OBJECTS = objects
RESOURCES = resources
SRC = src
DLLOBJECTS = $(OBJECTS)/cddb.o $(OBJECTS)/cddbbatch.o $(OBJECTS)/cddbcache.o $(OBJECTS)/cddbinfo.o $(OBJECTS)/cddblocal.o $(OBJECTS)/cddbremote.o
DLLOBJECTS += $(OBJECTS)/cddb_extsettings.o $(OBJECTS)/cddb_manage.o $(OBJECTS)/cddb_managequeries.o $(OBJECTS)/cddb_managesubmits.o $(OBJECTS)/cddb_multimatch.o $(OBJECTS)/cddb_query.o $(OBJECTS)/cddb_submit.o
DLLOBJECTS += $(OBJECTS)/dialog_config.o $(OBJECTS)/config_albumart.o $(OBJECTS)/config_cddb.o $(OBJECTS)/config_cuesheets.o $(OBJECTS)/config_dsp.o $(OBJECTS)/config_encoders.o $(OBJECTS)/config_files.o $(OBJECTS)/config_interface.o $(OBJECTS)/config_language.o $(OBJECTS)/config_playlists.o $(OBJECTS)/config_resources.o $(OBJECTS)/config_tagfields.o $(OBJECTS)/config_tagformats.o $(OBJECTS)/config_verification.o $(OBJECTS)/configcomponent.o $(OBJECTS)/configentry.o
DLLOBJECTS += $(OBJECTS)/adddirectory.o $(OBJECTS)/addpattern.o $(OBJECTS)/charset.o $(OBJECTS)/error.o $(OBJECTS)/format.o $(OBJECTS)/overwrite.o $(OBJECTS)/splitter.o
DLLOBJECTS += $(OBJECTS)/engine_component.o $(OBJECTS)/engine_converter.o $(OBJECTS)/engine_decoder.o $(OBJECTS)/engine_encoder.o $(OBJECTS)/engine_locking.o $(OBJECTS)/engine_processor.o $(OBJECTS)/engine_verifier.o $(OBJECTS)/engine_worker.o $(OBJECTS)/engine_worker_singlefile.o
DLLOBJECTS += $(OBJECTS)/edit_folder.o $(OBJECTS)/layer_tooltip.o $(OBJECTS)/main_joblist.o $(OBJECTS)/main_threads.o $(OBJECTS)/playback.o
DLLOBJECTS += $(OBJECTS)/job_convert.o $(OBJECTS)/job_addfiles.o $(OBJECTS)/job_addfolders.o $(OBJECTS)/job_addtracks.o $(OBJECTS)/job_removeall.o $(OBJECTS)/job_removedisc.o $(OBJECTS)/job_checkforupdates.o $(OBJECTS)/job.o $(OBJECTS)/jobmanager.o
DLLOBJECTS += $(OBJECTS)/config.o $(OBJECTS)/dllinterfaces.o $(OBJECTS)/freac.o $(OBJECTS)/joblist.o $(OBJECTS)/player.o $(OBJECTS)/progress.o $(OBJECTS)/startconsole.o $(OBJECTS)/startgui.o $(OBJECTS)/utilities.o
ifeq ($(BUILD_WIN32),True)
DLLOBJECTS += $(OBJECTS)/autorelease_none.o
DLLOBJECTS += $(OBJECTS)/notification_win32.o
else ifeq ($(BUILD_LINUX),True)
DLLOBJECTS += $(OBJECTS)/autorelease_none.o
DLLOBJECTS += $(OBJECTS)/notification_udev.o
else ifeq ($(BUILD_OSX),True)
DLLOBJECTS += $(OBJECTS)/autorelease_osx.o
DLLOBJECTS += $(OBJECTS)/notification_osx.o
else
DLLOBJECTS += $(OBJECTS)/autorelease_none.o
DLLOBJECTS += $(OBJECTS)/notification_none.o
endif
ifeq ($(BUILD_WIN32),True)
ifeq ($(BUILD_VIDEO_DOWNLOADER),True)
RESOBJECTS = $(OBJECTS)/resources_vd.o
else
RESOBJECTS = $(OBJECTS)/resources.o
endif
endif
ifeq ($(BUILD_HAIKU),True)
RESFILES = $(RESOURCES)/resources.rsrc
endif
EXEOBJECTS = $(OBJECTS)/gui.o
CMDOBJECTS = $(OBJECTS)/console.o
EXENAME = $(BINDIR)/freac$(EXECUTABLE)
CMDNAME = $(BINDIR)/freaccmd$(EXECUTABLE)
DLLNAME = $(BINDIR)/freac$(SHARED)
LIBNAME = $(OBJECTS)/libfreac.a
CCOPTS = -I$(INCLUDE) -fvisibility=hidden -c
LDOPTS =
REMOVER = rm
REMOVER_OPTS = -f
ifeq ($(BUILD_VIDEO_DOWNLOADER),True)
CCOPTS += -D BUILD_VIDEO_DOWNLOADER
endif
ifeq ($(BUILD_WIN32),True)
CCOPTS += -I"$(CDK_INSTALL_PATH)"/include
LDOPTS += -L"$(CDK_INSTALL_PATH)"/$(LIBDIR) -lsmooth -Wl,--dynamicbase,--nxcompat
LDOPTS_DLL += --shared -lboca -lws2_32 -Wl,--out-implib,$(LIBNAME)
LDOPTS_GUI += -mwindows
RESCOMP = windres
RESCOMP_OPTS = -O coff
ifeq ($(BUILD_X86),True)
RESCOMP_OPTS += --target=pe-i386
else ifeq ($(BUILD_X86_64),True)
RESCOMP_OPTS += --target=pe-x86-64
else ifeq ($(BUILD_ARM64),True)
RESCOMP = aarch64-w64-mingw32-windres
endif
else
CCOPTS += -fPIC
ifneq ($(BUILD_SOLARIS),True)
ifneq ($(BUILD_HAIKU),True)
CCOPTS += -pthread
ifneq ($(BUILD_OSX),True)
ifeq ($(BUILD_NETBSD),True)
CCOPTS += -I/usr/pkg/include
else
CCOPTS += -I/usr/local/include
endif
endif
endif
endif
LDOPTS += -L$(prefix)/lib -lsmooth-$(SMOOTHVER)
LDOPTS_DLL += -lboca-$(BOCAVER)
ifeq ($(BUILD_OSX),True)
LDOPTS_DLL += -dynamiclib -framework Cocoa -framework IOKit -Wl,-dylib_install_name,freac$(SHARED) -Wl,-headerpad,80
else
LDOPTS_DLL += --shared
endif
ifeq ($(BUILD_OPENBSD),True)
LDOPTS_GUI += -L/usr/X11R6/lib -L/usr/local/lib -logg -lvorbis -lvorbisfile
LDOPTS_CMD += -L/usr/X11R6/lib -L/usr/local/lib -logg -lvorbis -lvorbisfile
endif
ifeq ($(BUILD_HAIKU),True)
RESCOMP = rc
RESLINKER = xres
endif
endif
.PHONY: all codesign folders resources install uninstall clean clean_resources
all: folders $(DLLOBJECTS) $(EXEOBJECTS) $(CMDOBJECTS) $(RESOBJECTS) $(RESFILES) $(DLLNAME) $(EXENAME) $(CMDNAME) resources
+ $(call makein,components)
codesign: all
signtool sign -fd sha1 -tr http://timestamp.digicert.com -td sha1 $(BINDIR)/freac$(EXECUTABLE) $(BINDIR)/freaccmd$(EXECUTABLE) $(BINDIR)/freac$(SHARED) $(BINDIR)/boca/freac_*$(SHARED)
signtool sign -fd sha256 -tr http://timestamp.digicert.com -td sha256 -as $(BINDIR)/freac$(EXECUTABLE) $(BINDIR)/freaccmd$(EXECUTABLE) $(BINDIR)/freac$(SHARED) $(BINDIR)/boca/freac_*$(SHARED)
folders:
mkdir -p $(BINDIR) $(OBJECTS)
resources: folders
ifeq ($(BUILD_WIN32),True)
mkdir -p $(BINDIR)/icons
mkdir -p $(BINDIR)/lang
mkdir -p packaging/windows/lang
cp "$(SRCDIR)"/icons/freac.png $(BINDIR)/icons
cp -r "$(SRCDIR)"/icons/conversion $(BINDIR)/icons
cp -r "$(SRCDIR)"/icons/freedb $(BINDIR)/icons
cp -r "$(SRCDIR)"/icons/joblist $(BINDIR)/icons
cp -r "$(SRCDIR)"/icons/other $(BINDIR)/icons
cp -r "$(SRCDIR)"/icons/player $(BINDIR)/icons
cp -r "$(SRCDIR)"/icons/select $(BINDIR)/icons
cp -r "$(SRCDIR)"/icons/settings $(BINDIR)/icons
cp -r "$(SRCDIR)"/icons/tools $(BINDIR)/icons
cp "$(SRCDIR)"/i18n/Readme.lang $(BINDIR)/lang
cp "$(SRCDIR)"/i18n/freac/freac*.xml $(BINDIR)/lang
cp "$(SRCDIR)"/i18n/tips/tips*.xml $(BINDIR)/lang
cp "$(SRCDIR)"/i18n/updater/eupdate*.xml $(BINDIR)/lang
cp "$(SRCDIR)"/i18n/setup/setup*.xml packaging/windows/lang
cp -r "$(SRCDIR)"/manual $(BINDIR)
endif
install: folders $(DLLOBJECTS) $(EXEOBJECTS) $(CMDOBJECTS) $(RESOBJECTS) $(DLLNAME) $(EXENAME) $(CMDNAME)
ifneq ($(BUILD_WIN32),True)
$(INSTALL) -d "$(DESTDIR)"$(bindir)
$(INSTALL_PROGRAM) $(EXENAME) "$(DESTDIR)"$(bindir)
$(INSTALL_PROGRAM) $(CMDNAME) "$(DESTDIR)"$(bindir)
$(INSTALL) -d "$(DESTDIR)"$(libdir)/freac
$(INSTALL_DATA) $(DLLNAME) "$(DESTDIR)"$(libdir)/freac
$(INSTALL) -d "$(DESTDIR)"$(datadir)/freac
$(INSTALL) -d "$(DESTDIR)"$(datadir)/freac/icons
$(INSTALL) -d "$(DESTDIR)"$(datadir)/freac/lang
cp "$(SRCDIR)"/i18n/Readme.lang "$(DESTDIR)"$(datadir)/freac/lang
cp "$(SRCDIR)"/i18n/freac/freac*.xml "$(DESTDIR)"$(datadir)/freac/lang
cp "$(SRCDIR)"/i18n/tips/tips*.xml "$(DESTDIR)"$(datadir)/freac/lang
chmod -R a=rX,u=rwX "$(DESTDIR)"$(datadir)/freac/lang
$(INSTALL_DATA) "$(SRCDIR)"/icons/freac.png "$(DESTDIR)"$(datadir)/freac/icons
cp -r "$(SRCDIR)"/icons/conversion "$(DESTDIR)"$(datadir)/freac/icons
chmod -R a=rX,u=rwX "$(DESTDIR)"$(datadir)/freac/icons/conversion
cp -r "$(SRCDIR)"/icons/freedb "$(DESTDIR)"$(datadir)/freac/icons
chmod -R a=rX,u=rwX "$(DESTDIR)"$(datadir)/freac/icons/freedb
cp -r "$(SRCDIR)"/icons/joblist "$(DESTDIR)"$(datadir)/freac/icons
chmod -R a=rX,u=rwX "$(DESTDIR)"$(datadir)/freac/icons/joblist
cp -r "$(SRCDIR)"/icons/other "$(DESTDIR)"$(datadir)/freac/icons
chmod -R a=rX,u=rwX "$(DESTDIR)"$(datadir)/freac/icons/other
cp -r "$(SRCDIR)"/icons/player "$(DESTDIR)"$(datadir)/freac/icons
chmod -R a=rX,u=rwX "$(DESTDIR)"$(datadir)/freac/icons/player
cp -r "$(SRCDIR)"/icons/select "$(DESTDIR)"$(datadir)/freac/icons
chmod -R a=rX,u=rwX "$(DESTDIR)"$(datadir)/freac/icons/select
cp -r "$(SRCDIR)"/icons/settings "$(DESTDIR)"$(datadir)/freac/icons
chmod -R a=rX,u=rwX "$(DESTDIR)"$(datadir)/freac/icons/settings
cp -r "$(SRCDIR)"/icons/tools "$(DESTDIR)"$(datadir)/freac/icons
chmod -R a=rX,u=rwX "$(DESTDIR)"$(datadir)/freac/icons/tools
$(INSTALL) -d "$(DESTDIR)"$(datadir)/doc/freac
$(INSTALL_DATA) "$(SRCDIR)"/Readme* "$(DESTDIR)"$(datadir)/doc/freac
cp -r "$(SRCDIR)"/manual "$(DESTDIR)"$(datadir)/doc/freac
chmod -R a=rX,u=rwX "$(DESTDIR)"$(datadir)/doc/freac/manual
ifneq ($(BUILD_OSX),True)
ifneq ($(BUILD_HAIKU),True)
$(INSTALL) -d "$(DESTDIR)"$(datadir)/applications/
$(INSTALL) -d "$(DESTDIR)"$(datadir)/metainfo/
$(INSTALL_DATA) "$(SRCDIR)"/metadata/org.freac.freac.desktop "$(DESTDIR)"$(datadir)/applications
$(INSTALL_DATA) "$(SRCDIR)"/metadata/org.freac.freac.appdata.xml "$(DESTDIR)"$(datadir)/metainfo
$(INSTALL) -d "$(DESTDIR)"$(datadir)/icons/hicolor/64x64/apps/
$(INSTALL) -d "$(DESTDIR)"$(datadir)/icons/hicolor/128x128/apps/
$(INSTALL_DATA) "$(SRCDIR)"/icons/freac-64x64.png "$(DESTDIR)"$(datadir)/icons/hicolor/64x64/apps/org.freac.freac.png
$(INSTALL_DATA) "$(SRCDIR)"/icons/freac.png "$(DESTDIR)"$(datadir)/icons/hicolor/128x128/apps/org.freac.freac.png
endif
endif
$(call makein,components,install)
endif
uninstall:
ifneq ($(BUILD_WIN32),True)
rm -f "$(DESTDIR)"$(bindir)/freac
rm -f "$(DESTDIR)"$(bindir)/freaccmd
rm -f "$(DESTDIR)"$(libdir)/freac/freac$(SHARED)
rm -f -r "$(DESTDIR)"$(libdir)/freac
rm -f -r "$(DESTDIR)"$(datadir)/freac/icons
rm -f -r "$(DESTDIR)"$(datadir)/freac/lang
rm -f -r "$(DESTDIR)"$(datadir)/freac
rm -f "$(DESTDIR)"$(datadir)/doc/freac/Readme*
rm -f -r "$(DESTDIR)"$(datadir)/doc/freac/manual
rm -f -r "$(DESTDIR)"$(datadir)/doc/freac
ifneq ($(BUILD_OSX),True)
ifneq ($(BUILD_HAIKU),True)
rm -f "$(DESTDIR)"$(datadir)/applications/org.freac.freac.desktop
rm -f "$(DESTDIR)"$(datadir)/metainfo/org.freac.freac.appdata.xml
rm -f "$(DESTDIR)"$(datadir)/icons/hicolor/64x64/apps/org.freac.freac.png
rm -f "$(DESTDIR)"$(datadir)/icons/hicolor/128x128/apps/org.freac.freac.png
endif
endif
$(call makein,components,uninstall)
endif
clean: clean_resources
$(REMOVER) $(REMOVER_OPTS) $(DLLOBJECTS) $(EXEOBJECTS) $(CMDOBJECTS) $(RESOBJECTS) $(RESFILES) $(DLLNAME) $(EXENAME) $(CMDNAME) $(LIBNAME)
ifneq ("$(SRCDIR)","$(CURDIR)")
rmdir $(BINDIR) $(OBJECTS) 2> /dev/null || true
endif
+ $(call cleanin,components)
clean_resources:
ifeq ($(BUILD_WIN32),True)
rm -f -r $(BINDIR)/icons
rm -f -r $(BINDIR)/lang
rm -f -r $(BINDIR)/manual
endif
$(DLLNAME): $(DLLOBJECTS)
$(LD) $(DLLOBJECTS) $(LDOPTS) $(LDOPTS_DLL) $(LDFLAGS) -o $@
ifeq ($(findstring release,$(config)),release)
-countbuild BuildNumber
endif
$(EXENAME): $(EXEOBJECTS) $(RESOBJECTS) $(RESFILES)
$(LD) $(EXEOBJECTS) $(RESOBJECTS) $(LDOPTS) $(LDOPTS_GUI) $(LDFLAGS) -o $@
ifeq ($(BUILD_HAIKU),True)
$(RESLINKER) -o $@ $(RESFILES)
endif
$(CMDNAME): $(CMDOBJECTS) $(RESOBJECTS)
$(LD) $(CMDOBJECTS) $(RESOBJECTS) $(LDOPTS) $(LDOPTS_CMD) $(LDFLAGS) -o $@
$(OBJECTS)/%.o: $(SRC)/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/%.o: $(SRC)/cddb/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/%.o: $(SRC)/dialogs/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/cddb_%.o: $(SRC)/dialogs/cddb/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/dialog_%.o: $(SRC)/dialogs/config/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/%.o: $(SRC)/dialogs/config/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/engine_%.o: $(SRC)/engine/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/%.o: $(SRC)/gui/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/%.o: $(SRC)/jobs/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/job_%.o: $(SRC)/jobs/engine/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/job_%.o: $(SRC)/jobs/joblist/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/job_%.o: $(SRC)/jobs/other/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/%.o: $(SRC)/loader/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/%.o: $(SRC)/support/%.cpp
$(CXX) $(CCOPTS) $(CXXFLAGS) $< -o $@
$(OBJECTS)/%.o: $(SRC)/support/%.mm
$(OBJCXX) $(CCOPTS) $(OBJCXXFLAGS) $< -o $@
$(OBJECTS)/%.o: $(RESOURCES)/%.rc
$(RESCOMP) $(RESCOMP_OPTS) -o $@ $<
$(RESOURCES)/%.rsrc: $(RESOURCES)/%.rdef
$(RESCOMP) $(RESCOMP_OPTS) -o $@ $<