-
Notifications
You must be signed in to change notification settings - Fork 72
/
Makefile
2492 lines (2244 loc) · 123 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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# libopenmpt and openmpt123 GNU Makefile
#
# Authors: Joern Heusipp
# OpenMPT Devs
#
# The OpenMPT source code is released under the BSD license.
# Read LICENSE for more details.
#
#
# Supported parameters:
#
#
# Build configuration (provide on each `make` invocation):
#
# CONFIG=[gcc|clang|mingw-w64|emscripten|djgpp] (default: CONFIG=)
#
# Build configurations can override or change defaults of other build options.
# See below and in `build/make/` for details.
#
#
# Compiler options (environment variables):
#
# CC
# CXX
# LD
# AR
# CPPFLAGS
# CXXFLAGS
# CFLAGS
# LDFLAGS
# LDLIBS
# ARFLAGS
# PKG_CONFIG
#
# CXXSTDLIB_PCLIBSPRIVATE C++ standard library (or libraries) required for
# static linking. This will be put in the pkg-config file
# libopenmpt.pc Libs.private field and used for nothing else.
#
#
#
# Build flags (provide on each `make` invocation) (defaults are shown):
#
# DYNLINK=1 Dynamically link examples and openmpt123 against libopenmpt
# SHARED_LIB=1 Build shared library
# STATIC_LIB=1 Build static library
# EXAMPLES=1 Build examples
# OPENMPT123=1 Build openmpt123
# IN_OPENMPT=0 Build in_openmpt (WinAMP 2.x plugin)
# XMP_OPENMPT=0 Build xmp-openmpt (XMPlay plugin)
# SHARED_SONAME=1 Set SONAME of shared library
# DEBUG=0 Build debug binaries without optimization and with symbols
# OPTIMIZE=default vectorize
# vectorize -O3
# speed -O2
# size -Os
# extrasize -Oz
# some -O1
# test -Og
# debug -O0
# none
# OPTIMIZE_LTO=0 Build with link-time-optimizations
# OPTIMIZE_FASTMATH=0 Use no non-standard-compliant fastmath optimizations
# =1 + use mild non-standard-compliant fastmath optimizations
# =2 + assume no inf/nan
# =3 + set ftz/daz
# TEST=1 Include test suite in default target.
# ONLY_TEST=0 Only build the test suite.
# STRICT=0 Treat warnings as errors.
# MODERN=0 Pass more modern compiler options.
# ANCIENT=0 Pass compiler options compatible with older versions.
# NATIVE=0 Optimize for system CPU.
# STDCXX=c++17 C++ standard version (default depends on compiler)
# STDC=c17 C standard version (default depends on compiler)
# ANALYZE=0 Enable static analyzer.
# CHECKED=0 Enable run-time assertions.
# CHECKED_ADDRESS=0 Enable address sanitizer
# CHECKED_UNDEFINED=0 Enable undefined behaviour sanitizer
#
#
# Build flags for libopenmpt (provide on each `make` invocation)
# (defaults are 0):
#
# NO_ZLIB=1 Avoid using zlib, even if found
# NO_MPG123=1 Avoid using libmpg123, even if found
# NO_OGG=1 Avoid using libogg, even if found
# NO_VORBIS=1 Avoid using libvorbis, even if found
# NO_VORBISFILE=1 Avoid using libvorbisfile, even if found
#
# LOCAL_ZLIB=1 Build local copy of zlib, even if found
# LOCAL_MPG123=1 Build local copy of libmpg123, even if found
# LOCAL_OGG=1 Build local copy of libogg, even if found
# LOCAL_VORBIS=1 Build local copy of libvorbis, even if found
#
# NO_MINIZ=1 Do not fallback to miniz
# NO_MINIMP3=1 Do not fallback to minimp3
# NO_STBVORBIS=1 Do not fallback to stb_vorbis
#
# USE_ALLEGRO42=1 Use liballegro 4.2 (DJGPP only)
#
# Build flags for libopenmpt examples and openmpt123
# (provide on each `make` invocation)
# (defaults are 0):
#
# NO_PORTAUDIO=1 Avoid using PortAudio, even if found
# NO_PORTAUDIOCPP=1 Avoid using PortAudio C++, even if found
#
# Build flags for openmpt123 (provide on each `make` invocation)
# (defaults are 0):
#
# NO_PULSEAUDIO=1 Avoid using PulseAudio, even if found
# NO_SDL2=1 Avoid using SDL2, even if found
# NO_FLAC=1 Avoid using FLAC, even if found
# NO_SNDFILE=1 Avoid using libsndfile, even if found
#
#
# Install options (provide on each `make install` invocation)
#
# PREFIX (e.g.: PREFIX=$HOME/opt, default: PREFIX=/usr/local)
# DESTDIR (e.g.: DESTDIR=bin/dest, default: DESTDIR=)
#
#
# Verbosity:
#
# QUIET=[0,1] (default: QUIET=0)
# VERBOSE=[0,1,2] (default: VERBOSE=0)
#
#
# Supported targets:
#
# make clean
# make [all]
# make doc
# make check
# make dist
# make dist-doc
# make install
# make install-doc
#
.PHONY: all
all:
INFO = @echo
SILENT = @
VERYSILENT = @
define PRINT_TRACE
endef
define PRINT_DEBUG
endef
define PRINT_INFO
$(info $1)
endef
ifeq ($(VERBOSE),2)
INFO = @true
SILENT =
VERYSILENT =
define PRINT_TRACE
$(info $1)
endef
define PRINT_DEBUG
$(info $1)
endef
define PRINT_INFO
$(info $1)
endef
endif
ifeq ($(VERBOSE),1)
INFO = @true
SILENT =
VERYSILENT = @
define PRINT_TRACE
endef
define PRINT_DEBUG
$(info $1)
endef
define PRINT_INFO
$(info $1)
endef
endif
ifeq ($(QUIET),1)
INFO = @true
SILENT = @
VERYSILENT = @
define PRINT_TRACE
endef
define PRINT_DEBUG
endef
define PRINT_INFO
endef
endif
# general settings
DYNLINK=1
SHARED_LIB=1
STATIC_LIB=1
EXAMPLES=1
FUZZ=0
SHARED_SONAME=1
DEBUG=0
OPTIMIZE=default
OPTIMIZE_LTO=0
OPTIMIZE_FASTMATH=0
TEST=1
ONLY_TEST=0
SOSUFFIX=.so
SOSUFFIXWINDOWS=0
NO_SHARED_LINKER_FLAG=0
OPENMPT123=1
IN_OPENMPT=0
XMP_OPENMPT=0
MODERN=0
NATIVE=0
STRICT=0
FLAVOUR_DIR=
FORCE_UNIX_STYLE_COMMANDS=0
CHECKED=0
CHECKED_ADDRESS=0
CHECKED_UNDEFINED=0
REQUIRES_RUNPREFIX=0
# get commandline or defaults
CPPFLAGS := $(CPPFLAGS)
CXXFLAGS := $(CXXFLAGS)
CFLAGS := $(CFLAGS)
LDFLAGS := $(LDFLAGS)
LDLIBS := $(LDLIBS)
ARFLAGS := $(ARFLAGS)
PC_LIBS_PRIVATE := $(PC_LIBS_PRIVATE)
PREFIX := $(PREFIX)
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
MANDIR ?= $(PREFIX)/share/man
#DESTDIR := $(DESTDIR)
#ifeq ($(DESTDIR),)
#DESTDIR := bin/dest
#endif
# version
include libopenmpt/libopenmpt_version.mk
LIBOPENMPT_SO_VERSION=$(LIBOPENMPT_LTVER_CURRENT)
# host setup
ifneq ($(MSYSTEM)x,x)
HOST=unix
HOST_FLAVOUR=
TOOLCHAIN_SUFFIX=
CPPCHECK = cppcheck
MKDIR_P = mkdir -p
RM = rm -f
RMTREE = rm -rf
INSTALL = install
INSTALL_MAKE_DIR = install -d
INSTALL_DIR = cp -r -v
FIXPATH = $1
HOST_FLAVOUR=MSYS2
NUMTHREADS:=$(shell nproc)
else ifeq ($(OS),Windows_NT)
HOST=windows
HOST_FLAVOUR=
TOOLCHAIN_SUFFIX=
CPPCHECK = cppcheck
MKDIR_P = mkdir
RM = del /q /f
RMTREE = del /q /f /s
INSTALL = echo install
INSTALL_MAKE_DIR = echo install
INSTALL_DIR = echo install
FIXPATH = $(subst /,\,$1)
NUMTHREADS:=$(NUMBER_OF_PROCESSORS)
else
HOST=unix
HOST_FLAVOUR=
TOOLCHAIN_SUFFIX=
CPPCHECK = cppcheck
MKDIR_P = mkdir -p
RM = rm -f
RMTREE = rm -rf
INSTALL = install
INSTALL_MAKE_DIR = install -d
INSTALL_DIR = cp -r -v
FIXPATH = $1
UNAME_S:=$(shell uname -s)
ifeq ($(UNAME_S),Darwin)
HOST_FLAVOUR=MACOSX
endif
ifeq ($(UNAME_S),Linux)
HOST_FLAVOUR=LINUX
endif
ifeq ($(UNAME_S),NetBSD)
HOST_FLAVOUR=NETBSD
endif
ifeq ($(UNAME_S),FreeBSD)
HOST_FLAVOUR=FREEBSD
endif
ifeq ($(UNAME_S),OpenBSD)
HOST_FLAVOUR=OPENBSD
endif
ifeq ($(UNAME_S),Haiku)
HOST_FLAVOUR=HAIKU
endif
ifeq ($(HOST_FLAVOUR),LINUX)
NUMTHREADS:=$(shell nproc)
else
NUMTHREADS:=1
endif
endif
# early build setup
BINDIR_MADE:=$(shell $(MKDIR_P) bin)
# compiler setup
PKG_CONFIG ?= pkg-config
ifeq ($(CONFIG)x,x)
include build/make/config-defaults.mk
else ifeq ($(CONFIG),mingw64-win32)
$(warning warning: 'CONFIG=mingw64-win32' is deprecated. Use 'CONFIG=mingw-w64 WINDOWS_ARCH=x86' instead.)
WINDOWS_ARCH=x86
WINDOWS_FAMILY=
WINDOWS_VERSION=
include build/make/config-mingw-w64.mk
else ifeq ($(CONFIG),mingw64-win64)
$(warning warning: 'CONFIG=mingw64-win64' is deprecated. Use 'CONFIG=mingw-w64 WINDOWS_ARCH=amd64' instead.)
WINDOWS_ARCH=amd64
WINDOWS_FAMILY=
WINDOWS_VERSION=
include build/make/config-mingw-w64.mk
else ifeq ($(CONFIG),mingw64-winrt-x86)
$(warning warning: 'CONFIG=mingw64-winrt-x86' is deprecated. Use 'CONFIG=mingw-w64 WINDOWS_ARCH=x86 WINDOWS_FAMILY=pc-app WINDOWS_VERSION=win8' instead.)
WINDOWS_ARCH=x86
WINDOWS_FAMILY=pc-app
WINDOWS_VERSION=win8
include build/make/config-mingw-w64.mk
else ifeq ($(CONFIG),mingw64-winrt-amd64)
$(warning warning: 'CONFIG=mingw64-winrt-amd64' is deprecated. Use 'CONFIG=mingw-w64 WINDOWS_ARCH=amd64 WINDOWS_FAMILY=pc-app WINDOWS_VERSION=win8' instead.)
WINDOWS_ARCH=amd64
WINDOWS_FAMILY=pc-app
WINDOWS_VERSION=win8
include build/make/config-mingw-w64.mk
else
include build/make/config-$(CONFIG).mk
endif
ifeq ($(FORCE_UNIX_STYLE_COMMANDS),1)
MKDIR_P = mkdir -p
RM = rm -f
RMTREE = rm -rf
endif
# build setup
ifeq ($(SOSUFFIXWINDOWS),1)
LIBOPENMPT_SONAME=libopenmpt-$(LIBOPENMPT_SO_VERSION)$(SOSUFFIX)
else
LIBOPENMPT_SONAME=libopenmpt$(SOSUFFIX).$(LIBOPENMPT_SO_VERSION)
endif
INSTALL_PROGRAM = $(INSTALL) -m 0755
INSTALL_DATA = $(INSTALL) -m 0644
INSTALL_LIB = $(INSTALL) -m 0644
INSTALL_DATA_DIR = $(INSTALL_DIR)
INSTALL_MAKE_DIR += -m 0755
CPPFLAGS += -Isrc -Icommon -I.
ifeq ($(XMP_OPENMPT),1)
CPPFLAGS += -Iinclude/pugixml/src
endif
ifeq ($(MPT_COMPILER_GENERIC),1)
CXXFLAGS +=
CFLAGS +=
LDFLAGS +=
LDLIBS +=
ARFLAGS +=
ifeq ($(DEBUG),1)
CPPFLAGS += -DMPT_BUILD_DEBUG
CXXFLAGS += -g
CFLAGS += -g
else
ifneq ($(OPTIMIZE),none)
CXXFLAGS += -O
CFLAGS += -O
endif
endif
ifeq ($(CHECKED),1)
CPPFLAGS += -DMPT_BUILD_CHECKED
CXXFLAGS += -g
CFLAGS += -g
endif
CXXFLAGS += -Wall
CFLAGS += -Wall
else
ifeq ($(MPT_COMPILER_NOVISIBILITY),1)
CXXFLAGS +=
CFLAGS +=
else
CXXFLAGS += -fvisibility=hidden
CFLAGS += -fvisibility=hidden
endif
LDFLAGS +=
LDLIBS +=
ARFLAGS +=
ifeq ($(DEBUG),1)
CPPFLAGS += -DMPT_BUILD_DEBUG
CXXFLAGS += -g
CFLAGS += -g
else ifeq ($(OPTIMIZE),debug)
CPPFLAGS +=
ifneq ($(MPT_COMPILER_NO_O),1)
CXXFLAGS += -O0
CFLAGS += -O0
endif
CXXFLAGS += -fno-omit-frame-pointer
CFLAGS += -fno-omit-frame-pointer
else ifeq ($(OPTIMIZE),test)
CPPFLAGS +=
ifneq ($(MPT_COMPILER_NO_O),1)
CXXFLAGS += -Og
CFLAGS += -Og
endif
CXXFLAGS += -fno-omit-frame-pointer
CFLAGS += -fno-omit-frame-pointer
else ifeq ($(OPTIMIZE),some)
ifneq ($(MPT_COMPILER_NO_O),1)
CXXFLAGS += -O1
CFLAGS += -O1
endif
CXXFLAGS +=
CFLAGS += -fno-strict-aliasing
ifneq ($(MPT_COMPILER_NOSECTIONS),1)
CXXFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -ffunction-sections -fdata-sections
endif
ifneq ($(MPT_COMPILER_NOGCSECTIONS),1)
LDFLAGS += -Wl,--gc-sections
endif
else ifeq ($(OPTIMIZE),extrasize)
ifneq ($(MPT_COMPILER_NO_O),1)
CXXFLAGS += -Oz
CFLAGS += -Oz
endif
CXXFLAGS +=
CFLAGS += -fno-strict-aliasing
LDFLAGS +=
ifneq ($(MPT_COMPILER_NOSECTIONS),1)
CXXFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -ffunction-sections -fdata-sections
endif
ifneq ($(MPT_COMPILER_NOGCSECTIONS),1)
LDFLAGS += -Wl,--gc-sections
endif
else ifeq ($(OPTIMIZE),size)
ifneq ($(MPT_COMPILER_NO_O),1)
CXXFLAGS += -Os
CFLAGS += -Os
endif
CXXFLAGS +=
CFLAGS += -fno-strict-aliasing
LDFLAGS +=
ifneq ($(MPT_COMPILER_NOSECTIONS),1)
CXXFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -ffunction-sections -fdata-sections
endif
ifneq ($(MPT_COMPILER_NOGCSECTIONS),1)
LDFLAGS += -Wl,--gc-sections
endif
else ifeq ($(OPTIMIZE),speed)
ifneq ($(MPT_COMPILER_NO_O),1)
CXXFLAGS += -O2
CFLAGS += -O2
endif
CXXFLAGS +=
CFLAGS += -fno-strict-aliasing
ifneq ($(MPT_COMPILER_NOSECTIONS),1)
CXXFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -ffunction-sections -fdata-sections
endif
ifneq ($(MPT_COMPILER_NOGCSECTIONS),1)
LDFLAGS += -Wl,--gc-sections
endif
else ifeq ($(OPTIMIZE),vectorize)
ifneq ($(MPT_COMPILER_NO_O),1)
CXXFLAGS += -O3
CFLAGS += -O3
endif
CXXFLAGS +=
CFLAGS += -fno-strict-aliasing
ifneq ($(MPT_COMPILER_NOSECTIONS),1)
CXXFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -ffunction-sections -fdata-sections
endif
ifneq ($(MPT_COMPILER_NOGCSECTIONS),1)
LDFLAGS += -Wl,--gc-sections
endif
else ifeq ($(OPTIMIZE),default)
ifneq ($(MPT_COMPILER_NO_O),1)
CXXFLAGS += -O3
CFLAGS += -O3
endif
CXXFLAGS +=
CFLAGS += -fno-strict-aliasing
ifneq ($(MPT_COMPILER_NOSECTIONS),1)
CXXFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -ffunction-sections -fdata-sections
endif
ifneq ($(MPT_COMPILER_NOGCSECTIONS),1)
LDFLAGS += -Wl,--gc-sections
endif
endif
ifeq ($(FASTMATH_STYLE),gcc)
ifeq ($(OPTIMIZE_FASTMATH),3)
CPPFLAGS += -DMPT_CHECK_CXX_IGNORE_WARNING_FASTMATH -DMPT_CHECK_CXX_IGNORE_WARNING_FINITEMATH
CXXFLAGS += -ffast-math
CFLAGS += -ffast-math
else ifeq ($(OPTIMIZE_FASTMATH),2)
CPPFLAGS += -DMPT_CHECK_CXX_IGNORE_WARNING_FINITEMATH
CXXFLAGS += -fno-math-errno
CXXFLAGS += -ffinite-math-only
CXXFLAGS += -fno-rounding-math
CXXFLAGS += -fno-signaling-nans
CXXFLAGS += -fexcess-precision=fast
CXXFLAGS += -fcx-limited-range
CXXFLAGS += -fassociative-math
CXXFLAGS += -freciprocal-math
CXXFLAGS += -fno-signed-zeros
CXXFLAGS += -fno-trapping-math
CFLAGS += -fno-math-errno
CFLAGS += -ffinite-math-only
CFLAGS += -fno-rounding-math
CFLAGS += -fno-signaling-nans
CFLAGS += -fexcess-precision=fast
CFLAGS += -fcx-limited-range
CFLAGS += -fassociative-math
CFLAGS += -freciprocal-math
CFLAGS += -fno-signed-zeros
CFLAGS += -fno-trapping-math
else ifeq ($(OPTIMIZE_FASTMATH),1)
CXXFLAGS += -fno-math-errno
CXXFLAGS += -fno-rounding-math
CXXFLAGS += -fno-signaling-nans
CXXFLAGS += -fexcess-precision=fast
CXXFLAGS += -fcx-limited-range
CXXFLAGS += -fassociative-math
CXXFLAGS += -freciprocal-math
CXXFLAGS += -fno-signed-zeros
CXXFLAGS += -fno-trapping-math
CFLAGS += -fno-math-errno
CFLAGS += -fno-rounding-math
CFLAGS += -fno-signaling-nans
CFLAGS += -fexcess-precision=fast
CFLAGS += -fcx-limited-range
CFLAGS += -fassociative-math
CFLAGS += -freciprocal-math
CFLAGS += -fno-signed-zeros
CFLAGS += -fno-trapping-math
endif
else ifeq ($(FASTMATH_STYLE),clang)
ifeq ($(OPTIMIZE_FASTMATH),3)
CPPFLAGS += -DMPT_CHECK_CXX_IGNORE_WARNING_FASTMATH -DMPT_CHECK_CXX_IGNORE_WARNING_FINITEMATH
CXXFLAGS += -ffast-math
CFLAGS += -ffast-math
else ifeq ($(OPTIMIZE_FASTMATH),2)
CPPFLAGS += -DMPT_CHECK_CXX_IGNORE_WARNING_FINITEMATH
CXXFLAGS += -fno-math-errno
CXXFLAGS += -ffinite-math-only
CXXFLAGS += -fno-honor-infinities
CXXFLAGS += -fno-honor-nans
CXXFLAGS += -ffp-contract=fast
CXXFLAGS += -fassociative-math
CXXFLAGS += -freciprocal-math
CXXFLAGS += -fno-signed-zeros
CXXFLAGS += -fno-trapping-math
CFLAGS += -fno-math-errno
CFLAGS += -ffinite-math-only
CFLAGS += -fno-honor-infinities
CFLAGS += -fno-honor-nans
CFLAGS += -ffp-contract=fast
CFLAGS += -fassociative-math
CFLAGS += -freciprocal-math
CFLAGS += -fno-signed-zeros
CFLAGS += -fno-trapping-math
else ifeq ($(OPTIMIZE_FASTMATH),1)
CXXFLAGS += -fno-math-errno
CXXFLAGS += -ffp-contract=fast
CXXFLAGS += -fassociative-math
CXXFLAGS += -freciprocal-math
CXXFLAGS += -fno-signed-zeros
CXXFLAGS += -fno-trapping-math
CFLAGS += -fno-math-errno
CFLAGS += -ffp-contract=fast
CFLAGS += -fassociative-math
CFLAGS += -freciprocal-math
CFLAGS += -fno-signed-zeros
CFLAGS += -fno-trapping-math
endif
else
ifeq ($(OPTIMIZE_FASTMATH),3)
CPPFLAGS += -DMPT_CHECK_CXX_IGNORE_WARNING_FASTMATH -DMPT_CHECK_CXX_IGNORE_WARNING_FINITEMATH
CXXFLAGS += -ffast-math
CFLAGS += -ffast-math
else ifeq ($(OPTIMIZE_FASTMATH),2)
CPPFLAGS += -DMPT_CHECK_CXX_IGNORE_WARNING_FASTMATH -DMPT_CHECK_CXX_IGNORE_WARNING_FINITEMATH
CXXFLAGS += -ffast-math
CFLAGS += -ffast-math
else ifeq ($(OPTIMIZE_FASTMATH),1)
CPPFLAGS += -DMPT_CHECK_CXX_IGNORE_WARNING_FASTMATH -DMPT_CHECK_CXX_IGNORE_WARNING_FINITEMATH
CXXFLAGS += -ffast-math
CFLAGS += -ffast-math
endif
endif
ifeq ($(MPT_COMPILER_NOIPARA),1)
# See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115049>.
CXXFLAGS += -fno-ipa-ra
CFLAGS += -fno-ipa-ra
endif
ifeq ($(CHECKED),1)
CPPFLAGS += -DMPT_BUILD_CHECKED
CXXFLAGS += -g -fno-omit-frame-pointer
CFLAGS += -g -fno-omit-frame-pointer
endif
ifeq ($(FUZZ),1)
CPPFLAGS +=
CXXFLAGS += -fno-omit-frame-pointer
CFLAGS += -fno-omit-frame-pointer
endif
CXXFLAGS += -Wall -Wextra -Wpedantic $(CXXFLAGS_WARNINGS)
CFLAGS += -Wall -Wextra -Wpedantic $(CFLAGS_WARNINGS)
LDFLAGS += $(LDFLAGS_WARNINGS)
CXXFLAGS += $(OVERWRITE_CXXFLAGS)
CFLAGS += $(OVERWRITE_CFLAGS)
endif
ifeq ($(STRICT),1)
CXXFLAGS += -Werror
CFLAGS += -Werror
endif
ifeq ($(DYNLINK),1)
LDFLAGS_RPATH += -Wl,-rpath,./bin
LDFLAGS_LIBOPENMPT += -Lbin
LDLIBS_LIBOPENMPT += -lopenmpt
endif
ifeq ($(HOST),unix)
ifeq ($(IS_CROSS),1)
else
ifeq ($(shell help2man --version > /dev/null 2>&1 && echo yes ),yes)
MPT_WITH_HELP2MAN := 1
endif
endif
ifeq ($(shell doxygen --version > /dev/null 2>&1 && echo yes ),yes)
MPT_WITH_DOXYGEN := 1
endif
endif
PC_LIBS_PRIVATE += $(CXXSTDLIB_PCLIBSPRIVATE)
ifeq ($(HACK_ARCHIVE_SUPPORT),1)
NO_ZLIB:=1
endif
$(call PRINT_TRACE,[DEP] zlib)
ifeq ($(LOCAL_ZLIB),1)
$(call PRINT_INFO,[DEP] zlib: local)
CPPFLAGS_ZLIB := -DMPT_WITH_ZLIB
LDFLAGS_ZLIB :=
LDLIBS_ZLIB :=
CPPFLAGS_ZLIB += -Iinclude/zlib/
ZLIB_SOURCES :=
ZLIB_SOURCES += include/zlib/adler32.c
ZLIB_SOURCES += include/zlib/compress.c
ZLIB_SOURCES += include/zlib/crc32.c
ZLIB_SOURCES += include/zlib/deflate.c
ZLIB_SOURCES += include/zlib/gzclose.c
ZLIB_SOURCES += include/zlib/gzlib.c
ZLIB_SOURCES += include/zlib/gzread.c
ZLIB_SOURCES += include/zlib/gzwrite.c
ZLIB_SOURCES += include/zlib/infback.c
ZLIB_SOURCES += include/zlib/inffast.c
ZLIB_SOURCES += include/zlib/inflate.c
ZLIB_SOURCES += include/zlib/inftrees.c
ZLIB_SOURCES += include/zlib/trees.c
ZLIB_SOURCES += include/zlib/uncompr.c
ZLIB_SOURCES += include/zlib/zutil.c
include/zlib/%.zlib$(FLAVOUR_O).o : CFLAGS+=$(CFLAGS_SILENT) -DSTDC -DZ_HAVE_UNISTD_H
ZLIB_OBJECTS = $(ZLIB_SOURCES:.c=.zlib$(FLAVOUR_O).o)
ZLIB_DEPENDS = $(ZLIB_OBJECTS:$(FLAVOUR_O).o=$(FLAVOUR_O).d)
ALL_OBJECTS += $(ZLIB_OBJECTS)
ALL_DEPENDS += $(ZLIB_DEPENDS)
OBJECTS_ZLIB = $(ZLIB_OBJECTS)
else
ifeq ($(NO_ZLIB),1)
$(call PRINT_INFO,[DEP] zlib: disabled)
else
#LDLIBS += -lz
$(call PRINT_DEBUG,[DEP] zlib: checking pkg-config ...)
ifeq ($(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --exists zlib && echo yes),yes)
$(call PRINT_INFO,[DEP] zlib: pkg-config/zlib)
CPPFLAGS_ZLIB := $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --cflags-only-I zlib ) -DMPT_WITH_ZLIB
LDFLAGS_ZLIB := $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --libs-only-L zlib ) $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --libs-only-other zlib )
LDLIBS_ZLIB := $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --libs-only-l zlib )
PC_REQUIRES_ZLIB := zlib
else
$(call PRINT_INFO,[DEP] zlib: no)
ifeq ($(FORCE_DEPS),1)
$(error zlib not found)
else
$(warning warning: zlib not found)
endif
NO_ZLIB:=1
endif
endif
endif
$(call PRINT_TRACE,[DEP] mpg123)
ifeq ($(LOCAL_MPG123),1)
$(call PRINT_INFO,[DEP] mpg123: local)
ifeq ($(ENABLE_DXE),1)
CPPFLAGS_MPG123 := -DMPT_WITH_MPG123 -DMPG123_NO_LARGENAME
LDFLAGS_MPG123 :=
LDLIBS_MPG123 :=
CPPFLAGS_MPG123 += -Iinclude/mpg123/src/include/ -Iinclude/mpg123/ports/makefile/
MPG123_SOURCES :=
MPG123_SOURCES += include/mpg123/src/compat/compat.c
MPG123_SOURCES += include/mpg123/src/compat/compat_str.c
MPG123_SOURCES += include/mpg123/src/libmpg123/dct64.c
MPG123_SOURCES += include/mpg123/src/libmpg123/equalizer.c
MPG123_SOURCES += include/mpg123/src/libmpg123/feature.c
MPG123_SOURCES += include/mpg123/src/libmpg123/format.c
MPG123_SOURCES += include/mpg123/src/libmpg123/frame.c
MPG123_SOURCES += include/mpg123/src/libmpg123/icy.c
MPG123_SOURCES += include/mpg123/src/libmpg123/icy2utf8.c
MPG123_SOURCES += include/mpg123/src/libmpg123/id3.c
MPG123_SOURCES += include/mpg123/src/libmpg123/index.c
MPG123_SOURCES += include/mpg123/src/libmpg123/layer1.c
MPG123_SOURCES += include/mpg123/src/libmpg123/layer2.c
MPG123_SOURCES += include/mpg123/src/libmpg123/layer3.c
MPG123_SOURCES += include/mpg123/src/libmpg123/lfs_wrap.c
MPG123_SOURCES += include/mpg123/src/libmpg123/libmpg123.c
MPG123_SOURCES += include/mpg123/src/libmpg123/ntom.c
MPG123_SOURCES += include/mpg123/src/libmpg123/optimize.c
MPG123_SOURCES += include/mpg123/src/libmpg123/parse.c
MPG123_SOURCES += include/mpg123/src/libmpg123/readers.c
MPG123_SOURCES += include/mpg123/src/libmpg123/stringbuf.c
MPG123_SOURCES += include/mpg123/src/libmpg123/synth.c
MPG123_SOURCES += include/mpg123/src/libmpg123/synth_8bit.c
MPG123_SOURCES += include/mpg123/src/libmpg123/synth_real.c
MPG123_SOURCES += include/mpg123/src/libmpg123/synth_s32.c
MPG123_SOURCES += include/mpg123/src/libmpg123/tabinit.c
MPG123_OBJECTS += $(MPG123_SOURCES:.c=.mpg123$(FLAVOUR_O).o)
MPG123_DEPENDS = $(MPG123_OBJECTS:$(FLAVOUR_O).o=$(FLAVOUR_O).d)
ALL_OBJECTS += $(MPG123_OBJECTS)
ALL_DEPENDS += $(MPG123_DEPENDS)
include/mpg123/src/compat/%.mpg123$(FLAVOUR_O).o : CFLAGS+=$(CFLAGS_SILENT) -DOPT_GENERIC
include/mpg123/src/libmpg123/%.mpg123$(FLAVOUR_O).o : CFLAGS+=$(CFLAGS_SILENT) -DOPT_GENERIC
include/mpg123/src/compat/%.mpg123$(FLAVOUR_O).o : CPPFLAGS:= -Iinclude/mpg123/src/include/ -Iinclude/mpg123/ports/makefile/ $(CPPFLAGS)
include/mpg123/src/libmpg123/%.mpg123$(FLAVOUR_O).o : CPPFLAGS:= -Iinclude/mpg123/src/include/ -Iinclude/mpg123/ports/makefile/ $(CPPFLAGS)
LIBS_MPG123 = bin/$(FLAVOUR_DIR)mpg123.a
bin/$(FLAVOUR_DIR)mpg123.a: $(MPG123_OBJECTS)
$(INFO) [DXE] $@
ifeq ($(NO_SHARED_LINKER_FLAG),1)
$(SILENT)PATH="./build/djgpp/bin:${PATH}" $(DXE3GEN) -o bin/$(FLAVOUR_DIR)mpg123$(SOSUFFIX) -Y $@ -U $^ $(MPG123_LDFLAGS) $(SO_LDFLAGS)
else
$(SILENT)PATH="./build/djgpp/bin:${PATH}" $(DXE3GEN) -o bin/$(FLAVOUR_DIR)mpg123$(SOSUFFIX) -Y $@ -U $^ -shared $(MPG123_LDFLAGS) $(SO_LDFLAGS)
endif
ifeq ($(SHARED_SONAME),1)
$(SILENT)mv bin/$(FLAVOUR_DIR)mpg123$(SOSUFFIX) bin/$(FLAVOUR_DIR)$(MPG123_SONAME)
$(SILENT)ln -sf $(MPG123_SONAME) bin/$(FLAVOUR_DIR)mpg123$(SOSUFFIX)
endif
else
CPPFLAGS_MPG123 := -DMPT_WITH_MPG123 -DMPG123_NO_LARGENAME
LDFLAGS_MPG123 :=
LDLIBS_MPG123 :=
CPPFLAGS_MPG123 += -Iinclude/mpg123/src/include/ -Iinclude/mpg123/ports/makefile/
MPG123_SOURCES :=
MPG123_SOURCES += include/mpg123/src/compat/compat.c
MPG123_SOURCES += include/mpg123/src/compat/compat_str.c
MPG123_SOURCES += include/mpg123/src/libmpg123/dct64.c
MPG123_SOURCES += include/mpg123/src/libmpg123/equalizer.c
MPG123_SOURCES += include/mpg123/src/libmpg123/feature.c
MPG123_SOURCES += include/mpg123/src/libmpg123/format.c
MPG123_SOURCES += include/mpg123/src/libmpg123/frame.c
MPG123_SOURCES += include/mpg123/src/libmpg123/icy.c
MPG123_SOURCES += include/mpg123/src/libmpg123/icy2utf8.c
MPG123_SOURCES += include/mpg123/src/libmpg123/id3.c
MPG123_SOURCES += include/mpg123/src/libmpg123/index.c
MPG123_SOURCES += include/mpg123/src/libmpg123/layer1.c
MPG123_SOURCES += include/mpg123/src/libmpg123/layer2.c
MPG123_SOURCES += include/mpg123/src/libmpg123/layer3.c
MPG123_SOURCES += include/mpg123/src/libmpg123/lfs_wrap.c
MPG123_SOURCES += include/mpg123/src/libmpg123/libmpg123.c
MPG123_SOURCES += include/mpg123/src/libmpg123/ntom.c
MPG123_SOURCES += include/mpg123/src/libmpg123/optimize.c
MPG123_SOURCES += include/mpg123/src/libmpg123/parse.c
MPG123_SOURCES += include/mpg123/src/libmpg123/readers.c
MPG123_SOURCES += include/mpg123/src/libmpg123/stringbuf.c
MPG123_SOURCES += include/mpg123/src/libmpg123/synth.c
MPG123_SOURCES += include/mpg123/src/libmpg123/synth_8bit.c
MPG123_SOURCES += include/mpg123/src/libmpg123/synth_real.c
MPG123_SOURCES += include/mpg123/src/libmpg123/synth_s32.c
MPG123_SOURCES += include/mpg123/src/libmpg123/tabinit.c
include/mpg123/src/compat/%.mpg123$(FLAVOUR_O).o : CFLAGS+=$(CFLAGS_SILENT) -DOPT_GENERIC
include/mpg123/src/libmpg123/%.mpg123$(FLAVOUR_O).o : CFLAGS+=$(CFLAGS_SILENT) -DOPT_GENERIC
include/mpg123/src/compat/%.mpg123$(FLAVOUR_O).o : CPPFLAGS:= -Iinclude/mpg123/src/include/ -Iinclude/mpg123/ports/makefile/ $(CPPFLAGS)
include/mpg123/src/libmpg123/%.mpg123$(FLAVOUR_O).o : CPPFLAGS:= -Iinclude/mpg123/src/include/ -Iinclude/mpg123/ports/makefile/ $(CPPFLAGS)
MPG123_OBJECTS = $(MPG123_SOURCES:.c=.mpg123$(FLAVOUR_O).o)
MPG123_DEPENDS = $(MPG123_OBJECTS:$(FLAVOUR_O).o=$(FLAVOUR_O).d)
ALL_OBJECTS += $(MPG123_OBJECTS)
ALL_DEPENDS += $(MPG123_DEPENDS)
OBJECTS_MPG123 = $(MPG123_OBJECTS)
endif
else
ifeq ($(NO_MPG123),1)
$(call PRINT_INFO,[DEP] mpg123: disabled)
else
#LDLIBS += -lmpg123
$(call PRINT_DEBUG,[DEP] mpg123: checking pkg-config ...)
ifeq ($(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --exists 'libmpg123 >= 1.14.0' && echo yes),yes)
$(call PRINT_INFO,[DEP] mpg123: pkg-config/mpg123)
CPPFLAGS_MPG123 := $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --cflags-only-I 'libmpg123 >= 1.14.0' ) -DMPT_WITH_MPG123
LDFLAGS_MPG123 := $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --libs-only-L 'libmpg123 >= 1.14.0' ) $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --libs-only-other 'libmpg123 >= 1.14.0' )
LDLIBS_MPG123 := $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --libs-only-l 'libmpg123 >= 1.14.0' )
PC_REQUIRES_MPG123 := libmpg123
else
$(call PRINT_INFO,[DEP] mpg123: no)
ifeq ($(FORCE_DEPS),1)
$(error mpg123 not found)
else
$(warning warning: mpg123 not found)
endif
NO_MPG123:=1
endif
endif
endif
$(call PRINT_TRACE,[DEP] ogg)
ifeq ($(LOCAL_OGG),1)
$(call PRINT_INFO,[DEP] ogg: local)
CPPFLAGS_OGG := -DMPT_WITH_OGG
LDFLAGS_OGG :=
LDLIBS_OGG :=
CPPFLAGS_OGG += -Iinclude/ogg/include/ -Iinclude/ogg/ports/makefile/
OGG_SOURCES :=
OGG_SOURCES += include/ogg/src/bitwise.c
OGG_SOURCES += include/ogg/src/framing.c
include/ogg/src/%.ogg$(FLAVOUR_O).o : CFLAGS+=$(CFLAGS_SILENT)
OGG_OBJECTS += $(OGG_SOURCES:.c=.ogg$(FLAVOUR_O).o)
OGG_DEPENDS = $(OGG_OBJECTS:$(FLAVOUR_O).o=$(FLAVOUR_O).d)
ALL_OBJECTS += $(OGG_OBJECTS)
ALL_DEPENDS += $(OGG_DEPENDS)
OBJECTS_OGG = $(OGG_OBJECTS)
else
ifeq ($(NO_OGG),1)
$(call PRINT_INFO,[DEP] ogg: disabled)
else
#LDLIBS += -logg
$(call PRINT_DEBUG,[DEP] ogg: checking pkg-config ...)
ifeq ($(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --exists ogg && echo yes),yes)
$(call PRINT_INFO,[DEP] ogg: pkg-config/ogg)
CPPFLAGS_OGG := $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --cflags-only-I ogg ) -DMPT_WITH_OGG
LDFLAGS_OGG := $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --libs-only-L ogg ) $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --libs-only-other ogg )
LDLIBS_OGG := $(shell $(PKG_CONFIG)$(TOOLCHAIN_SUFFIX) --libs-only-l ogg )
PC_REQUIRES_OGG := ogg
else
$(call PRINT_INFO,[DEP] ogg: no)
ifeq ($(FORCE_DEPS),1)
$(error ogg not found)
else
$(warning warning: ogg not found)
endif
NO_OGG:=1
endif
endif
endif
$(call PRINT_TRACE,[DEP] vorbis)
ifeq ($(LOCAL_VORBIS),1)
$(call PRINT_INFO,[DEP] vorbis: local)
CPPFLAGS_VORBIS := -DMPT_WITH_VORBIS
LDFLAGS_VORBIS :=
LDLIBS_VORBIS :=
CPPFLAGS_VORBIS += -Iinclude/vorbis/include/ -Iinclude/vorbis/lib/
ifneq ($(MPT_COMPILER_NOALLOCAH),1)
CPPFLAGS_VORBIS += -DHAVE_ALLOCA_H
endif
VORBIS_SOURCES :=
VORBIS_SOURCES += include/vorbis/lib/analysis.c
VORBIS_SOURCES += include/vorbis/lib/bitrate.c
VORBIS_SOURCES += include/vorbis/lib/block.c
VORBIS_SOURCES += include/vorbis/lib/codebook.c
VORBIS_SOURCES += include/vorbis/lib/envelope.c
VORBIS_SOURCES += include/vorbis/lib/floor0.c
VORBIS_SOURCES += include/vorbis/lib/floor1.c
VORBIS_SOURCES += include/vorbis/lib/info.c
VORBIS_SOURCES += include/vorbis/lib/lookup.c
VORBIS_SOURCES += include/vorbis/lib/lpc.c
VORBIS_SOURCES += include/vorbis/lib/lsp.c
VORBIS_SOURCES += include/vorbis/lib/mapping0.c
VORBIS_SOURCES += include/vorbis/lib/mdct.c
VORBIS_SOURCES += include/vorbis/lib/psy.c
VORBIS_SOURCES += include/vorbis/lib/registry.c
VORBIS_SOURCES += include/vorbis/lib/res0.c
VORBIS_SOURCES += include/vorbis/lib/sharedbook.c
VORBIS_SOURCES += include/vorbis/lib/smallft.c
VORBIS_SOURCES += include/vorbis/lib/synthesis.c
VORBIS_SOURCES += include/vorbis/lib/vorbisenc.c
VORBIS_SOURCES += include/vorbis/lib/vorbisfile.c
VORBIS_SOURCES += include/vorbis/lib/window.c
include/vorbis/lib/%.vorbis$(FLAVOUR_O).o : CFLAGS+=$(CFLAGS_SILENT)
VORBIS_OBJECTS += $(VORBIS_SOURCES:.c=.vorbis$(FLAVOUR_O).o)
VORBIS_DEPENDS = $(VORBIS_OBJECTS:$(FLAVOUR_O).o=$(FLAVOUR_O).d)
ALL_OBJECTS += $(VORBIS_OBJECTS)
ALL_DEPENDS += $(VORBIS_DEPENDS)