forked from mamedev/mame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
1748 lines (1442 loc) · 48.2 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
###########################################################################
#
# makefile
#
# Core makefile for building MAME and derivatives
#
###########################################################################
###########################################################################
################# BEGIN USER-CONFIGURABLE OPTIONS #####################
###########################################################################
# REGENIE = 1
# VERBOSE = 1
# NOWERROR = 1
# IGNORE_GIT = 1
# TARGET = mame
# SUBTARGET = tiny
# TOOLS = 1
# TESTS = 1
# BENCHMARKS = 1
# OSD = sdl
# NO_OPENGL = 0
# USE_DISPATCH_GL = 0
# MODERN_WIN_API = 0
# USE_SDL = 1
# SDL_INI_PATH = .;$HOME/.mame/;ini;
# SDL2_MULTIAPI = 1
# NO_USE_MIDI = 1
# NO_USE_PORTAUDIO = 1
# NO_USE_PULSEAUDIO = 1
# USE_TAPTUN = 1
# USE_PCAP = 1
# USE_QTDEBUG = 1
# NO_X11 = 1
# NO_USE_XINPUT = 1
# NO_USE_XINPUT_WII_LIGHTGUN_HACK = 1
# FORCE_DRC_C_BACKEND = 1
# DEBUG = 1
# PROFILER = 1
# SANITIZE =
# PTR64 = 1
# BIGENDIAN = 1
# NOASM = 1
# OPTIMIZE = 3
# SYMBOLS = 1
# SYMLEVEL = 2
# MAP = 1
# PROFILE = 1
# ARCHOPTS =
# ARCHOPTS_C =
# ARCHOPTS_CXX =
# ARCHOPTS_OBJC =
# ARCHOPTS_OBJCXX =
# OPT_FLAGS =
# LDOPTS =
# USE_SYSTEM_LIB_ASIO = 1
# USE_SYSTEM_LIB_EXPAT = 1
# USE_SYSTEM_LIB_ZLIB = 1
# USE_SYSTEM_LIB_JPEG = 1
# USE_SYSTEM_LIB_FLAC = 1
# USE_SYSTEM_LIB_LUA = 1
# USE_SYSTEM_LIB_SQLITE3 = 1
# USE_SYSTEM_LIB_PORTMIDI = 1
# USE_SYSTEM_LIB_PORTAUDIO = 1
# USE_SYSTEM_LIB_UTF8PROC = 1
# USE_SYSTEM_LIB_GLM = 1
# USE_SYSTEM_LIB_RAPIDJSON = 1
# USE_SYSTEM_LIB_PUGIXML = 1
# MESA_INSTALL_ROOT = /opt/mesa
# SDL_INSTALL_ROOT = /opt/sdl2
# SDL_FRAMEWORK_PATH = $(HOME)/Library/Frameworks
# USE_LIBSDL = 1
# CYGWIN_BUILD = 1
# BUILDDIR = build
# TARGETOS = windows
# CROSS_BUILD = 1
# TOOLCHAIN =
# OVERRIDE_CC = cc
# OVERRIDE_CXX = c++
# OVERRIDE_LD = ld
# OVERRIDE_AR = ar
# DEPRECATED = 0
# LTO = 1
# SSE2 = 1
# OPENMP = 1
# SEPARATE_BIN = 1
# PYTHON_EXECUTABLE = python3
# SHADOW_CHECK = 1
# STRIP_SYMBOLS = 0
# QT_HOME = /usr/lib64/qt48/
# SOURCES = src/mame/atari/asteroid.cpp,src/mame/cinemat/cchasm.cpp
# SOURCEFILTER = mydrivers.flt
# FORCE_VERSION_COMPILE = 1
# MSBUILD = 1
# IGNORE_BAD_LOCALISATION = 1
# PRECOMPILE = 0
# DEBUG_DIR=c:\test\location
# DEBUG_ARGS= -window -video bgfx
ifdef PREFIX_MAKEFILE
include $(PREFIX_MAKEFILE)
else
-include useroptions.mak
endif
###########################################################################
################## END USER-CONFIGURABLE OPTIONS ######################
###########################################################################
ifndef MAKETYPE
MAKETYPE := gmake
endif
MAKEPARAMS := -R
#
# Determine running OS
#
ifeq ($(OS),Windows_NT)
OS := windows
GENIEOS := windows
PLATFORM := x86
else
UNAME := $(shell uname -mps)
UNAME_M := $(shell uname -m)
UNAME_P := $(shell uname -p)
GENIEOS := linux
PLATFORM := unknown
ifneq ($(filter x86_64,$(UNAME_P)),)
PLATFORM := x86
endif
ifneq ($(filter %86,$(UNAME_P)),)
PLATFORM := x86
endif
ifneq ($(filter alpha,$(UNAME_M)),)
PLATFORM := alpha
endif
ifneq ($(filter alpha,$(UNAME_P)),)
PLATFORM := alpha
endif
ifneq ($(filter arm%,$(UNAME_M)),)
PLATFORM := arm
endif
ifneq ($(filter arm%,$(UNAME_P)),)
PLATFORM := arm
endif
ifneq ($(filter aarch64%,$(UNAME_M)),)
PLATFORM := arm64
endif
ifneq ($(filter arm64%,$(UNAME_M)),)
PLATFORM := arm64
endif
ifneq ($(filter aarch64%,$(UNAME_P)),)
PLATFORM := arm64
endif
ifneq ($(filter powerpc,$(UNAME_P)),)
PLATFORM := powerpc
endif
ifneq ($(filter riscv64%,$(UNAME_M)),)
PLATFORM := riscv64
endif
ifneq ($(filter riscv64%,$(UNAME_P)),)
PLATFORM := riscv64
endif
ifneq ($(filter mips64%,$(UNAME_M)),)
ifeq ($(shell getconf LONG_BIT),64)
PLATFORM := mips64
endif
endif
ifeq ($(firstword $(filter Linux,$(UNAME))),Linux)
OS := linux
endif
ifeq ($(firstword $(filter Solaris,$(UNAME))),Solaris)
OS := solaris
GENIEOS := solaris
endif
ifeq ($(firstword $(filter SunOS,$(UNAME))),SunOS)
OS := solaris
GENIEOS := solaris
endif
ifeq ($(firstword $(filter FreeBSD,$(UNAME))),FreeBSD)
OS := freebsd
GENIEOS := bsd
endif
ifeq ($(firstword $(filter GNU/kFreeBSD,$(UNAME))),GNU/kFreeBSD)
OS := freebsd
GENIEOS := freebsd
endif
ifeq ($(firstword $(filter NetBSD,$(UNAME))),NetBSD)
OS := netbsd
GENIEOS := freebsd
endif
ifeq ($(firstword $(filter OpenBSD,$(UNAME))),OpenBSD)
OS := openbsd
GENIEOS := freebsd
endif
ifeq ($(firstword $(filter Darwin,$(UNAME))),Darwin)
OS := macosx
GENIEOS := darwin
endif
ifeq ($(firstword $(filter Haiku,$(UNAME))),Haiku)
OS := haiku
endif
ifndef OS
$(error Unable to detect OS from uname -a: $(UNAME))
endif
endif
MINGW:=
ifdef MINGW64
MINGW := $(MINGW64)
else
MINGW := $(MINGW32)
endif
#-------------------------------------------------
# specify core target: mame, ldplayer
# specify subtarget: mame, arcade, mess, tiny, etc.
# build scripts will be run from
# scripts/target/$(TARGET)/$(SUBTARGET).lua
#-------------------------------------------------
ifdef PROJECT
PARAMS += --PROJECT='$(PROJECT)'
TARGET := $(PROJECT)
endif
ifndef TARGET
TARGET := mame
endif
ifndef SUBTARGET
SUBTARGET := $(TARGET)
endif
SUBTARGET_FULL := $(subst -,_,$(SUBTARGET))
CONFIG = release
ifdef DEBUG
ifneq '$(DEBUG)' '0'
CONFIG := debug
endif
endif
ifdef VERBOSE
MAKEPARAMS += verbose=1
else
SILENT := @
MAKEPARAMS += --no-print-directory
endif
ifndef BUILDDIR
BUILDDIR := build
endif
#-------------------------------------------------
# specify OS target, which further differentiates
# the underlying OS; supported values are:
# win32, unix, macosx
#-------------------------------------------------
ifndef TARGETOS
ifeq ($(OS),windows)
TARGETOS := windows
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
ARCHITECTURE := _x64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
ARCHITECTURE := _x64
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
else
ARCHITECTURE := _x86
endif
endif
else
UNAME := $(shell uname -mps)
TARGETOS := $(OS)
#-------------------------------------------------
# determine the whether -m32, -m64 or nothing
# should be passed to gcc when building genie
#-------------------------------------------------
ifeq ($(ARCHITECTURE),_x86)
MPARAM := -m32
else
ifeq ($(ARCHITECTURE),_x64)
MPARAM := -m64
else
MPARAM :=
endif
endif
ARCHITECTURE := _x86
ifeq ($(firstword $(filter x86_64,$(UNAME))),x86_64)
ARCHITECTURE := _x64
endif
ifeq ($(firstword $(filter amd64,$(UNAME))),amd64)
ARCHITECTURE := _x64
endif
ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64)
ARCHITECTURE := _x64
endif
ifeq ($(firstword $(filter powerpc64,$(UNAME))),powerpc64)
ARCHITECTURE := _x64
endif
ifeq ($(firstword $(filter ppc64le,$(UNAME))),ppc64le)
ARCHITECTURE := _x64
endif
ifeq ($(firstword $(filter s390x,$(UNAME))),s390x)
ARCHITECTURE := _x64
endif
endif
else
CROSS_BUILD := 1
endif # TARGET_OS
ifdef PTR64
ifeq ($(PTR64),1)
ARCHITECTURE := _x64
else
ARCHITECTURE := _x86
endif
endif
ifeq ($(OS),windows)
ifndef MINGW64
ARCHITECTURE := _x86
endif
ifeq ($(ARCHITECTURE),_x64)
WINDRES := $(MINGW64)/bin/windres
else
WINDRES := $(MINGW32)/bin/windres
endif
else
ifeq ($(ARCHITECTURE),_x64)
WINDRES := $(word 1,$(TOOLCHAIN) x86_64-w64-mingw32-)windres
else
WINDRES := $(word 1,$(TOOLCHAIN) i686-w64-mingw32-)windres
endif
endif
# Emscripten
ifeq ($(findstring emcc,$(CC)),emcc)
TARGETOS := asmjs
ARCHITECTURE :=
ifndef NOASM
NOASM := 1
endif
endif
ifeq ($(findstring ppc,$(UNAME)),ppc)
ifndef FORCE_DRC_C_BACKEND
FORCE_DRC_C_BACKEND := 1
endif
endif
ifeq ($(findstring powerpc,$(UNAME)),powerpc)
ifndef FORCE_DRC_C_BACKEND
FORCE_DRC_C_BACKEND := 1
endif
endif
ifeq ($(findstring arm,$(UNAME)),arm)
ARCHITECTURE :=
ifndef FORCE_DRC_C_BACKEND
FORCE_DRC_C_BACKEND := 1
endif
endif
ifeq ($(findstring aarch64,$(UNAME)),aarch64)
ARCHITECTURE :=
ifndef FORCE_DRC_C_BACKEND
FORCE_DRC_C_BACKEND := 1
endif
endif
ifeq ($(findstring s390x,$(UNAME)),s390x)
ifndef FORCE_DRC_C_BACKEND
FORCE_DRC_C_BACKEND := 1
endif
endif
ifeq ($(findstring riscv64,$(UNAME)),riscv64)
ARCHITECTURE :=
ifndef FORCE_DRC_C_BACKEND
FORCE_DRC_C_BACKEND := 1
endif
endif
# Autodetect BIGENDIAN
# MacOSX
ifndef BIGENDIAN
ifneq (,$(findstring Power,$(UNAME)))
BIGENDIAN := 1
endif
# Linux
ifneq (,$(findstring ppc,$(UNAME)))
ifneq (,$(findstring ppc64le,$(UNAME)))
BIGENDIAN := 0
else
BIGENDIAN := 1
endif
endif
ifneq (,$(findstring s390x,$(UNAME)))
BIGENDIAN := 1
endif
# FreeBSD
ifneq (,$(findstring powerpc,$(UNAME)))
ifneq (,$(findstring powerpc64le,$(UNAME)))
BIGENDIAN := 0
else
BIGENDIAN := 1
endif
endif
endif # BIGENDIAN
ifndef PYTHON_EXECUTABLE
PYTHON := python3
else
PYTHON := $(PYTHON_EXECUTABLE)
endif
ifneq ($(TARGETOS),asmjs)
CC := $(SILENT)gcc
LD := $(SILENT)g++
CXX:= $(SILENT)g++
endif
#-------------------------------------------------
# specify OSD layer: windows, sdl, etc.
# build scripts will be run from
# scripts/src/osd/$(OSD).lua
#-------------------------------------------------
ifndef OSD
OSD := sdl
ifeq ($(TARGETOS),windows)
OSD := windows
endif
ifeq ($(TARGETOS),linux)
OSD := sdl
endif
ifeq ($(TARGETOS),freebsd)
OSD := sdl
endif
ifeq ($(TARGETOS),netbsd)
OSD := sdl
endif
ifeq ($(TARGETOS),openbsd)
OSD := sdl
endif
ifeq ($(TARGETOS),solaris)
OSD := sdl
endif
ifeq ($(TARGETOS),macosx)
OSD := sdl
endif
ifeq ($(TARGETOS),asmjs)
OSD := sdl
endif
endif
#-------------------------------------------------
# which 3rdparty library to build;
# link against system (common) library otherwise
#-------------------------------------------------
ifdef USE_SYSTEM_LIB_ASIO
PARAMS += --with-system-asio='$(USE_SYSTEM_LIB_ASIO)'
endif
ifdef USE_SYSTEM_LIB_EXPAT
PARAMS += --with-system-expat='$(USE_SYSTEM_LIB_EXPAT)'
endif
ifdef USE_SYSTEM_LIB_ZLIB
PARAMS += --with-system-zlib='$(USE_SYSTEM_LIB_ZLIB)'
endif
ifdef USE_SYSTEM_LIB_JPEG
PARAMS += --with-system-jpeg='$(USE_SYSTEM_LIB_JPEG)'
endif
ifdef USE_SYSTEM_LIB_FLAC
PARAMS += --with-system-flac='$(USE_SYSTEM_LIB_FLAC)'
endif
ifdef USE_SYSTEM_LIB_LUA
PARAMS += --with-system-lua='$(USE_SYSTEM_LIB_LUA)'
endif
ifdef USE_SYSTEM_LIB_SQLITE3
PARAMS += --with-system-sqlite3='$(USE_SYSTEM_LIB_SQLITE3)'
endif
ifdef USE_SYSTEM_LIB_PORTMIDI
PARAMS += --with-system-portmidi='$(USE_SYSTEM_LIB_PORTMIDI)'
endif
ifdef USE_SYSTEM_LIB_PORTAUDIO
PARAMS += --with-system-portaudio='$(USE_SYSTEM_LIB_PORTAUDIO)'
endif
ifdef USE_SYSTEM_LIB_UTF8PROC
PARAMS += --with-system-utf8proc='$(USE_SYSTEM_LIB_UTF8PROC)'
endif
ifdef USE_SYSTEM_LIB_GLM
PARAMS += --with-system-glm='$(USE_SYSTEM_LIB_GLM)'
endif
ifdef USE_SYSTEM_LIB_RAPIDJSON
PARAMS += --with-system-rapidjson='$(USE_SYSTEM_LIB_RAPIDJSON)'
endif
ifdef USE_SYSTEM_LIB_PUGIXML
PARAMS += --with-system-pugixml='$(USE_SYSTEM_LIB_PUGIXML)'
endif
#-------------------------------------------------
# distribution may change things
#-------------------------------------------------
ifeq ($(DISTRO),)
DISTRO := generic
else
ifeq ($(DISTRO),debian-stable)
else
$(error DISTRO $(DISTRO) unknown)
endif
endif
PARAMS+= --distro=$(DISTRO)
ifdef TOOLCHAIN
PARAMS += --TOOLCHAIN='$(TOOLCHAIN)'
endif
ifdef OVERRIDE_CC
PARAMS += --CC='$(OVERRIDE_CC)'
ifndef CROSS_BUILD
CC := $(OVERRIDE_CC)
endif
endif
ifdef OVERRIDE_CXX
PARAMS += --CXX='$(OVERRIDE_CXX)'
ifndef CROSS_BUILD
CXX := $(OVERRIDE_CXX)
endif
endif
ifdef OVERRIDE_LD
PARAMS += --LD='$(OVERRIDE_LD)'
ifndef CROSS_BUILD
LD := $(OVERRIDE_LD)
endif
endif
ifdef OVERRIDE_AR
PARAMS += --AR='$(OVERRIDE_AR)'
ifndef CROSS_BUILD
AR := $(OVERRIDE_AR)
endif
endif
#-------------------------------------------------
# sanity check the configuration
#-------------------------------------------------
# enable symbols as it is useless without them
ifdef SANITIZE
SYMBOLS = 1
endif
# profiler defaults to on for DEBUG builds
ifdef DEBUG
ifneq '$(DEBUG)' '0'
ifndef PROFILER
PROFILER = 1
endif
endif
endif
# allow gprof profiling as well, which overrides the internal PROFILER
# also enable symbols as it is useless without them
ifdef PROFILE
PROFILER =
SYMBOLS = 1
endif
# specify a default optimization level if none explicitly stated
ifndef OPTIMIZE
OPTIMIZE = 3
endif
# set the symbols level
ifdef SYMBOLS
PARAMS += --SYMBOLS='$(SYMBOLS)'
ifneq '$(SYMBOLS)' '0'
ifndef SYMLEVEL
ifdef SOURCES
SYMLEVEL = 2
else
SYMLEVEL = 1
endif
endif
endif
endif
ifdef TOOLS
ifneq '$(TOOLS)' '0'
PARAMS += --with-tools
endif
endif
ifdef TESTS
ifneq '$(TESTS)' '0'
PARAMS += --with-tests
endif
endif
ifdef BENCHMARKS
ifneq '$(BENCHMARKS)' '0'
PARAMS += --with-benchmarks
endif
endif
ifdef SYMLEVEL
PARAMS += --SYMLEVEL='$(SYMLEVEL)'
endif
ifdef PROFILER
PARAMS += --PROFILER='$(PROFILER)'
endif
ifdef PROFILE
PARAMS += --PROFILE='$(PROFILE)'
endif
ifdef OPTIMIZE
PARAMS += --OPTIMIZE=$(OPTIMIZE)
endif
ifdef SHLIB
PARAMS += --SHLIB=$(SHLIB)
endif
ifdef ARCHOPTS
PARAMS += --ARCHOPTS='$(ARCHOPTS)'
endif
ifdef ARCHOPTS_C
PARAMS += --ARCHOPTS_C='$(ARCHOPTS_C)'
endif
ifdef ARCHOPTS_CXX
PARAMS += --ARCHOPTS_CXX='$(ARCHOPTS_CXX)'
endif
ifdef ARCHOPTS_OBJC
PARAMS += --ARCHOPTS_OBJC='$(ARCHOPTS_OBJC)'
endif
ifdef ARCHOPTS_OBJCXX
PARAMS += --ARCHOPTS_OBJCXX='$(ARCHOPTS_OBJCXX)'
endif
ifdef OPT_FLAGS
PARAMS += --OPT_FLAGS='$(OPT_FLAGS)'
endif
ifdef MAP
PARAMS += --MAP='$(MAP)'
endif
ifdef NOASM
TARGET_PARAMS += --NOASM='$(NOASM)'
endif
ifdef BIGENDIAN
PARAMS += --BIGENDIAN='$(BIGENDIAN)'
endif
ifdef FORCE_DRC_C_BACKEND
PARAMS += --FORCE_DRC_C_BACKEND='$(FORCE_DRC_C_BACKEND)'
endif
ifdef NOWERROR
PARAMS += --NOWERROR='$(NOWERROR)'
endif
ifdef TARGET
PARAMS += --target='$(TARGET)'
endif
ifdef SUBTARGET_FULL
PARAMS += --subtarget='$(SUBTARGET_FULL)'
endif
ifdef OSD
TARGET_PARAMS += --osd='$(OSD)'
endif
ifdef BUILDDIR
PARAMS += --build-dir='$(BUILDDIR)'
endif
ifdef TARGETOS
TARGET_PARAMS += --targetos='$(TARGETOS)'
endif
ifdef USE_TAPTUN
PARAMS += --USE_TAPTUN='$(USE_TAPTUN)'
endif
ifdef USE_PCAP
PARAMS += --USE_PCAP='$(USE_PCAP)'
endif
ifdef NO_OPENGL
PARAMS += --NO_OPENGL='$(NO_OPENGL)'
endif
ifdef USE_DISPATCH_GL
PARAMS += --USE_DISPATCH_GL='$(USE_DISPATCH_GL)'
endif
ifdef NO_USE_MIDI
PARAMS += --NO_USE_MIDI='$(NO_USE_MIDI)'
endif
ifdef NO_USE_PORTAUDIO
PARAMS += --NO_USE_PORTAUDIO='$(NO_USE_PORTAUDIO)'
endif
ifdef NO_USE_PULSEAUDIO
PARAMS += --NO_USE_PULSEAUDIO='$(NO_USE_PULSEAUDIO)'
endif
ifdef USE_QTDEBUG
PARAMS += --USE_QTDEBUG='$(USE_QTDEBUG)'
endif
ifdef MODERN_WIN_API
PARAMS += --MODERN_WIN_API='$(MODERN_WIN_API)'
endif
ifdef USE_SDL
PARAMS += --USE_SDL='$(USE_SDL)'
endif
ifdef SDL_INI_PATH
PARAMS += --SDL_INI_PATH='$(SDL_INI_PATH)'
endif
ifdef CYGWIN_BUILD
PARAMS += --CYGWIN_BUILD='$(CYGWIN_BUILD)'
endif
ifdef MESA_INSTALL_ROOT
PARAMS += --MESA_INSTALL_ROOT='$(MESA_INSTALL_ROOT)'
endif
ifdef NO_X11
PARAMS += --NO_X11='$(NO_X11)'
endif
ifdef NO_USE_XINPUT
PARAMS += --NO_USE_XINPUT='$(NO_USE_XINPUT)'
endif
ifdef NO_USE_XINPUT_WII_LIGHTGUN_HACK
PARAMS += --NO_USE_XINPUT_WII_LIGHTGUN_HACK='$(NO_USE_XINPUT_WII_LIGHTGUN_HACK)'
endif
ifdef SDL_LIBVER
PARAMS += --SDL_LIBVER='$(SDL_LIBVER)'
endif
ifdef SDL2_MULTIAPI
PARAMS += --SDL2_MULTIAPI='$(SDL2_MULTIAPI)'
endif
ifdef SDL_INSTALL_ROOT
PARAMS += --SDL_INSTALL_ROOT='$(SDL_INSTALL_ROOT)'
endif
ifdef SDL_FRAMEWORK_PATH
PARAMS += --SDL_FRAMEWORK_PATH='$(SDL_FRAMEWORK_PATH)'
endif
ifdef USE_LIBSDL
PARAMS += --USE_LIBSDL='$(USE_LIBSDL)'
endif
ifdef LDOPTS
PARAMS += --LDOPTS='$(LDOPTS)'
endif
ifdef LTO
PARAMS += --LTO='$(LTO)'
endif
ifdef DEPRECATED
PARAMS += --DEPRECATED='$(DEPRECATED)'
endif
ifdef SSE2
PARAMS += --SSE2='$(SSE2)'
endif
ifdef OPENMP
PARAMS += --OPENMP='$(OPENMP)'
endif
ifdef SEPARATE_BIN
PARAMS += --SEPARATE_BIN='$(SEPARATE_BIN)'
endif
ifdef PYTHON_EXECUTABLE
PARAMS += --PYTHON_EXECUTABLE='$(PYTHON_EXECUTABLE)'
endif
ifdef SHADOW_CHECK
PARAMS += --SHADOW_CHECK='$(SHADOW_CHECK)'
endif
ifdef STRIP_SYMBOLS
PARAMS += --STRIP_SYMBOLS='$(STRIP_SYMBOLS)'
endif
ifdef QT_HOME
PARAMS += --QT_HOME='$(QT_HOME)'
endif
ifdef SOURCES
PARAMS += --SOURCES='$(SOURCES)'
endif
ifdef SOURCEFILTER
PARAMS += --SOURCEFILTER='$(SOURCEFILTER)'
endif
ifdef FORCE_VERSION_COMPILE
PARAMS += --FORCE_VERSION_COMPILE='$(FORCE_VERSION_COMPILE)'
endif
ifdef PLATFORM
TARGET_PARAMS += --PLATFORM='$(PLATFORM)'
endif
ifdef PRECOMPILE
PARAMS += --precompile='$(PRECOMPILE)'
endif
ifdef DEBUG_DIR
PARAMS += --DEBUG_DIR='$(DEBUG_DIR)'
endif
ifdef DEBUG_ARGS
PARAMS += --DEBUG_ARGS='$(DEBUG_ARGS)'
endif
ifdef WEBASSEMBLY
PARAMS += --WEBASSEMBLY='$(WEBASSEMBLY)'
endif
ifdef SANITIZE
PARAMS += --SANITIZE='$(SANITIZE)'
endif
#-------------------------------------------------
# All scripts
#-------------------------------------------------
SCRIPTS = scripts/genie.lua \
scripts/src/lib.lua \
scripts/src/emu.lua \
scripts/src/machine.lua \
scripts/src/main.lua \
scripts/src/3rdparty.lua \
scripts/src/cpu.lua \
scripts/src/mame/frontend.lua \
scripts/src/osd/modules.lua \
$(wildcard scripts/src/osd/$(OSD)*.lua) \
scripts/src/sound.lua \
scripts/src/tools.lua \
scripts/src/tests.lua \
scripts/src/benchmarks.lua \
scripts/src/video.lua \
scripts/src/bus.lua \
scripts/src/netlist.lua \
scripts/src/formats.lua \
scripts/toolchain.lua \
scripts/src/osd/modules.lua \
$(wildcard src/osd/$(OSD)/$(OSD).mak) \
$(wildcard src/$(TARGET)/$(SUBTARGET_FULL).mak)
ifdef SOURCEFILTER
SCRIPTS += $(SOURCEFILTER)
else
ifndef SOURCES
ifdef PROJECT
SCRIPTS += projects/$(PROJECT)/scripts/target/$(TARGET)/$(SUBTARGET_FULL).lua
else
# A filter file can be used as an alternative
#SCRIPTS += scripts/target/$(TARGET)/$(SUBTARGET_FULL).lua
endif
endif
endif
ifdef REGENIE
SCRIPTS+= regenie
endif
#-------------------------------------------------
# Dependent stuff
#-------------------------------------------------
# extension for executables
EXE :=
ifeq ($(OS),windows)
EXE := .exe
endif
SHELLTYPE := msdos
ifeq (,$(ComSpec)$(COMSPEC))
SHELLTYPE := posix
endif
ifeq (/bin,$(findstring /bin,$(SHELL)))
SHELLTYPE := posix
endif
ifeq (/bin,$(findstring /bin,$(MAKESHELL)))
SHELLTYPE := posix
endif
ifeq (posix,$(SHELLTYPE))
MKDIR = $(SILENT) mkdir -p "$(1)"
COPY = $(SILENT) cp -fR "$(1)"/* "$(2)"
else
MKDIR = $(SILENT) mkdir "$(subst /,\\,$(1))" 2> nul || exit 0
COPY = $(SILENT) copy /Y "$(subst /,\\,$(1))" "$(subst /,\\,$(2))" > nul || exit 0
endif
GENDIR = $(BUILDDIR)/generated
# all sources are under the src/ directory
SRC = src
# all 3rd party sources are under the 3rdparty/ directory
3RDPARTY = 3rdparty
ifeq ($(SUBTARGET_FULL),mame)
PROJECT_NAME := $(SUBTARGET_FULL)
else ifeq ($(SUBTARGET_FULL),mess)
PROJECT_NAME := $(SUBTARGET_FULL)
else
PROJECT_NAME := $(TARGET)$(SUBTARGET_FULL)
endif
ifeq ($(OS),windows)
ifeq (posix,$(SHELLTYPE))
GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpfullversion 2> /dev/null)
CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1)
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
GIT_AVAILABLE := $(shell git --version > /dev/null 2>&1 && echo git)
else
GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpfullversion 2> NUL)