-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmakefile
1857 lines (1548 loc) · 44.1 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
########################################
## ##
## RAINE ##
## ##
########################################
##
## type make RAINECPS=1 to build rainecps
## The default is to build a dynamic version. Use make STATIC=1 to build a
## static version.
##
## Requirements: read the docs !
##
# version (when the version increases, raine shows the issue dialog on
# startup
VERSION = "0.97.4"
# Comment out if you don't want the debug features
# RAINE_DEBUG = 1
# Be verbose ?
# VERBOSE = 1
# Uncomment to use clang instead of gcc.
# It works, it produces more warnings for the debug builds which allowed me to fix a few things.
# I don't know if it produces a faster binary in optimized build... !
# You'll need clang and clang++ of course, tested in 32 bits debug and optimized builds
# USE_CLANG=1
# use curl to try to get unavailable roms from rom archive ?
# curl is a nice idea, the problem is that it requires a ton of dlls in
# windows
# so it might be a good idea to make a build without it...
USE_CURL = 1
# Use musashi ?
# 1 = 68020
# 2 = 68000 + 68020
# set to 2 if NO_ASM is defined
# USE_MUSASHI = 2
# use mame z80 ?
# MAME_Z80 = 1
# use mame 6502 ?
# MAME_6502 = 1
# use gens sh2 (32 bits only, asm).
GENS_SH2 = 1
# For osx : use frameworks or brew shared libs ?
# Actually frameworks are a convenience for end users, to build them use
# the make_framework.pl script in TOOLS directory to convert the brew
# shared libs to frameworks and then define FRAMEWORK here
# FRAMEWORK = 1
# Disable all asm. This will also disable the asm_video_core of
# course
# NO_ASM = 1
# Use asm video core ? (comment to use C core)
ASM_VIDEO_CORE = 1
# console ?
# Notice that if you disable this, you also loose all the cheats !
HAS_CONSOLE = 1
# target build for cross compilation, the 2 defaults are for mingw32, 32
# and 64 bits. You can't build both at the same time, make a choice !
# Defining this allws to use ${target}-gcc for the compiler and includes
# from /usr/${target}/include, libs in /usr/${target}/lib
# choosing x86_64 here sets NO_ASM to 1 automatically.
# target=i686-w64-mingw32
# target=x86_64-w64-mingw32
# target=i686-pc-msdosdjgpp
# which lib to use :
# SDL = 1 or SDL = 2, or comment the line for allegro
SDL = 2
# compile bezels (artwork) support ? (ignored if building neocd)
# This option hasn't been tested for ages, not sure it still works
# better leave it commented for now until really tested.
# USE_BEZELS=1
# end of user options, after this line the real thing starts...
ifdef target
CROSSCOMPILE = 1
# I don't think anyone would want another native here ?
NATIVE=linux-gnu-sdl
ifeq (${SDL},2)
ifeq ("${target}","x86_64-w64-mingw32")
NATIVE = linux-gnu-sdl2
else
NATIVE = linux-gnu-sdl2-asm
endif
endif
ifeq ("${target}","x86_64-w64-mingw32")
NO_ASM = 1
undefine GENS_SH2
endif
endif
ifeq ("${MSYSTEM}","MINGW64")
NO_ASM = 1
undefine GENS_SH2
MINGDIR = 1
RAINE32 = 1
OSTYPE = mingw64
endif
ifeq ("${MSYSTEM}","MINGW32")
MINGDIR = 1
RAINE32 = 1
OSTYPE = mingw32
endif
ifdef NO_ASM
ASM_VIDEO_CORE =
GENS_SH2 =
MAME_Z80 = 1
MAME_6502 = 1
USE_MUSASHI = 2
endif
ifeq ("$(shell uname)","Linux")
OSTYPE=linux-gnu
endif
ifeq ("$(shell uname)","FreeBSD")
OSTYPE=linux-gnu
endif
ifndef CC
CC=cc
endif
ifdef target
CC=${target}-gcc
CXX=${target}-g++
INCDIR = -I/usr/${target}/include
else
ifdef USE_CLANG
CC=clang
CXX=clang++
else
CC=gcc
CXX=g++
endif
endif
ifndef PKG_CONFIG
PKG_CONFIG := pkg-config
endif
lua :=$(shell if $(PKG_CONFIG) --exists lua; then echo lua; fi)
ifndef lua
lua :=$(shell if $(PKG_CONFIG) --exists lua5.4; then echo lua5.4; fi)
endif
ifndef lua
lua :=$(shell if $(PKG_CONFIG) --exists lua5.3; then echo lua5.3; fi)
endif
# probably not necessary to search any further, but maybe some systems have packages of the form lua-version
# in this case they'll have to change the makefile !
cflags_lua := $(shell $(PKG_CONFIG) --cflags $(lua))
lflags_lua := $(shell $(PKG_CONFIG) --libs $(lua))
ifeq ("$(shell uname)","Darwin")
# Mac os X
DARWIN=1
OSTYPE=darwin
# no need to make a 32 bit binary if disabling asm completely !
ifeq ("$(shell sysctl hw.optional.x86_64)","hw.optional.x86_64: 1")
ifndef NO_ASM
CC += -m32
CXX += -m32
LD=$(CXX) -m32
else
LD=$(CXX)
endif
endif
endif # darwin
ifeq ("$(OSTYPE)","msys")
MINGDIR=1
OSTYPE=mingw32
endif
ifeq ($(shell echo ${target}|sed 's/.*mingw.*/mingw/'),mingw)
MINGDIR=1
OSTYPE=mingw32
endif
ifndef DARWIN
ifeq ("$(shell uname -m)","x86_64")
# autodetect x86_64 arch, and in this case build for 32 bit arch
# notice that you still need to make a symbolic link for libstdc++.so to
# libstdc++.so.6, and make sure that the 32 bit version of all the libraries
# are installed in 32 bit (which might be a little tricky at first).
ifndef CROSSCOMPILE
ifndef NO_ASM
CC += -m32
CXX += -m32
LD=$(CXX) -L /usr/lib32
else
LD=$(CXX)
endif
else
ifeq ("$(LD)","ld")
LD = $(CXX)
endif
endif
else
ifeq ("$(LD)","ld")
LD=$(CXX)
endif
endif
endif
WINDRES_V := $(shell windres --version 2>/dev/null)
ifdef WINDRES_V
WINDRES:=windres
else
WINDRES:=$(target)-windres
endif
NASM_V := $(shell nasm -v 2>/dev/null)
ifndef NASM_V
ifdef VERBOSE
ASM=nasmw
else
ASM=@nasmw
endif
else
ifdef VERBOSE
ASM=nasm
else
ASM=@nasm
endif
endif
NASM_V := $(shell nasm -v 2>/dev/null)
ifdef mingdir
MINGDIR=1
endif
ifdef MINGDIR
# mingw
RAINE32 = 1
ifndef OSTYPE
OSTYPE = mingw32
endif
endif
RM = @rm -f
# This test is for stupid win32 gcc ports with bad defaults
ifdef VERBOSE
CCV=$(CC)
CXXV=$(CXX)
LDV=$(LD)
else
CCV=@$(CC)
CXXV=@$(CXX)
LDV=@$(LD)
endif
ifdef RAINE_DEBUG
# I don't see any reason why not to use this for all debug builds from
# now on...
ifdef RAINE_DOS
# -fsanitize=address doesn't work with djgpp because there is no libasan, so you can't link a program using these options
# so I keep memwatch for dos at least
USE_MEMWATCH = 1
endif
endif
GCC_MAJOR := $(shell echo $(CC) -dumpversion|sed 's/\..*//')
GCC_MINOR := $(shell $(CC) -dumpversion|sed 's/.\.\(.\)\..*/\1/')
GCC_PATCH := $(shell $(CC) -dumpversion|sed 's/.*\.//')
MD = @mkdir
# error logging (djgpp - old stuff)
# CC = redir -ea errorlog.txt gcc
# profiling
# CC = gcc -pg
INCDIR += \
-Isource \
-Isource/68000 \
-Isource/sound \
-Isource/games \
-Isource/video \
-Isource/mini-unzip \
-Isource/mame \
-Isource/6502 \
-Isource/m68705
INCDIR += -Isource/z80
INCDIR += -Isource/68020
ifeq ($(OSTYPE),cygwin)
# Cygwin
RAINE_EXE = raine32.exe
# -O1 is necessary for stupid hq2x16.asm
AFLAGS = -f coff -O1 -D__RAINE__ -DRAINE_WIN32
RAINE32 = 1
DEFINE = -D__RAINE__ \
-DRAINE_WIN32 \
PNG_LFLAGS = "$(shell libpng-config --ldflags)"
PNG_STATIC_LFLAGS = "$(shell libpng-config --static --ldflags)"
LIBS = -lz -lalleg $(PNG_LFAGS)
LIBS_STATIC = -lz -lalleg_s -lkernel32 -luser32 -lgdi32 -lcomdlg32 \
-lole32 -ldinput -lddraw -ldxguid -lwinmm -ldsound \
-L/lib/mingw -lmoldname -lmsvcrt $(PNG_STATIC_LFLAGS)
LIBS_DEBUG = -lz -lalld $(PNG_LFLAGS)
LFLAGS = -mno-cygwin -mwindows
else
ifdef RAINE32
# MINGW32
ifdef NO_ASM
RAINE_EXE = raine.exe
else
RAINE_EXE = raine32.exe
endif
ifdef CROSSCOMPILE
ASM = @nasm
MD = @mkdir
else
ifndef ASM
ASM = @nasm.exe # auto-detection broken for mingw !!!
endif
MD = @mkdir.exe # to avoid the built-in command... strange it's necessary...
endif
AFLAGS = -f coff -O1 -D__RAINE__ \
-DRAINE_WIN32
ifdef target
PNG_CFLAGS = "$(shell /usr/${target}/bin/libpng-config --cflags)"
PNG_LFLAGS = $(shell /usr/${target}/bin/libpng-config --ldflags)
PNG_STATIC_LFLAGS = "$(shell /usr/${target}/bin/libpng-config --static --ldflags)"
else
PNG_CFLAGS = "$(shell libpng-config --cflags)"
PNG_LFLAGS = $(shell libpng-config --ldflags)
PNG_STATIC_LFLAGS = "$(shell libpng-config --static --ldflags)"
endif
DEFINE = -D__RAINE__ \
-DRAINE_WIN32 \
LIBS = $(PNG_LFLAGS) -lopengl32 -lz
LIBS_STATIC = -lz $(PNG_STATIC_LFLAGS)
INCDIR += $(PNG_CFLAGS)
LIBS_DEBUG = -lz $(PNG_LFLAGS) -lopengl32
ifndef SDL
LIBS += -lalleg
LIBS_STATIC += -lalleg_s -lkernel32 -luSer32 -lgdi32 -lcomdlg32 \
-lole32 -ldinput -lddraw -ldxguid -lwinmm -ldsound
LIBS_DEBUG += -lalld
endif
ifndef RAINE_DEBUG
# this one hides the console in windows
LFLAGS = -mwindows
endif
else
ifeq ("${target}","i686-pc-msdosdjgpp")
RAINE_EXE = Raine.exe
RAINE_DOS = 1
undefine SDL
ifdef CROSSCOMPILE
ASM = @nasm
else
ASM = @nasmw.exe # auto-detection broken for djgpp !!!
endif
OSTYPE = dos
HAS_CONSOLE =
AFLAGS = -f coff -O1 -D__RAINE__ \
-DRAINE_DOS
DEFINE = -D__RAINE__ \
-DRAINE_DOS
LIBS = -lalleg -lpng -lz -lm
LIBS_DEBUG = -lalleg -lpng -lz -lm
ifdef RAINE_DEBUG
LFLAGS = -Xlinker -Ttext -Xlinker 0x68000
else
LFLAGS = -Xlinker -Ttext -Xlinker 0x4000
endif
else
# linux
ifdef DARWIN
DESTDIR = Raine.app
prefix = $(DESTDIR)/Contents
bindir = $(prefix)/MacOS
sharedir = $(prefix)/Resources
mandir = $(prefix)/man/man6
rainedata = $(sharedir)
else
prefix = $(DESTDIR)/usr
bindir = $(prefix)/games
sharedir = $(prefix)/share/games
mandir = $(prefix)/man/man6
rainedata = $(sharedir)/raine
endif
ifndef SDL
langdir = $(rainedata)/languages
else
bitmaps_dir = $(rainedata)/bitmaps
shaders_dir = $(rainedata)/shaders
fonts_dir = $(rainedata)/fonts
langdir = $(rainedata)/locale
scripts_dir = $(rainedata)/scripts
# bld_dir = $(rainedata)/blend
endif
romdir = $(rainedata)/roms
artdir = $(rainedata)/artwork
emudxdir = $(rainedata)/emudx
RAINE_EXE = raine
RAINE_DAT = raine.dat
RAINE_LNG = brasil.cfg dansk.cfg espanol.cfg french2.cfg german2.cfg japanese.cfg spanish.cfg turkish.cfg catala.cfg dutch.cfg euskera.cfg french.cfg german.cfg polish.cfg svenska.cfg czech.cfg english.cfg finnish.cfg galego.cfg italian.cfg portugal.cfg template.cfg
RAINE_UNIX = 1
ifdef VERBOSE
INSTALL = /usr/bin/install
else
INSTALL = @install
endif
INSTALL_BIN = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644
RD = rmdir --ignore-fail-on-non-empty
CD = cd
AFLAGS = -f elf -O1 -D__RAINE__ \
-DRAINE_UNIX
PNG_CFLAGS = "$(shell libpng-config --cflags)"
ifndef SDL
ALLEGRO_CFLAGS = "$(shell allegro-config --cflags)"
endif
INCDIR += $(PNG_CFLAGS) $(ALLEGRO_CFLAGS)
DEFINE = -D__RAINE__ \
-DRAINE_UNIX
ifdef USE_MEMWATCH
DEFINE += -DMEMWATCH -DMW_STDIO
endif
ifndef SDL
LIBS = -lz $(shell allegro-config --libs) $(shell libpng-config --ldflags) -lm
LIBS_DEBUG = -lz $(shell allegro-config --libs ) $(shell libpng-config --ldflags) -lm
LIBS_STATIC = -lz $(shell allegro-config --static) $(shell libpng-config --static --ldflags) -lm
else
ifdef DARWIN
LIBS = -lz /usr/local/lib/libpng.a -lm
LIBS_DEBUG = -lz /usr/local/lib/libpng.a -lm
LIBS_STATIC = -lz /usr/local/lib/libpng.a -lm
else
LIBS = -lz $(shell libpng-config --ldflags) -lm
LIBS_DEBUG = -lz $(shell libpng-config --ldflags) -lm
LIBS_STATIC = -lz $(shell libpng-config --static --ldflags) -lm
endif
ifndef DARWIN
LIBS += -lGL
LIBS_DEBUG += -lGL -lGLU
endif
endif
ifndef SDL
ifeq ("$(shell if [ -e /usr/include/vga.h ] || [ -e /usr/local/include/vga.h ]; then echo yes; fi)","yes")
GFX_SVGALIB=1
endif
endif
ifdef GFX_SVGALIB
LIBS += -lvga
LIBS_DEBUG += -lvga
LIBS_STATIC += -lvga
endif # GFX_SVGALIB
endif # linux / mingw32
endif # djgpp
endif # if OSTYPE == cygwin
ifdef RAINE_DEBUG
ifndef SDL
INCDIR += -Isource/alleg/debug
endif
endif
ifeq (${SDL},1)
SDLCONFIG = "sdl-config"
else
SDLCONFIG = "sdl2-config"
endif
ifndef VERBOSE
ASM := @$(ASM)
endif
# Uncomment if you want to use the SEAL audio library (linux, dos or win32)
# seal is dead since the end of 1998, and it's not actievely maintained anymore in raine,
# so expect problems if you enable this.
# In dos seal is better to handle pci soundcards.
ifdef RAINE_DOS
# SEAL = 1
endif
ifdef SEAL
LIBS += -laudio
LIBS_DEBUG += -laudio
LIBS_STATIC += -laudio
ifdef RAINE32
LIBS += -lmsvcrt \
-lkernel32 -lwinmm \
-lole32 -luser32 \
-ldsound
endif
endif
ifdef SDL
ifeq (${SDL},2)
# gui is an implicit include directory with sdl1, it must become explicit here for the files which moved to the sdl2 directory
INCDIR += -Isource/sdl2 -Isource/sdl2/gui -Isource/sdl/gui -Isource/sdl2/SDL_gfx -Isource/sdl/SDL_gfx -Isource/sdl2/sdl_sound
endif
INCDIR += -Isource/sdl
else
INCDIR += -Isource/alleg/gui
endif
# To allow cross-compilation, we need one dir / target
OBJDIR = $(OSTYPE)
ifdef SDL
OBJDIR = ${OSTYPE}-sdl
ifeq (${SDL},2)
OBJDIR = ${OSTYPE}-sdl2
endif
endif
ifndef NO_ASM
OBJDIR := $(OBJDIR)-asm
ifndef RAINE_DOS
include cpuinfo
else
_MARCH=-march=pentium -mtune=pentium
CPU=pentium
endif
endif
ifdef X86_64
OBJDIR := $(OBJDIR)64
endif
ifeq "$(RAINE32) $(STATIC) $(SDL)" "1 1 "
# Windows need a separate object dir for the static version (for allegro)
OBJDIR := $(OBJDIR)/static
else
OBJDIR := $(OBJDIR)/object
endif
ifdef RAINE_DEBUG
OBJDIR := $(OBJDIR)d
endif
ifdef ASM_VIDEO_CORE
VIDEO_CORE = $(OBJDIR)/video/i386
else
VIDEO_CORE = $(OBJDIR)/video/c
endif
OBJDIRS=$(OBJDIR) \
$(OBJDIR)/mame \
$(OBJDIR)/sound \
$(OBJDIR)/68000 \
$(OBJDIR)/video \
$(OBJDIR)/video/c \
$(OBJDIR)/video/i386 \
$(OBJDIR)/video/i386/newspr2 \
$(VIDEO_CORE)/blit_x2 \
$(OBJDIR)/mini-unzip \
$(OBJDIR)/7z \
$(OBJDIR)/video/i386/packed \
$(VIDEO_CORE)/str \
$(OBJDIR)/video/zoom \
$(OBJDIR)/math \
$(OBJDIR)/games \
$(OBJDIR)/6502 \
$(OBJDIR)/m68705 \
$(OBJDIR)/neocd \
locale/fr/LC_MESSAGES \
locale/es/LC_MESSAGES \
locale/pt_BR/LC_MESSAGES \
locale/it/LC_MESSAGES
OBJDIRS += $(OBJDIR)/z80
OBJDIRS += $(OBJDIR)/mame/z80
OBJS += $(OBJDIR)/mame/z80/z80dasm.o
ifdef MAME_Z80
DEFINE += -DMAME_Z80
endif
OBJDIRS += $(OBJDIR)/mame/6502
OBJS += $(OBJDIR)/mame/6502/6502dasm.o
ifdef MAME_6502
DEFINE += -DMAME_6502
endif
OBJDIRS += $(OBJDIR)/Musashi
OBJS += $(OBJDIR)/Musashi/m68kdasm.o
ifdef GENS_SH2
OBJDIRS += $(OBJDIR)/gens_sh2
endif
OBJDIRS += $(OBJDIR)/mame/sh2
OBJDIRS += $(OBJDIR)/68020
ifdef SDL
OBJDIRS += \
$(OBJDIR)/sdl \
$(OBJDIR)/sdl/SDL_gfx \
$(OBJDIR)/sdl/gui \
$(OBJDIR)/sdl/dialogs \
$(OBJDIR)/sdl/console
ifeq (${SDL},2)
OBJDIRS += $(OBJDIR)/sdl2 \
$(OBJDIR)/sdl2/SDL_gfx \
$(OBJDIR)/sdl2/sdl_sound \
$(OBJDIR)/sdl2/gui
endif
else
OBJDIRS += $(OBJDIR)/alleg \
$(OBJDIR)/alleg/png
ifdef RAINE_DEBUG
OBJDIRS += $(OBJDIR)/alleg/debug \
$(OBJDIR)/alleg/debug/dz80
endif
endif
ifdef SEAL
OBJDIRS += $(OBJDIR)/seal
endif
ifdef RAINE32
OBJDIRS += $(OBJDIR)/fnmatch
endif
ifndef CROSSCOMPILE
INCDIR += -I/usr/local/include
endif
ifdef USE_MUSASHI
DEFINE += -DMUSASHI_CNF=\"m68kconf-raine.h\" -DUSE_MUSASHI=$(USE_MUSASHI)
endif
# define LSB_FIRST if we are a little-endian target
ifndef BIGENDIAN
DEFINE += -DLSB_FIRST
endif
# The -fno-stack-protector is because of a stack smash which happens on only 1 computer and which does not make any sense at all !
# see comment in TConsole::TConsole
ifdef RAINE_DEBUG
CFLAGS_MCU = $(INCDIR) $(DEFINE) $(_MARCH) -Wall -Wno-write-strings -g -DRAINE_DEBUG
AFLAGS += -DRAINE_DEBUG
CFLAGS += $(INCDIR) $(DEFINE) $(_MARCH) -Wall -Wno-write-strings -g -DRAINE_DEBUG -fno-stack-protector
ifndef USE_CLANG
ifndef RAINE_UNIX
CFLAGS_MCU += -Wno-format-truncation
CFLAGS += -Wno-format-truncation
else
CFLAGS_MCU += -Wno-format-truncation -fsanitize=address # -fno-omit-frame-pointer -fno-common
CFLAGS += -Wno-format-truncation -fsanitize=address # -fno-omit-frame-pointer -fno-common
LFLAGS = -fsanitize=address
endif # RAINE_UNIX
else
CFLAGS_MCU += -Wno-initializer-overrides -Wno-invalid-source-encoding -fsanitize=address
CFLAGS += -Wno-initializer-overrides -Wno-invalid-source-encoding -fsanitize=address # -fno-omit-frame-pointer -fno-common
LFLAGS = -fsanitize=address
endif
else
# All the flags are optimisations except -fomit-frame-pointer necessary for
# the 68020 core in dos. -Wno-trigraphs suppress some anoying warnings with
# gcc-2.96
# These flags are for gcc-2.x
ifdef RAINE32
# when starting a game -> black screen if -O > 1 (bug in uint64 calculation)
CFLAGS += -O3
else
# Seems to work now, at least with the sdl version ? (to be tested with windows !)
CFLAGS = -O3
endif
CFLAGS += $(INCDIR) \
$(DEFINE) \
$(_MARCH) \
-Wno-trigraphs \
-fexpensive-optimizations \
-ffast-math \
-w \
-fomit-frame-pointer -fno-stack-protector
# This is required for gcc-2.9x (bug in -fomit-frame-pointer)
ifeq ($(GCC_MAJOR),2)
CFLAGS_MCU = $(_MARCH) -O3 -fexpensive-optimizations # switches for the 68705 mcus
else
CFLAGS_MCU := $(CFLAGS)
endif
ifdef RAINE_UNIX
CFLAGS += -pipe
endif
# The accumulate-outgoing-args is for gcc3, but I am not sure it has any
# effect... And I could not notice any improvement with my duron if I change
# the cpu and arch to athlon... For now I comment the gcc3 option for the
# win32 version (no gcc3 for win32 for now).
# -maccumulate-outgoing-args
# -pedantic
endif
ifeq ("$(shell $(CC) --version|grep '^Apple'|sed 's/\(Apple LLVM\).*/\1/')","Apple LLVM")
# gcc 4.8 emits warnings for all the game definitions because we
# override the definition with the new macros...
CFLAGS += -Wno-initializer-overrides \
-Wno-invalid-source-encoding
endif
ifdef GFX_SVGALIB
CFLAGS += -DGFX_SVGA
endif
ifdef X86_64
CFLAGS += -DX86_64
CFLAGS_MCU += -DX86_64
endif
ifdef HAS_CONSOLE
CFLAGS += -DHAS_CONSOLE
CFLAGS_MCU += -DHAS_CONSOLE
endif
ifdef NO_ASM
CFLAGS += -DNO_ASM
CFLAGS_MCU += -DNO_ASM
endif
ifdef USE_BEZELS
CFLAGS += -DUSE_BEZELS=1
CFLAGS_MCU += -DUSE_BEZELS=1
endif
ifdef SDL
CFLAGS += -DSDL=${SDL}
CFLAGS_MCU += -DSDL=${SDL}
else
OBJDIRS += \
$(OBJDIR)/alleg/gui \
$(OBJDIR)/alleg/jpg
endif
ifdef USE_CURL
CFLAGS += -DUSE_CURL
endif
# assembler (gas)
SFLAGS= $(INCDIR) \
$(DEFINE) \
-Wall -Wno-write-strings \
$(_MARCH) \
-xassembler-with-cpp \
ifeq ($(OSTYPE),cygwin)
CFLAGS += -mno-cygwin
CFLAGS_MCU += -mno-cygwin
SFLAGS += -mno-cygwin
endif
ifdef RAINE_DEBUG
# Debuger
# dz80 interface
DZ80= $(OBJDIR)/alleg/debug/dz80/dissz80.o \
$(OBJDIR)/alleg/debug/dz80/dz80_raine.o \
$(OBJDIR)/alleg/debug/dz80/tables.o
ifndef SDL
# in sdl the debuger will very probably use sdl_console
# for now there is no debuger at all
DEBUG= $(OBJDIR)/alleg/debug/dbg_gui.o \
$(OBJDIR)/alleg/debug/breakpt.o \
$(DZ80)
endif
endif
# ASM 68020 core
ifdef USE_MUSASHI
ASM020= $(OBJDIR)/68020/newcpu.o \
$(OBJDIR)/Musashi/m68kcpu.o \
$(OBJDIR)/Musashi/m68kops.o
else
ASM020= $(OBJDIR)/68020/newcpu.o \
$(OBJDIR)/68020/readcpu.o \
$(OBJDIR)/68020/cpustbl.o \
$(OBJDIR)/68020/cpudefs.o \
$(OBJDIR)/68020/a020core.o
endif
ifdef GENS_SH2
SH2 = $(OBJDIR)/gens_sh2/sh2a.o \
$(OBJDIR)/gens_sh2/sh2.o
CFLAGS += -Isource/gens_sh2 -DGENS_SH2=1
else
SH2 = $(OBJDIR)/mame/sh2/sh2.o \
$(OBJDIR)/mame/sh2/sh2comn.o
CFLAGS += -Isource/mame/sh2
endif
# STARSCREAM 68000 core
ifeq ($(USE_MUSASHI),2)
SC000= $(OBJDIR)/68000/starhelp.o
else
SC000= $(OBJDIR)/68000/s68000.o \
$(OBJDIR)/68000/starhelp.o
endif
# MZ80 core
ifdef MAME_Z80
MZ80=$(OBJDIR)/z80/mz80help.o $(OBJDIR)/mame/z80/z80.o
else
MZ80= $(OBJDIR)/z80/mz80.o \
$(OBJDIR)/z80/mz80help.o
endif
# network core
NET= $(OBJDIR)/net/d_system.o \
$(OBJDIR)/net/d_net.o \
$(OBJDIR)/net/d_netfil.o
# M6502 core
ifdef MAME_6502
M6502 = $(OBJDIR)/6502/m6502hlp.o \
$(OBJDIR)/mame/6502/m6502.o
else
M6502= $(OBJDIR)/6502/m6502.o \
$(OBJDIR)/6502/m6502hlp.o
endif
# M68705 core
M68705= $(OBJDIR)/m68705/m68705.o \
# Video core
VIDEO= $(OBJDIR)/video/tilemod.o \
$(OBJDIR)/video/palette.o \
$(OBJDIR)/video/priorities.o \
$(OBJDIR)/video/newspr.o \
$(OBJDIR)/video/spr64.o \
$(OBJDIR)/video/cache.o \
$(VIDEO_CORE)/str/6x8_8.o \
$(VIDEO_CORE)/str/6x8_16.o \
$(VIDEO_CORE)/str/6x8_32.o \
\
$(VIDEO_CORE)/16x8_8.o \
$(VIDEO_CORE)/16x8_16.o \
$(VIDEO_CORE)/16x8_32.o \
\
$(OBJDIR)/video/zoom/16x16.o \
$(OBJDIR)/video/zoom/16x16_16.o \
$(OBJDIR)/video/zoom/16x16_32.o \
$(OBJDIR)/video/zoom/16x8.o \
$(OBJDIR)/video/c/lscroll.o \
$(OBJDIR)/video/alpha.o \
$(OBJDIR)/video/c/str_opaque.o \
$(OBJDIR)/video/c/common.o \
$(OBJDIR)/video/c/pdraw.o \
$(OBJDIR)/video/c/mask.o
ifneq (${SDL},2)
VIDEO += $(OBJDIR)/video/res.o \
$(VIDEO_CORE)/blit_x2/8.o \
$(VIDEO_CORE)/blit_x2/16.o \
$(VIDEO_CORE)/blit_x2/24.o \
$(VIDEO_CORE)/blit_x2/32.o \
$(OBJDIR)/video/scale2x.o \
$(OBJDIR)/video/scale3x.o
endif
ifndef NO_ASM
ifneq (${SDL},2)
VIDEO += \
$(OBJDIR)/video/hq2x16.o \
$(OBJDIR)/video/hq2x32.o \
$(OBJDIR)/video/hq3x16.o \
$(OBJDIR)/video/hq3x32.o
endif
endif
ifdef ASM_VIDEO_CORE
VIDEO += \
$(VIDEO_CORE)/spr8x8_8.o \
$(VIDEO_CORE)/spr8_16.o \
$(VIDEO_CORE)/spr8_32.o \
$(VIDEO_CORE)/16x16_8.o \
$(VIDEO_CORE)/16x16_16.o \
$(VIDEO_CORE)/16x16_32.o \
$(OBJDIR)/video/i386/packed/8.o \
$(OBJDIR)/video/i386/packed/16.o \
$(OBJDIR)/video/i386/packed/32.o \
$(OBJDIR)/video/i386/32x32_8.o \
$(OBJDIR)/video/i386/32x32_16.o \
$(OBJDIR)/video/i386/32x32_32.o \
$(OBJDIR)/video/i386/newspr2/8.o \
$(OBJDIR)/video/i386/newspr2/16.o \
$(OBJDIR)/video/i386/newspr2/32.o \
$(OBJDIR)/video/i386/move.o \
else
VIDEO += $(VIDEO_CORE)/sprites.o
endif
# common to asm & c : 32bpp version of alpha blending
VIDEO += $(OBJDIR)/video/c/sprites32_a50.o \
$(OBJDIR)/video/c/mapped_alpha.o
ifndef SDL
VIDEO += \
$(OBJDIR)/video/arcmon.o \
$(OBJDIR)/video/arcmode.o \
$(OBJDIR)/video/blitasm.o \
$(OBJDIR)/video/eagle.o
endif
# Sound core
SOUND= \
$(OBJDIR)/sound/ymdeltat.o \
$(OBJDIR)/sound/fmopl.o \
$(OBJDIR)/sound/fm.o \
$(OBJDIR)/sound/emulator.o
ASSOC = $(OBJDIR)/sound/assoc.o
ifdef SDL
ASSOC += \
$(OBJDIR)/sdl/dialogs/sound_commands.o \
$(OBJDIR)/sdl/dialogs/neocd_options.o \
$(OBJDIR)/sdl/dialogs/neo_softdips.o \
$(OBJDIR)/sdl/dialogs/neo_debug_dips.o
ifeq (${SDL},1)
ASSOC += $(OBJDIR)/sdl/dialogs/translator.o
endif