makefile.sdl
| r1391 | r1392 | |
| 2 | 2 | # |
| 3 | 3 | # makefile.sdl |
| 4 | 4 | # |
| 5 | | # Core makefile for building MESS and derivatives |
| 5 | # Core makefile for building SDLMAME and derivatives |
| 6 | 6 | # |
| 7 | # Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. |
| 8 | # Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | # |
| 10 | # SDLMAME/MESS by Olivier Galibert and R. Belmont |
| 11 | # |
| 7 | 12 | ########################################################################### |
| 8 | 13 | |
| 9 | 14 | |
| r1391 | r1392 | |
| 59 | 64 | |
| 60 | 65 | |
| 61 | 66 | #------------------------------------------------- |
| 67 | # configure name of final executable |
| 68 | #------------------------------------------------- |
| 69 | |
| 70 | # uncomment and specify prefix to be added to the name |
| 71 | # PREFIX = |
| 72 | |
| 73 | # uncomment and specify suffix to be added to the name |
| 74 | # SUFFIX = |
| 75 | |
| 76 | |
| 77 | |
| 78 | #------------------------------------------------- |
| 79 | # specify architecture-specific optimizations |
| 80 | #------------------------------------------------- |
| 81 | |
| 82 | # uncomment and specify architecture-specific optimizations here |
| 83 | # some examples: |
| 84 | # optimize for I686: ARCHOPTS = -march=pentiumpro |
| 85 | # optimize for Core 2: ARCHOPTS = -march=pentium-m -msse3 |
| 86 | # optimize for G4: ARCHOPTS = -mcpu=G4 |
| 87 | # note that we leave this commented by default so that you can |
| 88 | # configure this in your environment and never have to think about it |
| 89 | # ARCHOPTS = |
| 90 | |
| 91 | |
| 92 | |
| 93 | #------------------------------------------------- |
| 62 | 94 | # specify program options; see each option below |
| 63 | 95 | # for details |
| 64 | 96 | #------------------------------------------------- |
| r1391 | r1392 | |
| 79 | 111 | # X86_VOODOO_DRC = 1 |
| 80 | 112 | |
| 81 | 113 | |
| 82 | | WINUI = 1 |
| 83 | | MESS = 1 |
| 84 | 114 | |
| 85 | | |
| 86 | 115 | #------------------------------------------------- |
| 87 | 116 | # specify build options; see each option below |
| 88 | 117 | # for details |
| 89 | 118 | #------------------------------------------------- |
| 90 | 119 | |
| 91 | | # uncomment one of the next lines to build a target-optimized build |
| 92 | | # ATHLON = 1 |
| 93 | | # I686 = 1 |
| 94 | | # P4 = 1 |
| 95 | | # PM = 1 |
| 96 | | # AMD64 = 1 |
| 97 | | # G3 = 1 |
| 98 | | # G4 = 1 |
| 99 | | # G5 = 1 |
| 100 | | # CELL = 1 |
| 101 | | |
| 102 | 120 | # uncomment next line if you are building for a 64-bit target |
| 103 | 121 | # PTR64 = 1 |
| 104 | 122 | |
| 123 | # uncomment next line if you are building for a big-endian target |
| 124 | # BIGENDIAN = 1 |
| 125 | |
| 105 | 126 | # uncomment next line to build expat as part of MAME build |
| 106 | 127 | BUILD_EXPAT = 1 |
| 107 | 128 | |
| r1391 | r1392 | |
| 117 | 138 | # uncomment next line to generate a link map for exception handling in windows |
| 118 | 139 | # MAP = 1 |
| 119 | 140 | |
| 120 | | # uncomment next line to generate a unicode build |
| 121 | | # UNICODE = 1 |
| 122 | | |
| 123 | 141 | # specify optimization level or leave commented to use the default |
| 124 | 142 | # (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols) |
| 125 | 143 | # OPTIMIZE = 3 |
| r1391 | r1392 | |
| 182 | 200 | |
| 183 | 201 | |
| 184 | 202 | #------------------------------------------------- |
| 185 | | # based on the architecture, determine suffixes |
| 186 | | # and endianness |
| 187 | | #------------------------------------------------- |
| 188 | | |
| 189 | | # by default, don't compile for a specific target CPU |
| 190 | | # and assume little-endian (x86) |
| 191 | | ARCH = |
| 192 | | ENDIAN = little |
| 193 | | |
| 194 | | # architecture-specific builds get extra options |
| 195 | | ifdef ATHLON |
| 196 | | SUFFIX = at |
| 197 | | ARCH = -march=athlon |
| 198 | | endif |
| 199 | | |
| 200 | | ifdef I686 |
| 201 | | SUFFIX = pp |
| 202 | | ARCH = -march=pentiumpro |
| 203 | | endif |
| 204 | | |
| 205 | | ifdef P4 |
| 206 | | SUFFIX = p4 |
| 207 | | ARCH = -march=pentium4 |
| 208 | | endif |
| 209 | | |
| 210 | | ifdef AMD64 |
| 211 | | SUFFIX = 64 |
| 212 | | ARCH = -march=athlon64 |
| 213 | | endif |
| 214 | | |
| 215 | | ifdef PM |
| 216 | | SUFFIX = pm |
| 217 | | ARCH = -march=pentium3 -msse2 |
| 218 | | endif |
| 219 | | |
| 220 | | ifdef G3 |
| 221 | | SUFFIX = g3 |
| 222 | | ARCH = -mtune=G3 -isysroot /Developer/SDKs/MacOSX10.3.9.sdk |
| 223 | | ENDIAN = big |
| 224 | | endif |
| 225 | | |
| 226 | | ifdef G4 |
| 227 | | SUFFIX = g4 |
| 228 | | ARCH = -mcpu=G4 |
| 229 | | ENDIAN = big |
| 230 | | endif |
| 231 | | |
| 232 | | ifdef G5 |
| 233 | | SUFFIX = g5 |
| 234 | | ARCH = -mcpu=G5 |
| 235 | | ENDIAN = big |
| 236 | | endif |
| 237 | | |
| 238 | | ifdef CELL |
| 239 | | SUFFIX = cbe |
| 240 | | ARCH = |
| 241 | | ENDIAN = big |
| 242 | | endif |
| 243 | | |
| 244 | | |
| 245 | | #------------------------------------------------- |
| 246 | 203 | # form the name of the executable |
| 247 | 204 | #------------------------------------------------- |
| 248 | 205 | |
| 249 | | ifdef MSVC_BUILD |
| 250 | | SUFFIX:=$(SUFFIX)vc |
| 251 | | endif |
| 252 | | |
| 253 | | # unicode builds just get the additional 'u' suffix |
| 254 | | ifdef UNICODE |
| 255 | | SUFFIX:=$(SUFFIX)u |
| 256 | | endif |
| 257 | | |
| 258 | 206 | # debug builds just get the 'd' suffix and nothing more |
| 259 | 207 | ifdef DEBUG |
| 260 | | SUFFIX:=$(SUFFIX)d |
| 208 | DEBUGSUFFIX = d |
| 261 | 209 | endif |
| 262 | 210 | |
| 263 | 211 | # the name is just 'target' if no subtarget; otherwise it is |
| r1391 | r1392 | |
| 268 | 216 | NAME = $(TARGET)$(SUBTARGET) |
| 269 | 217 | endif |
| 270 | 218 | |
| 271 | | # fullname is prefix+name+suffix |
| 272 | | FULLNAME = $(PREFIX)$(NAME)$(SUFFIX) |
| 273 | | FULLGUINAME = $(PREFIX)$(NAME)gui$(SUFFIX) |
| 219 | # fullname is prefix+name+suffix+debugsuffix |
| 220 | FULLNAME = $(PREFIX)$(NAME)$(SUFFIX)$(DEBUGSUFFIX) |
| 274 | 221 | |
| 275 | 222 | # add an EXE suffix to get the final emulator name |
| 276 | | EMULATORCLI = $(FULLNAME)$(EXE) |
| 277 | | EMULATORGUI = $(FULLGUINAME)$(EXE) |
| 223 | EMULATOR = $(FULLNAME)$(EXE) |
| 278 | 224 | |
| 279 | 225 | |
| 280 | 226 | |
| r1391 | r1392 | |
| 308 | 254 | DEFS += -DINLINE="static __inline__" |
| 309 | 255 | |
| 310 | 256 | # define LSB_FIRST if we are a little-endian target |
| 311 | | ifeq ($(ENDIAN),little) |
| 257 | ifndef BIGENDIAN |
| 312 | 258 | DEFS += -DLSB_FIRST |
| 313 | 259 | endif |
| 314 | 260 | |
| r1391 | r1392 | |
| 343 | 289 | # we compile to C89 standard with GNU extensions |
| 344 | 290 | CFLAGS = -std=gnu89 |
| 345 | 291 | |
| 292 | # this speeds it up a bit by piping between the preprocessor/compiler/assembler |
| 293 | CFLAGS += -pipe |
| 294 | |
| 346 | 295 | # add -g if we need symbols |
| 347 | 296 | ifdef SYMBOLS |
| 348 | 297 | CFLAGS += -g |
| r1391 | r1392 | |
| 358 | 307 | -Wundef \ |
| 359 | 308 | -Wformat-security \ |
| 360 | 309 | -Wwrite-strings \ |
| 361 | | -Wno-unused-function \ |
| 362 | 310 | |
| 311 | # add profiling information for the compiler |
| 312 | ifdef PROFILE |
| 313 | CFLAGS += -pg |
| 314 | endif |
| 315 | |
| 363 | 316 | # this warning is not supported on the os2 compilers |
| 364 | 317 | ifneq ($(TARGETOS),os2) |
| 365 | 318 | CFLAGS += -Wdeclaration-after-statement |
| r1391 | r1392 | |
| 370 | 323 | |
| 371 | 324 | # if we are optimizing, include optimization options |
| 372 | 325 | # and make all errors into warnings |
| 373 | | # but not on 64-bit or debug builds |
| 374 | 326 | ifneq ($(OPTIMIZE),0) |
| 375 | | CFLAGS += $(ARCH) -fno-strict-aliasing |
| 327 | #CFLAGS += -Werror $(ARCHOPTS) -fno-strict-aliasing |
| 328 | CFLAGS += $(ARCHOPTS) -fno-strict-aliasing |
| 329 | endif |
| 376 | 330 | |
| 377 | | # only -Werror if not PTR64 and not DEBUG |
| 378 | | ifndef PTR64 |
| 379 | | ifndef DEBUG |
| 380 | | #CFLAGS += -Werror |
| 381 | | endif # !DEBUG |
| 382 | | endif # !PTR64 |
| 383 | | endif # neq OPTIMIZE |
| 384 | | |
| 385 | | ifeq ($(OSD),windows) |
| 386 | | |
| 387 | | DEFS += -DWIN32 -DWINNT |
| 388 | | EMULATORDLL = $(FULLNAME)lib.dll |
| 389 | | EMULATORALL = $(EMULATORDLL) $(EMULATORCLI) $(EMULATORGUI) |
| 390 | | MESSDOCS = messdocs$(EXE) |
| 391 | | |
| 392 | | else |
| 393 | | |
| 394 | | EMULATORALL = $(EMULATORCLI) |
| 395 | | |
| 331 | # if symbols are on, make sure we have frame pointers |
| 332 | ifdef SYMBOLS |
| 333 | CFLAGS += -fno-omit-frame-pointer |
| 396 | 334 | endif |
| 397 | 335 | |
| 398 | | # extra options needed *only* for the osd files |
| 399 | | CFLAGSOSDEPEND = $(CFLAGS) |
| 400 | 336 | |
| 337 | |
| 401 | 338 | #------------------------------------------------- |
| 402 | 339 | # include paths |
| 403 | 340 | #------------------------------------------------- |
| r1391 | r1392 | |
| 414 | 351 | -I$(SRC)/osd \ |
| 415 | 352 | -I$(SRC)/osd/$(OSD) \ |
| 416 | 353 | |
| 417 | | ifdef MESS |
| 418 | | CFLAGS += \ |
| 419 | | -I$(SRC)/mame \ |
| 420 | | -I$(SRC)/mame/includes \ |
| 421 | | -I$(SRC)/$(TARGET)/osd/$(OSD) |
| 422 | | endif |
| 423 | 354 | |
| 424 | 355 | |
| 425 | 356 | #------------------------------------------------- |
| r1391 | r1392 | |
| 428 | 359 | |
| 429 | 360 | # LDFLAGS are used generally; LDFLAGSEMULATOR are additional |
| 430 | 361 | # flags only used when linking the core emulator |
| 431 | | LDFLAGS = |
| 362 | ifneq ($(TARGETOS),macosx) |
| 363 | LDFLAGS = -Wl,--warn-common |
| 364 | else |
| 365 | LDFLAGS= |
| 366 | endif |
| 432 | 367 | LDFLAGSEMULATOR = |
| 433 | 368 | |
| 434 | | # strip symbols and other metadata in non-symbols builds |
| 369 | # add profiling information for the linker |
| 370 | ifdef PROFILE |
| 371 | LDFLAGS += -pg |
| 372 | endif |
| 373 | |
| 374 | # strip symbols and other metadata in non-symbols and non profiling builds |
| 435 | 375 | ifndef SYMBOLS |
| 376 | ifndef PROFILE |
| 377 | ifneq ($(TARGETOS),macosx) |
| 436 | 378 | LDFLAGS += -s |
| 437 | 379 | endif |
| 380 | endif |
| 381 | endif |
| 438 | 382 | |
| 439 | 383 | # output a map file (emulator only) |
| 440 | 384 | ifdef MAP |
| r1391 | r1392 | |
| 507 | 451 | # include files which define additional targets |
| 508 | 452 | #------------------------------------------------- |
| 509 | 453 | |
| 510 | | all: maketree emulator tools |
| 454 | all: maketree buildtools emulator tools |
| 511 | 455 | |
| 512 | 456 | |
| 513 | 457 | |
| r1391 | r1392 | |
| 519 | 463 | include $(SRC)/osd/$(OSD)/$(OSD).mak |
| 520 | 464 | |
| 521 | 465 | # then the various core pieces |
| 522 | | include $(SRC)/mess/messcore.mak |
| 523 | 466 | include $(SRC)/$(TARGET)/$(SUBTARGET).mak |
| 524 | | include $(SRC)/mess/osd/$(OSD)/$(OSD).mak |
| 525 | 467 | include $(SRC)/emu/emu.mak |
| 526 | 468 | include $(SRC)/lib/lib.mak |
| 527 | 469 | include $(SRC)/build/build.mak |
| r1391 | r1392 | |
| 536 | 478 | # primary targets |
| 537 | 479 | #------------------------------------------------- |
| 538 | 480 | |
| 539 | | emulator: maketree $(BUILD) $(EMULATORALL) |
| 481 | emulator: maketree $(BUILD) $(EMULATOR) |
| 540 | 482 | |
| 483 | buildtools: maketree $(BUILD) |
| 484 | |
| 541 | 485 | tools: maketree $(TOOLS) |
| 542 | 486 | |
| 487 | help: maketree $(HELP) |
| 488 | |
| 543 | 489 | maketree: $(sort $(OBJDIRS)) |
| 544 | 490 | |
| 545 | 491 | clean: |
| 546 | 492 | @echo Deleting object tree $(OBJ)... |
| 547 | 493 | $(RM) -r $(OBJ) |
| 548 | | @echo Deleting $(EMULATORALL)... |
| 549 | | $(RM) $(EMULATORALL) |
| 494 | @echo Deleting $(EMULATOR)... |
| 495 | $(RM) $(EMULATOR) |
| 550 | 496 | @echo Deleting $(TOOLS)... |
| 551 | 497 | $(RM) $(TOOLS) |
| 552 | 498 | ifdef MAP |
| r1391 | r1392 | |
| 569 | 515 | # executable targets and dependencies |
| 570 | 516 | #------------------------------------------------- |
| 571 | 517 | |
| 518 | ifndef EXECUTABLE_DEFINED |
| 572 | 519 | |
| 573 | | ifeq ($(OSD),windows) |
| 574 | | |
| 575 | | ifdef MSVC_BUILD |
| 576 | | DLLLINK=lib |
| 577 | | else |
| 578 | | DLLLINK=dll |
| 579 | | endif |
| 580 | | |
| 581 | | $(EMULATORDLL): $(VERSIONOBJ) $(OBJ)/mess/osd/windows/messlib.o $(DRVLIBS) $(LIBOSD) $(LIBEMU) $(LIBCPU) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(LIBOCORE) $(LIBWINUI) $(MESS_WINOBJ)/mess.res |
| 520 | $(EMULATOR): $(VERSIONOBJ) $(DRVLIBS) $(LIBOSD) $(LIBEMU) $(LIBCPU) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(LIBOCORE) $(RESFILE) |
| 582 | 521 | # always recompile the version string |
| 583 | 522 | $(CC) $(CDEFS) $(CFLAGS) -c $(SRC)/version.c -o $(VERSIONOBJ) |
| 584 | 523 | @echo Linking $@... |
| 585 | | $(LD) -shared $(LDFLAGS) $(LDFLAGSEMULATOR) $^ $(LIBS) -o $@ |
| 524 | $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $^ $(LIBS) -o $@ |
| 586 | 525 | |
| 587 | | # gui target |
| 588 | | $(EMULATORGUI): $(EMULATORDLL) $(OBJ)/mess/osd/windows/ui/guimain.o $(GUIRESFILE) |
| 589 | | @echo Linking $@... |
| 590 | | $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) -mwindows $(FULLNAME)lib.$(DLLLINK) $(OBJ)/mess/osd/windows/ui/guimain.o $(GUIRESFILE) $(LIBS) -o $@ |
| 591 | | |
| 592 | | # cli target |
| 593 | | $(EMULATORCLI): $(EMULATORDLL) $(OBJ)/mess/osd/windows/climain.o |
| 594 | | @echo Linking $@... |
| 595 | | $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) -mconsole $(FULLNAME)lib.$(DLLLINK) $(OBJ)/mess/osd/windows/climain.o $(LIBS) -o $@ |
| 596 | | |
| 597 | | else |
| 598 | | |
| 599 | | $(EMULATORCLI): $(VERSIONOBJ) $(DRVLIBS) $(LIBOSD) $(LIBEMU) $(LIBCPU) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(LIBOCORE) |
| 600 | | $(CC) $(CDEFS) $(CFLAGS) -c $(SRC)/version.c -o $(VERSIONOBJ) |
| 601 | | @echo Linking $@... |
| 602 | | $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) -mconsole $^ $(LIBS) -o $@ |
| 603 | | |
| 604 | 526 | endif |
| 605 | 527 | |
| 606 | 528 | |
| r1391 | r1392 | |
| 640 | 562 | @echo Objective-C compiling $<... |
| 641 | 563 | $(CC) $(CDEFS) $(CFLAGS) -c $< -o $@ |
| 642 | 564 | endif |
| 643 | | |
| 644 | | mess.chm: $(MESSDOCS) |
| 645 | | $(MESSDOCS) docs/wintoc.xml obj/help |
| 646 | | $(HHC) obj\\help\\mess.hhp |
| 647 | | @cp obj/help/mess.chm $@ |