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
|
###########################################################################
#
# makefile.mes
#
# Core makefile for building MESS and derivatives
#
###########################################################################
###########################################################################
################# BEGIN USER-CONFIGURABLE OPTIONS #####################
###########################################################################
#-------------------------------------------------
# specify core target: mess, tiny, etc.
# build rules will be included from $(TARGET).mak
#-------------------------------------------------
ifndef TARGET
TARGET = mess
endif
#-------------------------------------------------
# specify operating system: windows, msdos, etc.
# build rules will be includes from $(MAMEOS)/$(MAMEOS).mak
#-------------------------------------------------
ifndef MAMEOS
MAMEOS = windows
endif
#-------------------------------------------------
# specify program options; see each option below
# for details
#-------------------------------------------------
# uncomment next line to include the debugger
# DEBUG = 1
# uncomment next line to use the new multiwindow debugger
NEW_DEBUGGER = 1
# uncomment next line to use the new rendering system
# NEW_RENDER = 1
# uncomment next line to use DRC MIPS3 engine
X86_MIPS3_DRC = 1
# uncomment next line to use DRC PowerPC engine
X86_PPC_DRC = 1
# uncomment next line to use DRC Voodoo rasterizers
# X86_VOODOO_DRC = 1
#-------------------------------------------------
# specify build options; see each option below
# for details
#-------------------------------------------------
# uncomment one of the next lines to build a target-optimized build
# ATHLON = 1
# I686 = 1
# P4 = 1
# PM = 1
# AMD64 = 1
# uncomment next line if you are building for a 64-bit target
# PTR64 = 1
# uncomment next line to use cygwin compiler
# COMPILESYSTEM_CYGWIN = 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
# uncomment next line to generate a link map for exception handling in windows
# MAP = 1
###########################################################################
################## END USER-CONFIGURABLE OPTIONS ######################
###########################################################################
#-------------------------------------------------
# sanity check the configuration
#-------------------------------------------------
# disable DRC cores for 64-bit builds
ifdef PTR64
X86_MIPS3_DRC =
X86_PPC_DRC =
endif
#-------------------------------------------------
# platform-specific definitions
#-------------------------------------------------
# extension for executables
EXE = .exe
# compiler, linker and utilities
AR = @ar
CC = @gcc
LD = @gcc
ASM = @nasm
HHC = @-hhc
ASMFLAGS = -f coff
MD = -mkdir.exe
RM = @rm -f
WINDOWS_PROGRAM = -mwindows
CONSOLE_PROGRAM = -mconsole
SUFFIX =
WINUI = 1
#-------------------------------------------------
# form the name of the executable
#-------------------------------------------------
ifeq ($(MAMEOS),msdos)
PREFIX = d
endif
# by default, compile for Pentium target
NAME = $(PREFIX)$(TARGET)
GUINAME = $(TARGET)gui
ARCH = -march=pentium
# architecture-specific builds get extra options
ifdef ATHLON
NAME = $(PREFIX)$(TARGET)at
GUINAME = $(TARGET)guiat
ARCH = -march=athlon
endif
ifdef I686
NAME = $(PREFIX)$(TARGET)pp
GUINAME = $(TARGET)guipp
ARCH = -march=pentiumpro
endif
ifdef P4
NAME = $(PREFIX)$(TARGET)p4
GUINAME = $(TARGET)guip4
ARCH = -march=pentium4
endif
ifdef AMD64
NAME = $(PREFIX)$(TARGET)64
GUINAME = $(TARGET)gui64
ARCH = -march=athlon64
endif
ifdef PM
NAME = $(PREFIX)$(TARGET)pm
GUINAME = $(TARGET)guipm
ARCH = -march=pentium3 -msse2
endif
ifdef MSVC_BUILD
NAME:=$(NAME)vc
GUINAME:=$(GUINAME)vc
endif
# debug builds just get the 'd' suffix and nothing more
ifdef DEBUG
NAME := $(NAME)d
GUINAME := $(GUINAME)d
endif
EMULATORCLI = $(NAME)$(EXE)
# build the targets in different object dirs, since mess changes
# some structures and thus they can't be linked against each other.
OBJ = obj/$(NAME)
#-------------------------------------------------
# compile-time definitions
#-------------------------------------------------
DEFS = -DX86_ASM -DLSB_FIRST -DINLINE="static __inline__" -Dasm=__asm__ -DCRLF=3
ifndef MSVC_BUILD
DEFS += -Dalloca=__builtin_alloca
endif
ifdef PTR64
DEFS += -DPTR64
endif
ifdef DEBUG
DEFS += -DMAME_DEBUG
endif
ifdef NEW_DEBUGGER
DEFS += -DNEW_DEBUGGER
endif
ifdef NEW_RENDER
DEFS += -DNEW_RENDER
endif
ifdef X86_VOODOO_DRC
DEFS += -DVOODOO_DRC
endif
#-------------------------------------------------
# compile and linking flags
#-------------------------------------------------
MESSTOOLS = chdman$(EXE) imgtool$(EXE)
ifeq ($(MAMEOS),windows)
DEFS += -DWIN32 -DWINNT
EMULATORDLL = $(NAME)lib.dll
EMULATORGUI = $(GUINAME)$(EXE)
EMULATORALL = $(EMULATORDLL) $(EMULATORCLI) $(EMULATORGUI)
MESSTEST = messtest$(EXE)
MESSDOCS = messdocs$(EXE)
MESSTOOLS += wimgtool$(EXE)
else
EMULATORALL = $(EMULATORCLI)
endif
CFLAGS = -std=gnu89 -Imess -Isrc -Isrc/includes -Isrc/$(MAMEOS) -Imess/$(MAMEOS)
ifdef SYMBOLS
CFLAGS += -O0 -Wall -Wno-unused -g
else
CFLAGS += -DNDEBUG \
$(ARCH) -O3 -fno-strict-aliasing \
-Werror -Wall \
-Wno-sign-compare \
-Wno-unused-functions \
-Wpointer-arith \
-Wbad-function-cast \
-Wcast-align \
-Wstrict-prototypes \
-Wundef \
-Wformat-security \
-Wwrite-strings \
-Wdeclaration-after-statement
endif
# extra options needed *only* for the osd files
CFLAGSOSDEPEND = $(CFLAGS)
LDFLAGS = -WO
ifdef SYMBOLS
LDFLAGS =
else
LDFLAGS += -s
endif
ifdef MAP
MAPFLAGS = -Wl,-Map,$(NAME).map
else
MAPFLAGS =
endif
ifdef COMPILESYSTEM_CYGWIN
CFLAGS += -mno-cygwin
LDFLAGS += -mno-cygwin
endif
#-------------------------------------------------
# define the dependency search paths
#-------------------------------------------------
VPATH = src $(wildcard src/cpu/*)
#-------------------------------------------------
# define the standard object directories
#-------------------------------------------------
OBJDIRS = obj $(OBJ) $(OBJ)/cpu $(OBJ)/sound $(OBJ)/$(MAMEOS) \
$(OBJ)/drivers $(OBJ)/machine $(OBJ)/vidhrdw $(OBJ)/sndhrdw $(OBJ)/debug $(OBJ)/xml2info
OBJDIRS += $(OBJ)/mess $(OBJ)/mess/$(MAMEOS) \
$(OBJ)/mess/expat \
$(OBJ)/mess/cpu $(OBJ)/mess/devices \
$(OBJ)/mess/systems $(OBJ)/mess/machine \
$(OBJ)/mess/vidhrdw $(OBJ)/mess/sndhrdw \
$(OBJ)/mess/formats $(OBJ)/mess/tools \
$(OBJ)/mess/tools/dat2html $(OBJ)/mess/tools/mkhdimg \
$(OBJ)/mess/tools/messroms $(OBJ)/mess/tools/imgtool \
$(OBJ)/mess/tools/messdocs $(OBJ)/mess/tools/messtest \
$(OBJ)/mess/tools/mkimage $(OBJ)/mess/sound \
$(OBJ)/ui $(OBJ)/mess/ui
ifeq ($(MAMEOS),windows)
OBJDIRS += $(OBJ)/mess/tools/imgtool/windows \
$(OBJ)/mess/tools/imgtool/windows/res
PLATFORM_TOOL_OBJS = \
$(OBJ)/mess/windows/glob.o \
$(OBJ)/mess/windows/dirutils.o \
$(OBJ)/windows/fileio.o
else
PLATFORM_TOOL_OBJS = $(OBJ)/$(MAMEOS)/fileio.o
endif
#-------------------------------------------------
# define standard libarires for CPU and sounds
#-------------------------------------------------
CPULIB = $(OBJ)/libcpu.a
SOUNDLIB = $(OBJ)/libsound.a
#-------------------------------------------------
# either build or link against the included
# libraries
#-------------------------------------------------
# start with an empty set of libs
LIBS =
# add expat XML library
ifdef BUILD_EXPAT
CFLAGS += -Isrc/expat
OBJDIRS += $(OBJ)/expat
EXPAT = $(OBJ)/libexpat.a
else
LIBS += -lexpat
EXPAT =
endif
# add ZLIB compression library
ifdef BUILD_ZLIB
CFLAGS += -Isrc/zlib
OBJDIRS += $(OBJ)/zlib
ZLIB = $(OBJ)/libz.a
else
LIBS += -lz
ZLIB =
endif
#-------------------------------------------------
# 'all' target needs to go here, before the
# include files which define additional targets
#-------------------------------------------------
all: maketree $(EMULATORCLI) $(EMULATORGUI) $(MESSTEST) $(MESSDOCS) $(MESSTOOLS)
#-------------------------------------------------
# include the various .mak files
#-------------------------------------------------
include src/core.mak
include mess/$(TARGET).mak
ifeq ($(MAMEOS),windows)
include mess/tools/imgtool/windows/wimgtool.mak
endif
include src/$(MAMEOS)/$(MAMEOS).mak
ifeq ($(MAMEOS),windows)
include mess/$(MAMEOS)/$(MAMEOS).mak
endif
include src/cpu/cpu.mak
include src/sound/sound.mak
include mess/cpu/cpu.mak
include mess/sound/sound.mak
# combine the various definitions to one
CDEFS = $(DEFS) $(COREDEFS) $(CPUDEFS) $(SOUNDDEFS) $(ASMDEFS)
#-------------------------------------------------
# primary targets
#-------------------------------------------------
ifeq ($(MAMEOS),windows)
ifdef MSVC_BUILD
DLLLINK=lib
else
DLLLINK=dll
endif
$(EMULATORDLL): $(OBJS) $(COREOBJS) $(OSOBJS) $(CPULIB) $(SOUNDLIB) $(DRVLIBS) $(RESFILE) $(OSDBGOBJS)
# always recompile the version string
$(CC) $(CDEFS) $(CFLAGS) -c src/version.c -o $(OBJ)/version.o
@echo Linking $@...
$(LD) -shared $(LDFLAGS) $(OSDBGLDFLAGS) $^ $(LIBS) -o $@ $(MAPFLAGS)
# gui target
$(EMULATORGUI): $(EMULATORDLL) $(OBJ)/mess/ui/guimain.o $(GUIRESFILE)
@echo Linking $@...
$(LD) $(LDFLAGS) $(WINDOWS_PROGRAM) $(NAME)lib.$(DLLLINK) $(OBJ)/mess/ui/guimain.o $(GUIRESFILE) -o $@
# cli target
$(EMULATORCLI): $(EMULATORDLL) $(OBJ)/mess/windows/climain.o
@echo Linking $@...
$(LD) $(LDFLAGS) $(CONSOLE_PROGRAM) $(NAME)lib.$(DLLLINK) $(OBJ)/mess/windows/climain.o -o $@
else
$(EMULATORCLI): $(OBJS) $(COREOBJS) $(OSOBJS) $(CPULIB) $(SOUNDLIB) $(DRVLIBS) $(LIBS)
$(CC) $(CDEFS) $(CFLAGS) -c src/version.c -o $(OBJ)/version.o
@echo Linking $@...
$(LD) $(LDFLAGS) $(CONSOLE_PROGRAM) $^ -o $@
endif
#############################################################################
romcmp$(EXE): $(OBJ)/romcmp.o $(OBJ)/unzip.o
@echo Linking $@...
$(LD) $(LDFLAGS) $^ $(ZLIB) $(LIBS) -o $@
chdman$(EXE): $(OBJ)/chdman.o $(OBJ)/chd.o $(OBJ)/chdcd.o $(OBJ)/cdrom.o $(OBJ)/md5.o $(OBJ)/sha1.o $(OBJ)/version.o $(OSTOOLOBJS) $(ZLIB) $(OSDBGOBJS)
@echo Linking $@...
$(LD) $(LDFLAGS) $(OSDBGLDFLAGS) $^ $(LIBS) -o $@
xml2info$(EXE): $(OBJ)/xml2info.o $(EXPAT) $(OSDBGOBJS)
@echo Linking $@...
$(LD) $(LDFLAGS) $(OSDBGLDFLAGS) $^ $(LIBS) -o $@
dat2html$(EXE): $(DAT2HTML_OBJS) $(OSDBGOBJS)
@echo Compiling $@...
$(LD) $(LDFLAGS) $(OSDBGLDFLAGS) $^ -o $@
messdocs$(EXE): $(MESSDOCS_OBJS) $(OBJ)/mess/windows/dirutils.o $(OSDBGOBJS)
@echo Compiling $@...
$(LD) $(LDFLAGS) $(OSDBGLDFLAGS) $^ -o $@
imgtool$(EXE): $(IMGTOOL_OBJS) $(PLATFORM_TOOL_OBJS) $(ZLIB) $(OSDBGOBJS)
@echo Compiling $@...
$(LD) $(LDFLAGS) $(OSTOOLOBJS) $(OSDBGLDFLAGS) $^ $(ZLIB) $(LIBS) -o $@
wimgtool$(EXE): $(WIMGTOOL_OBJS) $(PLATFORM_TOOL_OBJS) $(ZLIB) $(OSDBGOBJS)
@echo Compiling $@...
$(LD) $(LDFLAGS) $(OSTOOLOBJS) $(OSDBGLDFLAGS) $(LIBS) $(WINDOWS_PROGRAM) $^ $(ZLIB) $(LIBS) -lcomctl32 -lshlwapi -o $@
messtest$(EXE): $(OBJS) $(COREOBJS) $(CPULIB) $(SOUNDLIB) $(DRVLIBS) $(MESSTEST_OBJS) $(OSTOOLOBJS) \
$(OBJ)/windows/asmtile.o \
$(OBJ)/windows/ticker.o \
$(OBJ)/windows/fileio.o \
$(OBJ)/windows/rc.o \
$(OBJ)/windows/misc.o \
$(OBJ)/windows/winalloc.o \
$(OBJ)/mess/windows/dirio.o \
$(OBJ)/mess/windows/dirutils.o \
$(OBJ)/mess/windows/glob.o \
$(OBJ)/mess/windows/parallel.o \
$(OBJ)/mess/windows/strconv.o
@echo Linking $@...
$(LD) $(LDFLAGS) $(CONSOLE_PROGRAM) $^ -Wl,--allow-multiple-definition $(ZLIB) $(LIBS) -lwinmm -o $@
#-------------------------------------------------
# library targets and dependencies
#-------------------------------------------------
$(CPULIB): $(CPUOBJS)
ifdef DEBUG
$(CPULIB): $(DBGOBJS)
endif
$(SOUNDLIB): $(SOUNDOBJS)
$(OBJ)/libexpat.a: $(OBJ)/expat/xmlparse.o $(OBJ)/expat/xmlrole.o $(OBJ)/expat/xmltok.o
$(OBJ)/libz.a: $(OBJ)/zlib/adler32.o $(OBJ)/zlib/compress.o $(OBJ)/zlib/crc32.o $(OBJ)/zlib/deflate.o \
$(OBJ)/zlib/gzio.o $(OBJ)/zlib/inffast.o $(OBJ)/zlib/inflate.o $(OBJ)/zlib/infback.o \
$(OBJ)/zlib/inftrees.o $(OBJ)/zlib/trees.o $(OBJ)/zlib/uncompr.o $(OBJ)/zlib/zutil.o
#-------------------------------------------------
# generic rules
#-------------------------------------------------
$(OBJ)/$(MAMEOS)/%.o: src/$(MAMEOS)/%.c
@echo Compiling $<...
$(CC) $(CDEFS) $(CFLAGSOSDEPEND) -c $< -o $@
$(OBJ)/%.o: src/%.c
@echo Compiling $<...
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
$(OBJ)/%.pp: src/%.c
@echo Compiling $<...
$(CC) $(CDEFS) $(CFLAGS) -E $< -o $@
$(OBJ)/%.s: src/%.c
@echo Compiling $<...
$(CC) $(CDEFS) $(CFLAGS) -S $< -o $@
$(OBJ)/mess/%.o: mess/%.c
@echo Compiling $<...
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
$(OBJ)/mess/%.pp: mess/%.c
@echo Compiling $<...
$(CC) $(CDEFS) $(CFLAGS) -E $< -o $@
$(OBJ)/mess/%.S: mess/%.c
@echo Compiling $<...
$(CC) $(CDEFS) $(CFLAGS) -S $< -o $@
$(OBJ)/%.a:
@echo Archiving $@...
$(RM) $@
$(AR) -cr $@ $^
%$(EXE):
@echo Linking $@...
$(LD) $(LDFLAGS) $(OSDBGLDFLAGS) $^ $(LIBS) -o $@
mess.chm: $(MESSDOCS)
$(MESSDOCS) docs/wintoc.xml obj/help
$(HHC) obj\\help\\mess.hhp
@cp obj/help/mess.chm $@
makedir:
@echo make makedir is no longer necessary, just type make
$(sort $(OBJDIRS)):
$(MD) $@
maketree: $(sort $(OBJDIRS)) $(OSPREBUILD)
clean: cleantools cleantexts
@echo Deleting object tree $(OBJ)...
$(RM) -r $(OBJ) lib$(NAME).a
@echo Deleting $(EMULATORALL)...
$(RM) $(EMULATORALL)
@echo Deleting Map file...
$(RM) $(NAME).map
@echo Deleting $(MESSDOCS)
$(RM) $(MESSDOCS)
@echo Deleting $(MESSTEST)
$(RM) $(MESSTEST)
cleantools:
@echo Cleaning Tools
$(RM) $(MESSTOOLS)
cleantexts:
@echo Cleaning Text Files
$(RM) $(TEXTS)
@echo Removing Sysinfo directory contents
$(RM) -r sysinfo
tests: $(MESSTEST)
$(MESSTEST) mess/tools/messtest/tests.xml
|