Develop and Download Open Source Software

Browse CVS Repository

Contents of /mame32jp/mame32jp/makefile

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Tue Apr 23 13:46:52 2002 UTC (21 years, 11 months ago) by zero
Branch: MAIN
Changes since 1.1: +0 -0 lines
FILE REMOVED
*** empty log message ***

1 #####################################################################
2
3 MAME_VERSION = -DMAME_VERSION=59
4
5 # set this to mame, mess or the destination you want to build
6 TARGET = mame
7 ifeq ($(TARGET),)
8 TARGET = mame
9 endif
10
11 # select compiler
12 USE_GCC = 1
13 # USE_VC = 1
14
15 # build a version for debugging games
16 # DEBUG = 1
17
18 # uncomment next line to include the symbols for symify
19 # SYMBOLS = 1
20
21 # uncomment next line to generate a link map for exception handling in win32
22 # MAP = 1
23
24 # uncomment next line to use Assembler 68000 engine
25 X86_ASM_68000 = 1
26
27 # uncomment next line to use Assembler 68020 engine
28 # X86_ASM_68020 = 1
29
30 # uncomment next line to support 32bpp
31 SUPPORT_32BPP = -DSUPPORT_32BPP
32
33 # uncomment next line to support extra folder
34 EXTRA_FOLDER = -DEXTRA_FOLDER
35
36 # build MAME32JP
37 MAME32JP = -DMAME32JP
38
39 # uncomment next line to support disable blurring filter
40 NFILTER = -DNFILTER
41
42 # uncomment next line to support game selection by a joystick
43 JOYGUI = -DJOYGUI
44
45 # uncomment next line to support stretch to fullscreen
46 FSSTRETCH = -DFSSTRETCH
47
48 # language
49 JAPANESE = 1
50 # ENGLISH = 1
51
52 # build console version
53 # BUILD_CONSOLE = -DBUILD_CONSOLE
54
55 # use fast (register) calling convention (for VC).
56 # USE_FASTCALL = -DFASTCALL
57
58 # uncomment next line to generate help files
59 # HELP = 1
60
61 #####################################################################
62 # PLEASE DO NOT CHANGE THE FOLLOWING SETTINGS!
63
64 # if compiler is not selected, GCC is used as the default.
65 ifndef USE_VC
66 ifndef USE_GCC
67 USE_GCC = 1
68 endif
69 endif
70
71 # set this the operating system you're building for
72 OS = Win32
73
74 # extension for executables
75 EXE = .exe
76
77 # CPU core include paths
78 VPATH = src $(wildcard src/cpu/*)
79
80 ifdef USE_GCC
81 USE_FASTCALL =
82 USE_VC =
83 endif
84
85 # compiler, linker and assembler
86 ifdef IP4
87 INTEL = 1
88 endif
89
90 ifdef USE_GCC
91 AR = @ar
92 CC = @gcc
93 LD = @gcc
94 ifdef JAPANESE
95 RC = @brcc32
96 RC2 = @windres
97 else
98 RC = @windres
99 endif
100 else
101 AR = @lib
102 ifdef INTEL
103 CC = @icl
104 else
105 CC = @cl
106 endif
107 LD = @link
108 RC = @rc
109 endif
110
111 # assembler
112 ASM = @nasmw
113 ASMFLAGS = -f win32 $(SUPPORT_32BPP)
114
115
116 # utilities
117 RM = del
118 RMDIR = rd /S /Q
119 MD = -md
120
121
122 ifdef USE_GCC
123 WINDOWS_PROGRAM = -mwindows
124 CONSOLE_PROGRAM = -mconsole
125 else
126 WINDOWS_PROGRAM = -subsystem:windows
127 CONSOLE_PROGRAM = -subsystem:console
128 endif
129
130 ifdef BUILD_CONSOLE
131 PROGRAM_TYPE = $(CONSOLE_PROGRAM)
132 else
133 PROGRAM_TYPE = $(WINDOWS_PROGRAM)
134 endif
135
136 ifdef I686
137 P6OPT = ppro
138 else
139 P6OPT = notppro
140 endif
141
142 ifdef JAPANESE
143 LANGUAGE = -DJAPANESE
144 ENGLISH =
145 SUFFIX = jp
146 else
147 LANGUAGE = -DENGLISH
148 JAPANESE =
149 SUFFIX = e
150 endif
151
152 ifdef SYMBOLS
153 CPUTYPE = debug
154 COMPILETYPE = -DCOMPILETYPE=0
155 else
156 ifdef USE_GCC
157 ifdef K6
158 ARCH = -march=k6
159 CPUTYPE = k6
160 COMPILETYPE = -DCOMPILETYPE=4
161 else
162 ifdef I686
163 ARCH = -march=pentiumpro
164 CPUTYPE = ppro
165 COMPILETYPE = -DCOMPILETYPE=2
166 else
167 ARCH = -march=pentium
168 CPUTYPE = pentium
169 COMPILETYPE = -DCOMPILETYPE=1
170 endif
171 endif
172 else
173 ifdef I686
174 ARCH = -G6
175 ifdef INTEL
176 ARCH += -QxiM -QaxK
177 endif
178 CPUTYPE = vc_ppro
179 COMPILETYPE = -DCOMPILETYPE=12
180 else
181 ifdef IP4
182 ARCH = -G7 -QaxW
183 CPUTYPE = pentium4
184 COMPILETYPE = -DCOMPILETYPE=3
185 else
186 ARCH = -G5
187 ifdef INTEL
188 ARCH += -QaxM
189 endif
190 CPUTYPE = vc_pentium
191 COMPILETYPE = -DCOMPILETYPE=1
192 endif
193 endif
194 endif
195 endif
196
197 NAME = $(TARGET)32$(SUFFIX)
198
199 # build the targets in different object dirs, since mess changes
200 # some structures and thus they can't be linked against each other.
201 # cleantiny isn't needed anymore, because the tiny build has its
202 # own object directory too.
203 OBJ = obj/$(CPUTYPE)
204
205 EMULATOR = exe/$(CPUTYPE)/$(NAME)$(EXE)
206
207 #####################################################################
208 # check enviroment
209
210 ifndef DX_INCPATH
211 nodxincpath:
212 @echo Path for DirectX include headers (DX_INCPATH) not defined.
213 endif
214
215 ifndef DX_LIBPATH
216 nodxlibpath:
217 @echo Path for DirectX Libraries (DX_LIBPATH) not defined.
218 endif
219
220 #####################################################################
221 # compiler
222
223 #--------------------------------------------------------------------
224 # Preprocessor Definitions
225 #--------------------------------------------------------------------
226
227 DEFS = \
228 -D_WIN32_IE=0x0400 \
229 -DWINVER=0x0400 \
230 -D_WIN32_WINNT=0x0400 \
231 -DDIRECTSOUND_VERSION=0x0300 \
232 -DDIRECTDRAW_VERSION=0x0300 \
233 -DDIRECTINPUT_VERSION=0x0500 \
234 -DWIN32 \
235 -D_WINDOWS \
236 -DM_PI=3.1415926534 \
237 -DPI=3.1415926534 \
238 -DCLIB_DECL=__cdecl \
239 -DDECL_SPEC=__cdecl \
240 -DPNG_SAVE_SUPPORT \
241 -DHAS_CPUS \
242 -DHAS_SOUND \
243 -DLSB_FIRST=1 \
244 -DZLIB_DLL \
245 $(MAME_VERSION) \
246 $(USE_FASTCALL) \
247 -DMAME_FIX \
248 -DMAME32_FIX \
249 $(MAME32JP) \
250 $(NFILTER) \
251 $(JOYGUI) \
252 $(FSSTRETCH) \
253 $(LANGUAGE) \
254 $(BUILD_CONSOLE) \
255 $(SUPPORT_32BPP) \
256 $(EXTRA_FOLDER)
257
258 ifdef USE_GCC
259 DEFS += \
260 -DNONAMELESSUNION \
261 -DHMONITOR_DECLARED \
262 -D_LPCWAVEFORMATEX_DEFINED \
263 -UWINNT \
264 -D__int64='long long' \
265 -DINLINE='static __inline__' \
266 -Dasm=__asm__ \
267 -DX86_ASM
268 else
269 DEFS += \
270 -DINLINE='static __inline' \
271 -Dinline=__inline \
272 -D__inline__=__inline
273 endif
274
275
276 ifndef SYMBOLS
277 DEFS += -DNDEBUG
278 endif
279
280 #--------------------------------------------------------------------
281 # Include path
282 #--------------------------------------------------------------------
283
284 INCLUDES = \
285 -I. \
286 -Isrc \
287 -Isrc/includes \
288 -Isrc/Win32 \
289 -Isrc/Win32/Mame32UI \
290 -Isrc/cpu/m68000 \
291 -Isrc/zlib \
292 -I$(OBJ)/cpu/m68000 \
293 -I$(DX_INCPATH) \
294
295 #--------------------------------------------------------------------
296 # C Compiler flags
297 #--------------------------------------------------------------------
298
299 ifdef USE_GCC
300
301 CFLAGS = $(INCLUDES) -mno-cygwin
302
303 # multi threaded
304 CFLAGS +=
305
306 ifdef SYMBOLS
307 CFLAGS += -d
308 endif
309
310 ifdef SYMBOLS
311 CFLAGS += -O0 -Wall -Werror -Wno-unused -g
312 else
313 CFLAGS += $(ARCH) -O3 -s -static -malign-double \
314 -fomit-frame-pointer -fstrict-aliasing -ffast-math \
315 -Werror -Wall -Wno-sign-compare -Wunused \
316 -Wpointer-arith -Wbad-function-cast -Wcast-align \
317 -Waggregate-return -Wshadow -Wstrict-prototypes -Wundef
318 # try with gcc 3.0 -Wpadded -Wunreachable-code -Wdisabled-optimization
319 # -W had to remove because of the "missing initializer" warning
320 # -Wlarger-than-262144 \
321 # -Wcast-qual \
322 # -Wwrite-strings \
323 # -Wconversion \
324 # -Wmissing-prototypes \
325 # -Wmissing-declarations \
326 # -Wredundant-decls
327
328 endif
329
330 CFLAGSPEDANTIC = $(CFLAGS) -pedantic
331
332 else
333
334 CFLAGS = -W3 -nologo $(INCLUDES)
335
336 # multi threaded
337 CFLAGS += -MT
338
339 ifdef USE_FASTCALL
340 CFLAGS += -Gr
341 endif
342
343 ifdef SYMBOLS
344 CFLAGS += -Zi -Od
345 else
346
347 CFLAGS += -Ox $(ARCH) -Ob2
348 endif
349
350 endif
351
352 #####################################################################
353 # Resources
354
355 RCDEFS = $(COMPILETYPE) $(BUILD_CONSOLE) -DNDEBUG $(MAME_VERSION) -D_WIN32
356
357 RCDEFS += $(NFILTER) $(JOYGUI) $(FSSTRETCH)
358
359 ifdef USE_GCC
360 ifdef JAPANESE
361 RCFLAGS = -r -I./Win32 -I$(INCLUDE)
362 else
363 RCDEFS += -D_WIN32_IE=0x0400
364 RCFLAGS = -O coff --include-dir src/Win32
365 endif
366 else
367 ifdef JAPANESE
368 RCFLAGS = -l 0x411 -I./Win32
369 else
370 RCFLAGS = -l 0x409 -I./Win32
371 endif
372 endif
373
374 #####################################################################
375 # Linker
376
377 ifdef USE_GCC
378 LIBS = \
379 -lkernel32 \
380 -luser32 \
381 -lgdi32 \
382 -lshell32 \
383 -lcomctl32 \
384 -lcomdlg32 \
385 -ladvapi32 \
386 -lwinmm \
387 -ldxguid \
388 -ldinput \
389 -lhtmlhelp
390
391 LDFLAGS = -L$(DX_LIBPATH)
392
393 ifndef SYMBOLS
394 #LDFLAGS = -s -Wl,--warn-common
395 LDFLAGS += -s
396 endif
397
398 ifdef MAP
399 MAPFLAGS = -Wl,-M >$(NAME).map
400 else
401 MAPFLAGS =
402 endif
403
404 else
405
406 LIBS = \
407 kernel32.lib \
408 user32.lib \
409 gdi32.lib \
410 shell32.lib \
411 comctl32.lib \
412 comdlg32.lib \
413 advapi32.lib \
414 winmm.lib \
415 dxguid.lib \
416 dinput.lib \
417 htmlhelp.lib
418
419 LDFLAGS = -libpath:$(DX_LIBPATH)
420
421 LDFLAGS += -machine:x86 -nologo
422
423 ifdef SYMBOLS
424 LDFLAGS += -debug:full
425 else
426 LDFLAGS += -release -incremental:no
427 endif
428
429 ifdef MAP
430 LDFLAGS += -map
431 endif
432
433 endif
434
435 #####################################################################
436
437 OBJDIRS = \
438 $(OBJ) \
439 $(OBJ)/cpu \
440 $(OBJ)/sound \
441 $(OBJ)/drivers \
442 $(OBJ)/machine \
443 $(OBJ)/vidhrdw \
444 $(OBJ)/sndhrdw \
445 $(OBJ)/patch \
446 $(OBJ)/zlib \
447 $(OBJ)/Win32 \
448 $(OBJ)/Win32/Mame32UI \
449 $(OBJ)/Win32/hlp
450
451 #####################################################################
452
453 all: maketree $(EMULATOR) extra
454 #all: update maketree $(EMULATOR) extra
455
456 # include the various .mak files
457 include src/core.mak
458 include src/$(TARGET).mak
459 include src/rules.mak
460 include src/zlib/zlib.mak
461 include src/$(OS)/$(OS).mak
462
463 ifdef USE_GCC
464 OSOBJS += $(OBJ)/Win32/portio.o
465 endif
466
467 ifdef DEBUG
468 DBGDEFS = -DMAME_DEBUG
469 else
470 DBGDEFS =
471 DBGOBJS =
472 endif
473
474 #extra: $(TOOLS) $(HELPFILES)
475 extra: $(HELPFILES)
476
477 # combine the various definitions to one
478 CDEFS = $(DEFS) $(COREDEFS) $(CPUDEFS) $(SOUNDDEFS) $(ASMDEFS) $(DBGDEFS)
479
480 $(EMULATOR): $(OBJS) $(COREOBJS) $(OSOBJS) $(DRVLIBS) $(RES)
481 # always recompile the version string
482 ifdef USE_GCC
483 $(CC) $(CDEFS) $(CFLAGS) -o $(OBJ)/version.o -c src/version.c
484 else
485 $(CC) $(CDEFS) $(CFLAGS) -Fo$(OBJ)/version.o -c src/version.c
486 endif
487 @echo Linking $@...
488 ifdef USE_GCC
489 $(LD) $(LDFLAGS) $(PROGRAM_TYPE) $(OBJS) $(COREOBJS) $(OSOBJS) $(LIBS) $(DRVLIBS) $(RES) -o $@
490 else
491 $(LD) $(LDFLAGS) $(PROGRAM_TYPE) -out:$(EMULATOR) $(LIBS) $(COREOBJS) $(OBJS) $(OSOBJS) $(DRVLIBS) $(RES)
492 endif
493 ifndef SYMBOLS
494 # upx $(EMULATOR)
495 endif
496
497 romcmp$(EXE): $(OBJ)/romcmp.o $(OBJ)/unzip.o
498 @echo Linking $@...
499 ifdef USE_GCC
500 $(LD) $(LDFLAGS) $(CONSOLE_PROGRAM) $^ $(LIBS) -o $@
501 else
502 $(LD) $(LDFLAGS) $(CONSOLE_PROGRAM) $(LIBS) $(OBJ)/Win32/dirent.o -out:$@ $^
503 endif
504
505 hdcomp$(EXE): $(OBJ)/romcmp.o $(OBJ)/unzip.o
506 @echo Linking $@...
507 ifdef USE_GCC
508 $(LD) $(LDFLAGS) $(CONSOLE_PROGRAM) $^ $(LIBS) -o $@
509 else
510 $(LD) $(LDFLAGS) $(CONSOLE_PROGRAM) $(LIBS) $(OBJ)/Win32/dirent.o -out:$@ $^
511 endif
512
513 #--------------------------------------------------------------------
514 # make list
515
516 ifdef PERL
517 $(OBJ)/cpuintrf.o: src/cpuintrf.c rules.mak
518 $(PERL) src/makelist.pl
519 @echo Compiling $<...
520 $(CC) $(CDEFS) $(CFLAGSPEDANTIC) -c $< -o $@
521 endif
522
523 #--------------------------------------------------------------------
524 # ASM source
525
526 $(OBJ)/%.o: src/%.asm
527 @echo Assembling $<...
528 $(ASM) -o $@ $(ASMFLAGS) $(ASMDEFS) $<
529
530 #--------------------------------------------------------------------
531 # C source
532
533 $(OBJ)/%.o: src/%.c
534 @echo Compiling $<...
535 ifdef USE_GCC
536 ifdef JAPANESE
537 @sjisfix $< check
538 endif
539 $(CC) $(CDEFS) $(CFLAGSPEDANTIC) -c $< -o $@
540 ifdef JAPANESE
541 @sjisfix $< delete
542 endif
543 else
544 ifdef IP4
545 ifdef JAPANESE
546 @sjisfix $< check
547 endif
548 endif
549 $(CC) $(CDEFS) $(CFLAGS) -Fo$@ -c $<
550 ifdef IP4
551 ifdef JAPANESE
552 @sjisfix $< delete
553 endif
554 endif
555 endif
556
557 #--------------------------------------------------------------------
558 # resource
559
560 ifdef USE_GCC
561 $(OBJ)/Win32/%.o: src/Win32/%.rc
562 @echo Compiling resources $<...
563 ifdef JAPANESE
564 $(RC) $(RCDEFS) $(RCFLAGS) -Fosrc/Win32/mame32$(SUFFIX).res $<
565 $(RC2) -i src/Win32/mame32$(SUFFIX).res -o $@
566 else
567 $(RC) $(RCDEFS) $(RCFLAGS) -o $@ -i $<
568 endif
569 else
570 $(OBJ)/Win32/%.o: src/Win32/%.rc
571 @echo Compiling resources $<...
572 $(RC) $(RCDEFS) $(RCFLAGS) -Fo$@ $<
573 endif
574
575 #--------------------------------------------------------------------
576 # 68000 C core
577
578 # compile generated C files for the 68000 emulator
579 $(M68000_GENERATED_OBJS): $(OBJ)/cpu/m68000/m68kmake$(EXE)
580 @echo Compiling $(subst .o,.c,$@)...
581 ifdef USE_GCC
582 $(CC) $(CDEFS) $(CFLAGSPEDANTIC) -c $*.c -o $@
583 else
584 $(CC) $(CDEFS) $(CFLAGS) -Fo$@ -c $*.c
585 endif
586
587 # additional rule, because m68kcpu.c includes the generated m68kops.h :-/
588 $(OBJ)/cpu/m68000/m68kcpu.o: $(OBJ)/cpu/m68000/m68kmake$(EXE)
589
590 # generate C source files for the 68000 emulator
591 $(OBJ)/cpu/m68000/m68kmake$(EXE): src/cpu/m68000/m68kmake.c
592 @echo M68K make $<...
593 ifdef USE_GCC
594 $(CC) $(CDEFS) $(CFLAGSPEDANTIC) -DDOS -o $(OBJ)/cpu/m68000/m68kmake$(EXE) $<
595 else
596 $(CC) $(CDEFS) $(CFLAGS) -Fe$@ -Fo$(OBJ)/cpu/m68000 $<
597 endif
598 @echo Generating M68K source files...
599 $(OBJ)/cpu/m68000/m68kmake$(EXE) $(OBJ)/cpu/m68000 src/cpu/m68000/m68k_in.c
600
601 #--------------------------------------------------------------------
602 # 68000 ASM core
603
604 # generate asm source files for the 68000 emulator
605 $(OBJ)/cpu/m68000/68000.asm: src/cpu/m68000/make68k.c
606 @echo Compiling $<...
607 ifdef USE_GCC
608 $(CC) $(CDEFS) $(CFLAGSPEDANTIC) -O0 -DDOS -o $(OBJ)/cpu/m68000/make68k$(EXE) $<
609 else
610 $(CC) $(CDEFS) $(CFLAGS) -Fe$(OBJ)/cpu/m68000/make68k$(EXE) -Fo$(OBJ)/cpu/m68000 $<
611 endif
612 @echo Generating $@...
613 $(OBJ)/cpu/m68000/make68k$(EXE) $@ $(OBJ)/cpu/m68000/68000tab.asm 00 $(P6OPT)
614
615 # generated asm files for the 68000 emulator
616 $(OBJ)/cpu/m68000/68000.o: $(OBJ)/cpu/m68000/68000.asm
617 @echo Assembling $<...
618 $(ASM) -o $@ $(ASMFLAGS) $(subst -D,-d,$(ASMDEFS)) $<
619
620
621 #--------------------------------------------------------------------
622 # 68020 ASM core
623
624 # generate asm source files for the 68020 emulator
625 $(OBJ)/cpu/m68000/68020.asm: src/cpu/m68000/make68k.c
626 @echo Compiling $<...
627 ifdef USE_GCC
628 $(CC) $(CDEFS) $(CFLAGSPEDANTIC) -O0 -DDOS -o $(OBJ)/cpu/m68000/make68k(EXE) $<
629 else
630 $(CC) $(CDEFS) $(CFLAGS) -Fe$(OBJ)/cpu/m68000/make68k(EXE) -Fo$(OBJ)/cpu/m68000 $<
631 endif
632 @echo Generating $@...
633 $(OBJ)/cpu/m68000/make68k(EXE) $@ $(OBJ)/cpu/m68000/68020tab.asm 20 $(P6OPT)
634
635 # generated asm files for the 68020 emulator
636 $(OBJ)/cpu/m68000/68020.o: $(OBJ)/cpu/m68000/68020.asm
637 @echo Assembling $<...
638 $(ASM) -o $@ $(ASMFLAGS) $(subst -D,-d,$(ASMDEFS)) $<
639
640 #--------------------------------------------------------------------
641 # archiving object files
642
643 $(OBJ)/%.a:
644 @echo Archiving $@...
645 @if exist $@ $(RM) $(subst /,\,$@)
646 ifdef USE_GCC
647 $(AR) cr $@ $^
648 else
649 $(AR) -nologo -out:$@ $^
650 endif
651
652
653 #####################################################################
654 # make rules
655
656 makedir:
657 @echo make makedir is no longer necessary, just type make
658
659 $(sort $(OBJDIRS)):
660 $(MD) $(subst /,\,$@)
661
662 maketree2:
663 @echo Making object tree...
664
665 maketree: maketree2 $(sort $(OBJDIRS))
666
667 clean:
668 @echo Deleting object tree $(OBJ)...
669 # @if exist $(OBJ) $(RMDIR) $(subst /,\,$(OBJ))
670 # @echo Deleting $(EMULATOR)...
671 # @if exist $(EMULATOR) $(RM) $(EMULATOR)
672 $(RM) -r $(OBJ)
673 @echo Deleting $(EMULATOR)...
674 $(RM) $(EMULATOR)
675
676 clean68k:
677 @echo Deleting 68k files...
678 $(RM) -r $(OBJ)/cpuintrf.o
679 $(RM) -r $(OBJ)/drivers/cps2.o
680 $(RM) -r $(OBJ)/cpu/m68000
681
682 update:
683 @echo Deleting old object files...
684 # @if exist $(OBJ)\vidhrdw\neogeo.o $(RM) $(OBJ)\vidhrdw\neogeo.o

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26