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.9 - (show annotations) (download)
Tue May 7 12:48:17 2002 UTC (21 years, 11 months ago) by zero
Branch: MAIN
Changes since 1.8: +1 -1 lines
*** empty log message ***

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

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