forked from yoshisuga/MAME4iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
1093 lines (811 loc) · 26 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
#
# Copyright (c) Nicola Salmoria and the MAME Team.
# Visit http://mamedev.org for licensing and usage restrictions.
#
###########################################################################
#http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
OSD = droid-ios
#OSD = osdmini
#OSD = sdl
NOWERROR = 1
#SUBTARGET = tiny
############ ANDROID
#ANDROID = 1
#AMIPS=1
#AX86=1
#AARMV7=1
#AARMV6=1
########## iOS
iOS = 1
iOSOSX = 1
iOSNOJAILBREAK = 1
#iOSSIMULATOR = 1
iOSARMV7=0
#iOSARMV7S=1
iOSARM64=1
################
CROSS_BUILD = 1
#TARGETOS = android
#PTR64 = 0
ifeq ($(iOSARMV7),1)
PTR64 = 0
else
PTR64 = 1
endif
X86_MIPS3_DRC =
X86_PPC_DRC =
FORCE_DRC_C_BACKEND = 1
OPTIMIZE = 1
ifdef ANDROID
ifdef AMIPS
MYPREFIX=/home/david/Projects/android/my-android-toolchain-r8-mips/bin/mipsel-linux-android-
BASE_DEV=/home/david/Projects/android/my-android-toolchain-r8-mips/sysroot
endif
ifdef AX86
MYPREFIX=/home/david/Projects/android/my-android-toolchain-r8-x86/bin/i686-android-linux-
BASE_DEV=/home/david/Projects/android/my-android-toolchain-r8-x86/sysroot
endif
ifdef AARMV6
MYPREFIX=/home/david/Projects/android/my-android-toolchain-r8/bin/arm-linux-androideabi-
BASE_DEV=/home/david/Projects/android/my-android-toolchain-r8/sysroot
endif
ifdef AARMV7
MYPREFIX=/home/david/Projects/android/my-android-toolchain-r8/bin/arm-linux-androideabi-
BASE_DEV=/home/david/Projects/android/my-android-toolchain-r8/sysroot
endif
#MYPREFIX=/home/david/Projects/android/my-android-toolchain-14-crystax/bin/arm-linux-androideabi-
#BASE_DEV=/home/david/Projects/android/my-android-toolchain-14-crystax/sysroot
endif
ifdef iOS
ifndef iOSOSX
##TOOLCHAIN
MYPREFIX=/home/david/Projects/iphone/toolchain/toolchain/pre/bin/arm-apple-darwin9-
BASE_DEV=/home/david/Projects/iphone/toolchain/sdks/iPhoneOS2.0.sdk
#BASE_DEV=/home/david/Projects/iphone/toolchain/sdks/iPhoneOS4.1.sdk
else
##OSX
ifndef iOSSIMULATOR
#MYPREFIX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-
#MYPREFIX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-
#MYPREFIX=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-
#MYPREFIX=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/
MYPREFIX=/usr/bin/
ifndef tvOS
BASE_DEV=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
else
BASE_DEV=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk
endif
else
MYPREFIX=/usr/bin/
#MYPREFIX=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/
BASE_DEV=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
endif
endif
endif
###########################################################################
################# BEGIN USER-CONFIGURABLE OPTIONS #####################
###########################################################################
#-------------------------------------------------
# specify core target: mame, mess, etc.
# specify subtarget: mame, mess, tiny, etc.
# build rules will be included from
# src/$(TARGET)/$(SUBTARGET).mak
#-------------------------------------------------
ifndef TARGET
TARGET = mame
endif
ifndef SUBTARGET
SUBTARGET = $(TARGET)
endif
#-------------------------------------------------
# specify OSD layer: windows, sdl, etc.
# build rules will be included from
# src/osd/$(OSD)/$(OSD).mak
#-------------------------------------------------
ifndef OSD
ifeq ($(OS),Windows_NT)
OSD = windows
TARGETOS = win32
else
OSD = sdl
endif
endif
ifndef CROSS_BUILD_OSD
CROSS_BUILD_OSD = $(OSD)
endif
#-------------------------------------------------
# specify OS target, which further differentiates
# the underlying OS; supported values are:
# win32, unix, macosx, os2
#-------------------------------------------------
ifndef TARGETOS
ifeq ($(OS),Windows_NT)
TARGETOS = win32
else
ifneq ($(CROSSBUILD),1)
ifneq ($(OS2_SHELL),)
TARGETOS = os2
else
UNAME = $(shell uname -a)
ifeq ($(firstword $(filter Linux,$(UNAME))),Linux)
TARGETOS = unix
endif
ifeq ($(firstword $(filter Solaris,$(UNAME))),Solaris)
TARGETOS = solaris
endif
ifeq ($(firstword $(filter FreeBSD,$(UNAME))),FreeBSD)
TARGETOS = freebsd
endif
ifeq ($(firstword $(filter GNU/kFreeBSD,$(UNAME))),GNU/kFreeBSD)
TARGETOS = freebsd
endif
ifeq ($(firstword $(filter OpenBSD,$(UNAME))),OpenBSD)
TARGETOS = openbsd
endif
ifeq ($(firstword $(filter Darwin,$(UNAME))),Darwin)
TARGETOS = macosx
endif
ifndef TARGETOS
$(error Unable to detect TARGETOS from uname -a: $(UNAME))
endif
# Autodetect PTR64
ifndef PTR64
ifeq ($(firstword $(filter x86_64,$(UNAME))),x86_64)
PTR64 = 1
endif
ifeq ($(firstword $(filter amd64,$(UNAME))),amd64)
PTR64 = 1
endif
ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64)
PTR64 = 1
endif
endif
# Autodetect BIGENDIAN
# MacOSX
ifndef BIGENDIAN
ifneq (,$(findstring Power,$(UNAME)))
BIGENDIAN=1
endif
# Linux
ifneq (,$(findstring ppc,$(UNAME)))
BIGENDIAN=1
endif
endif # BIGENDIAN
endif # OS/2
endif # CROSS_BUILD
endif # Windows_NT
endif # TARGET_OS
ifeq ($(TARGETOS),win32)
# Autodetect PTR64
ifndef PTR64
ifneq (,$(findstring mingw64-w64,$(PATH)))
PTR64=1
endif
endif
endif
#-------------------------------------------------
# configure name of final executable
#-------------------------------------------------
# uncomment and specify prefix to be added to the name
# PREFIX =
# uncomment and specify suffix to be added to the name
# SUFFIX =
#-------------------------------------------------
# specify architecture-specific optimizations
#-------------------------------------------------
# uncomment and specify architecture-specific optimizations here
# some examples:
# optimize for I686: ARCHOPTS = -march=pentiumpro
# optimize for Core 2: ARCHOPTS = -march=core2
# optimize for G4: ARCHOPTS = -mcpu=G4
# note that we leave this commented by default so that you can
# configure this in your environment and never have to think about it
# ARCHOPTS =
#-------------------------------------------------
# specify program options; see each option below
# for details
#-------------------------------------------------
# uncomment next line to build a debug version
# DEBUG = 1
# uncomment next line to include the internal profiler
# PROFILER = 1
# uncomment the force the universal DRC to always use the C backend
# you may need to do this if your target architecture does not have
# a native backend
# FORCE_DRC_C_BACKEND = 1
# uncomment next line to build using unix-style libsdl on Mac OS X
# (vs. the native framework port). Normal users should not enable this.
# MACOSX_USE_LIBSDL = 1
#-------------------------------------------------
# specify build options; see each option below
# for details
#-------------------------------------------------
# uncomment next line if you are building for a 64-bit target
# PTR64 = 1
# uncomment next line if you are building for a big-endian target
# BIGENDIAN = 1
# uncomment next line to build expat as part of MAME build
BUILD_EXPAT = 1
# uncomment next line to build zlib as part of MAME build
BUILD_ZLIB = 1
# uncomment next line to include the symbols
# SYMBOLS = 1
# specify symbols level or leave commented to use the default
# (default is SYMLEVEL = 2 normally; use 1 if you only need backtrace)
# SYMLEVEL = 2
# uncomment next line to dump the symbols to a .sym file
# DUMPSYM = 1
# uncomment next line to include profiling information from the compiler
# PROFILE = 1
# uncomment next line to generate a link map for exception handling in windows
# MAP = 1
# uncomment next line to generate verbose build information
# VERBOSE = 1
# specify optimization level or leave commented to use the default
# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
# OPTIMIZE = 3
###########################################################################
################## END USER-CONFIGURABLE OPTIONS ######################
###########################################################################
#-------------------------------------------------
# sanity check the configuration
#-------------------------------------------------
# specify a default optimization level if none explicitly stated
ifndef OPTIMIZE
ifndef SYMBOLS
OPTIMIZE = 3
else
OPTIMIZE = 0
endif
endif
OPTIMIZE = 1
# profiler defaults to on for DEBUG builds
ifdef DEBUG
ifndef PROFILER
PROFILER = 1
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
ifndef SYMLEVEL
SYMLEVEL = 1
endif
endif
# set the symbols level
ifdef SYMBOLS
ifndef SYMLEVEL
SYMLEVEL = 2
endif
endif
#-------------------------------------------------
# platform-specific definitions
#-------------------------------------------------
# extension for executables
EXE =
ifeq ($(TARGETOS),win32)
EXE = .exe
endif
ifeq ($(TARGETOS),os2)
EXE = .exe
endif
ifndef BUILD_EXE
BUILD_EXE = $(EXE)
endif
# compiler, linker and utilities
ifdef iOSOSX
AR = @$(MYPREFIX)ar
#CC = @$(MYPREFIX)gcc-4.2
#LD = @$(MYPREFIX)g++-4.2
CC = @$(MYPREFIX)gcc
LD = @$(MYPREFIX)g++
else
AR = @$(MYPREFIX)ar
CC = @$(MYPREFIX)cc
LD = @$(MYPREFIX)c++
endif
MD = -mkdir$(EXE)
RM = @rm -f
OBJDUMP = @objdump
#-------------------------------------------------
# form the name of the executable
#-------------------------------------------------
# reset all internal prefixes/suffixes
PREFIXSDL =
SUFFIX64 =
SUFFIXDEBUG =
SUFFIXPROFILE =
# Windows SDL builds get an SDL prefix
ifeq ($(OSD),sdl)
ifeq ($(TARGETOS),win32)
PREFIXSDL = sdl
endif
endif
# 64-bit builds get a '64' suffix
ifeq ($(PTR64),1)
SUFFIX64 = 64
endif
# debug builds just get the 'd' suffix and nothing more
ifdef DEBUG
SUFFIXDEBUG = d
endif
# gprof builds get an addition 'p' suffix
ifdef PROFILE
SUFFIXPROFILE = p
endif
# the name is just 'target' if no subtarget; otherwise it is
# the concatenation of the two (e.g., mametiny)
ifeq ($(TARGET),$(SUBTARGET))
NAME = $(TARGET)
else
NAME = $(TARGET)$(SUBTARGET)
endif
# fullname is prefix+name+suffix+suffix64+suffixdebug
FULLNAME = $(PREFIX)$(PREFIXSDL)$(NAME)$(SUFFIX)$(SUFFIX64)$(SUFFIXDEBUG)$(SUFFIXPROFILE)
# add an EXE suffix to get the final emulator name
ifdef iOSNOJAILBREAK
ifdef iOSSIMULATOR
EMULATOR = libmamesim.a
endif
ifeq ($(iOSARMV7),1)
EMULATOR = libmamearmv7.a
else
ifdef tvOS
EMULATOR = libmamearm64-tvos.a
else
EMULATOR = libmamearm64.a
endif
endif
ifdef iOSARMV7S
EMULATOR = libmamearmv7s.a
endif
else
EMULATOR = $(FULLNAME)$(EXE)
endif
#-------------------------------------------------
# source and object locations
#-------------------------------------------------
# all sources are under the src/ directory
SRC = src
# build the targets in different object dirs, so they can co-exist
OBJ = obj/$(OSD)/$(FULLNAME)
#-------------------------------------------------
# compile-time definitions
#-------------------------------------------------
# CR/LF setup: use both on win32/os2, CR only on everything else
DEFS = -DCRLF=2
ifeq ($(TARGETOS),win32)
DEFS = -DCRLF=3
endif
ifeq ($(TARGETOS),os2)
DEFS = -DCRLF=3
endif
# map the INLINE to something digestible by GCC
DEFS += -DINLINE="static inline"
# define LSB_FIRST if we are a little-endian target
ifndef BIGENDIAN
DEFS += -DLSB_FIRST
endif
# define PTR64 if we are a 64-bit target
ifeq ($(PTR64),1)
DEFS += -DPTR64
endif
# define MAME_DEBUG if we are a debugging build
ifdef DEBUG
DEFS += -DMAME_DEBUG
else
DEFS += -DNDEBUG
endif
# define MAME_PROFILER if we are a profiling build
ifdef PROFILER
DEFS += -DMAME_PROFILER
endif
#-------------------------------------------------
# compile flags
# CCOMFLAGS are common flags
# CONLYFLAGS are flags only used when compiling for C
# CPPONLYFLAGS are flags only used when compiling for C++
# COBJFLAGS are flags only used when compiling for Objective-C(++)
#-------------------------------------------------
# start with empties for everything
CCOMFLAGS =
CONLYFLAGS =
COBJFLAGS =
CPPONLYFLAGS =
# CFLAGS is defined based on C or C++ targets
# (remember, expansion only happens when used, so doing it here is ok)
CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
# we compile C-only to C89 standard with GNU extensions
# we compile C++ code to C++98 standard with GNU extensions
CONLYFLAGS += -std=gnu89
CPPONLYFLAGS += -x c++ -stdlib=libc++
#COBJFLAGS += -x objective-c++
COBJFLAGS += -x objective-c
# this speeds it up a bit by piping between the preprocessor/compiler/assembler
CCOMFLAGS += -pipe
# add -g if we need symbols, and ensure we have frame pointers
ifdef SYMBOLS
CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer
endif
# add -v if we need verbose build information
ifdef VERBOSE
CCOMFLAGS += -v
endif
# add profiling information for the compiler
ifdef PROFILE
CCOMFLAGS += -pg
endif
# add the optimization flag
CCOMFLAGS += -O$(OPTIMIZE)
# if we are optimizing, include optimization options
# and make all errors into warnings
ifneq ($(OPTIMIZE),0)
ifneq ($(TARGETOS),os2)
ifndef NOWERROR
CCOMFLAGS += -Werror -fno-strict-aliasing $(ARCHOPTS)
else
CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
endif
else
CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
endif
endif
# add a basic set of warnings
CCOMFLAGS += \
-Wformat -Wformat-security \
-Wwrite-strings \
-Wno-sign-compare \
# -Wundef \
# -Wall \
# -Wcast-align \
# warnings only applicable to C compiles
CONLYFLAGS += \
-Wpointer-arith \
-Wbad-function-cast \
-Wstrict-prototypes
# warnings only applicable to OBJ-C compiles
COBJFLAGS += \
-Wpointer-arith
#-------------------------------------------------
# include paths
#-------------------------------------------------
#CCOMFLAGS += -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/usr/include
# add core include paths
CCOMFLAGS += \
-I$(SRC)/$(TARGET) \
-I$(OBJ)/$(TARGET)/layout \
-I$(SRC)/emu \
-I$(OBJ)/emu \
-I$(OBJ)/emu/layout \
-I$(SRC)/lib/util \
-I$(SRC)/osd \
-I$(SRC)/osd/$(OSD) \
ifdef iOS
CCOMFLAGS += \
-iquote$(SRC)/../iOS/btstack \
-iquote$(SRC)/../iOS
endif
#-------------------------------------------------
# archiving flags
#-------------------------------------------------
# Default to something reasonable for all platforms
ARFLAGS = -cr
# Deal with macosx brain damage if COMMAND_MODE is in
# the luser's environment:
ifeq ($(TARGETOS),macosx)
ifeq ($(COMMAND_MODE),"legacy")
ARFLAGS = -crs
endif
endif
#-------------------------------------------------
# linking flags
#-------------------------------------------------
# LDFLAGS are used generally; LDFLAGSEMULATOR are additional
# flags only used when linking the core emulator
LDFLAGS =
ifneq ($(TARGETOS),macosx)
ifneq ($(TARGETOS),os2)
ifneq ($(TARGETOS),solaris)
#LDFLAGS = -Wl,--warn-common
endif
endif
endif
LDFLAGSEMULATOR =
# add profiling information for the linker
ifdef PROFILE
LDFLAGS += -pg
endif
# strip symbols and other metadata in non-symbols and non profiling builds
ifndef SYMBOLS
ifneq ($(TARGETOS),macosx)
LDFLAGS += -s
endif
endif
# output a map file (emulator only)
ifdef MAP
LDFLAGSEMULATOR += -Wl,-Map,$(FULLNAME).map
endif
#-------------------------------------------------
# define the standard object directory; other
# projects can add their object directories to
# this variable
#-------------------------------------------------
OBJDIRS = $(OBJ)
#-------------------------------------------------
# define standard libarires for CPU and sounds
#-------------------------------------------------
#LIBEMU = $(OBJ)/libemu.a
#LIBCPU = $(OBJ)/libcpu.a
#LIBDASM = $(OBJ)/libdasm.a
#LIBSOUND = $(OBJ)/libsound.a
#LIBUTIL = $(OBJ)/libutil.a
#LIBOCORE = $(OBJ)/libocore.a
#LIBOSD = $(OBJ)/libosd.a
VERSIONOBJ = $(OBJ)/version.o
#-------------------------------------------------
# either build or link against the included
# libraries
#-------------------------------------------------
# start with an empty set of libs
LIBS =
# add expat XML library
ifeq ($(BUILD_EXPAT),1)
CCOMFLAGS += -I$(SRC)/lib/expat
EXPAT = $(OBJ)/libexpat.a
else
LIBS += -lexpat
EXPAT =
endif
# add ZLIB compression library
ifeq ($(BUILD_ZLIB),1)
CCOMFLAGS += -I$(SRC)/lib/zlib
ZLIB = $(OBJ)/libz.a
else
LIBS += -lz
ZLIB =
endif
# add SoftFloat floating point emulation library
SOFTFLOAT = $(OBJ)/libsoftfloat.a
ifdef ANDROID
CCOMFLAGS += --sysroot $(BASE_DEV)
CCOMFLAGS += -DANDROID
CCOMFLAGS += -fpic
ifdef AARMV7
CCOMFLAGS += -march=armv7-a -mfloat-abi=softfp -DARMV7
#CCOMFLAGS += -mfpu=neon
#CCOMFLAGS += -pipe -mtune=cortex-a9
LDFLAGS += -Wl,--fix-cortex-a8
endif
ifdef AARMV6
LDFLAGS += -Wl,--fix-cortex-a8
endif
CCOMFLAGS += -Wno-psabi
LDFLAGS += -llog -lgcc
LDFLAGS += -Wl,-soname,libMAME4droid.so -shared
LDFLAGS += -lc -lm
CCOMFLAGS += -fsigned-char -finline
#CCOMFLAGS += -fno-common -fno-builtin
#CCOMFLAGS += -Wno-sign-compare -Wunused -Wpointer-arith -Wcast-align -Waggregate-return -Wshadow
CCOMFLAGS += -ffast-math -fsingle-precision-constant
#CCOMFLAGS += -falign-functions=16
#CCOMFLAGS += -fsched-spec-load -fmodulo-sched -ftracer -funsafe-loop-optimizations -Wunsafe-loop-optimizations -fvariable-expansion-in-unroller
#CCOMFLAGS += -mstructure-size-boundary=32 -mthumb-interwork
#CCOMFLAGS += -fexceptions -frtti
#LDFLAGS += -lstdc++
endif
ifdef iOS
#CFLAGS += -isysroot $(BASE_DEV)
#CCOMFLAGS += --sysroot $(BASE_DEV)
CCOMFLAGS += -DIOS
###
#CCOMFLAGS += -fno-short-enums
#CCOMFLAGS += -fshort-enums
###
ifndef iOSNOJAILBREAK
CCOMFLAGS += -DBTJOY -DJAILBREAK
endif
ifndef iOSOSX
CCOMFLAGS += -DIOS3
CCOMFLAGS += -F/home/david/Projects/iphone/toolchain/sdks/iPhoneOS3.1.2.sdk/System/Library/PrivateFrameworks
else #OSX
#CFLAGS += -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk
CCOMFLAGS += -F$(BASE_DEV)/System/Library/PrivateFrameworks
CCOMFLAGS += -F$(BASE_DEV)/System/Library/Frameworks
CCOMFLAGS += -I$(BASE_DEV)/usr/include
#CCOMFLAGS += -I$(BASE_DEV)/include/c++/4.2.1/armv7-apple-darwin10/
#CCOMFLAGS += -march=armv7-a -mfloat-abi=softfp -DARMV7
#CCOMFLAGS += -march=armv7s -DARMV7
ifndef iOSSIMULATOR
ifeq ($(iOSARMV7),1)
CCOMFLAGS += -arch armv7
LDFLAGS += -arch armv7
else ifeq ($(iOSARM64),1)
CCOMFLAGS += -arch arm64
LDFLAGS += -arch arm64
else
CCOMFLAGS += -arch armv7s
LDFLAGS += -arch armv7s
endif
ifdef tvOS
CCOMFLAGS += -mtvos-version-min=9.0 -fembed-bitcode -ffast-math -fomit-frame-pointer -fstrict-aliasing \
-fexpensive-optimizations \
-arch=arm64 \
-O3 \
-fweb -frename-registers -falign-functions=16 -falign-loops -falign-labels -falign-jumps \
-finline -finline-functions -fno-common -fno-builtin -fsingle-precision-constant \
-Wno-sign-compare -Wunused -Wpointer-arith -Wcast-align -Waggregate-return -Wshadow
else
CCOMFLAGS += -miphoneos-version-min=5.0
endif
#LDFLAGS += -march=armv7s
#LDFLAGS += -march=armv7-a
#LDFLAGS += -ios_version_min 5.0
#CCOMFLAGS += -x objective-c
else
CCOMFLAGS += -arch i386
#CCOMFLAGS += -mios-simulator-version-min=6.0
CCOMFLAGS += -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000
#CCOMFLAGS += -x objective-c -fmessage-length=0 -Wno-trigraphs -fasm-blocks -O0 -Wreturn-type -Wunused-variable -fexceptions -fvisibility=hidden -fvisibility-inlines-hidden -mmacosx-version-min=10.6 -fpascal-strings -gdwarf-2 -fobjc-legacy-dispatch -fobjc-abi-version=2
LDFLAGS += -arch i386
endif
endif
LDFLAGS += -framework Foundation -framework CoreFoundation -framework UIKit -framework QuartzCore -framework CoreGraphics -framework AudioToolbox -framework GameKit -framework CoreBluetooth
LDFLAGS += -F$(BASE_DEV)/System/Library/Frameworks
LDFLAGS += -F$(BASE_DEV)/System/Library/PrivateFrameworks
LDFLAGS += -L$(BASE_DEV)/usr/lib
LDFLAGS += -L$(BASE_DEV)/usr/lib/system
LDFLAGS += -lobjc -lpthread -bind_at_load
LDFLAGS += -L./lib/
ifndef iOSNOJAILBREAK
#LDFLAGS += -lBTstack
LDFLAGS += -weak_library ./lib/libBTstack.dylib
endif
CCOMFLAGS += -ffast-math -fsingle-precision-constant
#LDFLAGS += -static
endif
#-------------------------------------------------
# 'default' target needs to go here, before the
# include files which define additional targets
#-------------------------------------------------
default: maketree buildtools emulator
#all: default tools
all: default
#-------------------------------------------------
# defines needed by multiple make files
#-------------------------------------------------
BUILDSRC = $(SRC)/build
BUILDOBJ = $(OBJ)/build
BUILDOUT = $(BUILDOBJ)
#-------------------------------------------------
# include the various .mak files
#-------------------------------------------------
# include OSD-specific rules first
include $(SRC)/osd/$(OSD)/$(OSD).mak
# then the various core pieces
include $(SRC)/$(TARGET)/$(SUBTARGET).mak
include $(SRC)/emu/emu.mak
include $(SRC)/lib/lib.mak
include $(SRC)/build/build.mak
-include $(SRC)/osd/$(CROSS_BUILD_OSD)/build.mak
include $(SRC)/tools/tools.mak
ifdef iOS
ifndef iOSNOJAILBREAK
include $(SRC)/../iOS/objc.mak
else
#include $(SRC)/../iOS/objc_njb.mak
endif
endif
# combine the various definitions to one
CDEFS = $(DEFS)
#-------------------------------------------------
# primary targets
#-------------------------------------------------
emulator: maketree $(BUILD) $(EMULATOR)
buildtools: maketree $(BUILD)
tools: maketree $(TOOLS)
maketree: $(sort $(OBJDIRS))
clean: $(OSDCLEAN)
@echo Deleting object tree $(OBJ)...
$(RM) -r $(OBJ)
@echo Deleting $(EMULATOR)...
$(RM) $(EMULATOR)
@echo Deleting $(TOOLS)...
$(RM) $(TOOLS)
ifdef MAP
@echo Deleting $(FULLNAME).map...
$(RM) $(FULLNAME).map
endif
checkautodetect:
@echo TARGETOS=$(TARGETOS)
@echo PTR64=$(PTR64)
@echo BIGENDIAN=$(BIGENDIAN)
@echo UNAME="$(UNAME)"
#-------------------------------------------------
# directory targets
#-------------------------------------------------
$(sort $(OBJDIRS)):
$(MD) -p $@
#$(OBJ)/build/file2str$(EXE):
# mkdir -p $(OBJ)/build
# cp -t $(OBJ)/build prec-build/file2str$(EXE)
#$(OBJ)/build/m68kmake$(EXE):
# cp -t $(OBJ)/build prec-build/m68kmake$(EXE)
#$(OBJ)/build/tmsmake$(EXE):
# cp -t $(OBJ)/build prec-build/tmsmake$(EXE)
#$(OBJ)/build/png2bdc$(EXE):
# cp -t $(OBJ)/build prec-build/png2bdc$(EXE)