2012-10-29 14:55:14 +00:00
|
|
|
# set this to mame, mess or the destination you want to build
|
|
|
|
# TARGET = mame
|
|
|
|
# TARGET = mess
|
|
|
|
# TARGET = mmsnd
|
|
|
|
# example for a tiny compile
|
|
|
|
# TARGET = tiny
|
|
|
|
ifeq ($(TARGET),)
|
|
|
|
TARGET = mame
|
|
|
|
endif
|
|
|
|
|
|
|
|
# uncomment next line to include the debugger
|
|
|
|
# DEBUG = 1
|
|
|
|
|
|
|
|
# uncomment next line to include the symbols for symify
|
|
|
|
# SYMBOLS = 1
|
|
|
|
|
|
|
|
# uncomment next line to use Assembler 68000 engine
|
|
|
|
# X86_ASM_68000 = 1
|
|
|
|
|
|
|
|
# uncomment next line to use Assembler 68020 engine
|
|
|
|
# X86_ASM_68020 = 1
|
|
|
|
|
|
|
|
# uncomment next line to use DRC MIPS3 engine
|
2013-07-31 14:27:06 +00:00
|
|
|
# X86_MIPS3_DRC = 1
|
2012-10-29 14:55:14 +00:00
|
|
|
|
2012-11-01 01:50:20 +00:00
|
|
|
MAMEOS = libretro
|
2012-10-29 14:55:14 +00:00
|
|
|
|
|
|
|
# CPU core include paths
|
|
|
|
VPATH=src $(wildcard src/cpu/*)
|
|
|
|
|
|
|
|
# compiler, linker and utilities
|
|
|
|
AR = @ar
|
2012-10-29 15:26:27 +00:00
|
|
|
NATIVECC = @gcc
|
2012-10-29 14:55:14 +00:00
|
|
|
CC = @gcc
|
|
|
|
LD = @gcc
|
|
|
|
ASM = @nasm
|
|
|
|
ASMFLAGS = -f coff
|
|
|
|
MD = -mkdir
|
|
|
|
RM = @rm -f
|
|
|
|
|
|
|
|
|
|
|
|
ifeq ($(MAMEOS),msdos)
|
|
|
|
PREFIX = d
|
|
|
|
else
|
|
|
|
PREFIX =
|
|
|
|
endif
|
|
|
|
|
|
|
|
# build the targets in different object dirs, since mess changes
|
|
|
|
# some structures and thus they can't be linked against each other.
|
2012-11-01 01:50:20 +00:00
|
|
|
OBJ = obj/mame
|
2012-11-04 00:21:30 +00:00
|
|
|
DEFS = -DINLINE="static __inline__" -Dasm=__asm__
|
2012-10-29 14:55:14 +00:00
|
|
|
|
2013-03-29 16:06:00 +00:00
|
|
|
CFLAGS = -Isrc -Isrc/includes -Isrc/$(MAMEOS) -I$(OBJ)/cpu/m68000 -Isrc/cpu/m68000
|
2012-10-29 14:55:14 +00:00
|
|
|
|
2012-11-10 20:29:08 +00:00
|
|
|
RETRO_PROFILE = 0
|
|
|
|
CFLAGS += -DRETRO_PROFILE=$(RETRO_PROFILE)
|
|
|
|
|
2013-06-09 21:10:58 +00:00
|
|
|
ifneq ($(platform), sncps3)
|
|
|
|
CFLAGS += -Wall -Wno-sign-compare -Wunused \
|
|
|
|
-Wpointer-arith -Wbad-function-cast -Wcast-align -Waggregate-return \
|
|
|
|
-Wshadow -Wstrict-prototypes -Wundef \
|
|
|
|
-Wformat-security -Wwrite-strings \
|
|
|
|
-Wdisabled-optimization
|
|
|
|
endif
|
2012-11-07 22:57:03 +00:00
|
|
|
|
2012-10-29 14:55:14 +00:00
|
|
|
ifdef SYMBOLS
|
2012-10-29 15:26:27 +00:00
|
|
|
CFLAGS += -O0 -Wall -Wno-unused -g
|
2012-10-29 14:55:14 +00:00
|
|
|
else
|
2013-06-09 21:10:58 +00:00
|
|
|
CFLAGS += -DNDEBUG $(ARCH) -O3 -fomit-frame-pointer -fstrict-aliasing
|
2012-10-29 14:55:14 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# extra options needed *only* for the osd files
|
|
|
|
CFLAGSOSDEPEND = $(CFLAGS)
|
|
|
|
|
|
|
|
# the windows osd code at least cannot be compiled with -pedantic
|
|
|
|
CFLAGSPEDANTIC = $(CFLAGS) -pedantic
|
|
|
|
|
2015-03-06 11:31:33 +00:00
|
|
|
ZLIBOBJS :=
|
|
|
|
|
2012-10-29 14:55:14 +00:00
|
|
|
OBJDIRS = obj $(OBJ) $(OBJ)/cpu $(OBJ)/sound $(OBJ)/$(MAMEOS) \
|
|
|
|
$(OBJ)/drivers $(OBJ)/machine $(OBJ)/vidhrdw $(OBJ)/sndhrdw
|
|
|
|
ifdef MESS
|
|
|
|
OBJDIRS += $(OBJ)/mess $(OBJ)/mess/systems $(OBJ)/mess/machine \
|
|
|
|
$(OBJ)/mess/vidhrdw $(OBJ)/mess/sndhrdw $(OBJ)/mess/tools
|
|
|
|
endif
|
|
|
|
|
2012-11-01 01:50:20 +00:00
|
|
|
include src/$(MAMEOS)/$(MAMEOS).mak
|
|
|
|
all: maketree $(EMULATOR)
|
2012-10-29 14:55:14 +00:00
|
|
|
|
|
|
|
# include the various .mak files
|
|
|
|
include src/core.mak
|
|
|
|
include src/$(TARGET).mak
|
|
|
|
include src/rules.mak
|
|
|
|
|
|
|
|
ifdef DEBUG
|
|
|
|
DBGDEFS = -DMAME_DEBUG
|
|
|
|
else
|
|
|
|
DBGDEFS =
|
|
|
|
DBGOBJS =
|
|
|
|
endif
|
|
|
|
|
2015-11-03 16:15:53 +00:00
|
|
|
# platform .mak files will want to add to this
|
|
|
|
ifeq ($(STATIC_LINKING),1)
|
|
|
|
CFLAGS += -Isrc/libretro/includes/zlib
|
|
|
|
else
|
|
|
|
ZLIBOBJS := deps/zlib/adler32.c \
|
|
|
|
deps/zlib/compress.c \
|
|
|
|
deps/zlib/crc32.c \
|
|
|
|
deps/zlib/deflate.c \
|
|
|
|
deps/zlib/gzclose.c \
|
|
|
|
deps/zlib/gzlib.c \
|
|
|
|
deps/zlib/gzread.c \
|
|
|
|
deps/zlib/gzwrite.c \
|
|
|
|
deps/zlib/inffast.c \
|
|
|
|
deps/zlib/inflate.c \
|
|
|
|
deps/zlib/inftrees.c \
|
|
|
|
deps/zlib/trees.c \
|
|
|
|
deps/zlib/uncompr.c \
|
|
|
|
deps/zlib/zutil.c \
|
|
|
|
deps/zlib/ioapi.c \
|
|
|
|
deps/zlib/unzip.c
|
|
|
|
endif
|
|
|
|
|
2012-10-29 14:55:14 +00:00
|
|
|
# combine the various definitions to one
|
|
|
|
CDEFS = $(DEFS) $(COREDEFS) $(CPUDEFS) $(SOUNDDEFS) $(ASMDEFS) $(DBGDEFS)
|
2015-11-03 16:15:53 +00:00
|
|
|
|
2012-10-29 14:55:14 +00:00
|
|
|
# primary target
|
2015-03-06 11:31:33 +00:00
|
|
|
$(EMULATOR): $(OBJS) $(COREOBJS) $(OSOBJS) $(ZLIBOBJS) $(DRVLIBS)
|
2015-11-03 16:15:53 +00:00
|
|
|
ifeq ($(STATIC_LINKING),1)
|
2012-11-04 00:21:30 +00:00
|
|
|
@echo Archiving $@...
|
2015-03-06 11:31:33 +00:00
|
|
|
$(AR) rcs $@ $(OBJS) $(COREOBJS) $(OSOBJS) $(ZLIBOBJS) $(DRVLIBS)
|
2012-11-04 00:21:30 +00:00
|
|
|
else
|
2012-10-29 14:55:14 +00:00
|
|
|
@echo Linking $@...
|
2015-03-06 11:31:33 +00:00
|
|
|
$(LD) $(LDFLAGS) $(OBJS) $(COREOBJS) $(OSOBJS) $(ZLIBOBJS) $(LIBS) $(DRVLIBS) -o $@
|
2012-11-04 00:21:30 +00:00
|
|
|
endif
|
2012-10-29 14:55:14 +00:00
|
|
|
|
|
|
|
$(OBJ)/$(MAMEOS)/%.o: src/$(MAMEOS)/%.c
|
2012-10-31 17:45:40 +00:00
|
|
|
$(CC) $(CDEFS) $(CFLAGSOSDEPEND) $(PLATCFLAGS) -c $< -o $@
|
2012-10-29 14:55:14 +00:00
|
|
|
|
|
|
|
$(OBJ)/%.o: src/%.c
|
2012-10-31 17:45:40 +00:00
|
|
|
$(CC) $(CDEFS) $(CFLAGS) $(PLATCFLAGS) -c $< -o $@
|
2012-10-29 14:55:14 +00:00
|
|
|
|
|
|
|
# generated asm files for the 68000 emulator
|
|
|
|
$(OBJ)/cpu/m68000/68000.o: $(OBJ)/cpu/m68000/68000.asm
|
|
|
|
@echo Assembling $<...
|
|
|
|
$(ASM) -o $@ $(ASMFLAGS) $(subst -D,-d,$(ASMDEFS)) $<
|
|
|
|
|
|
|
|
$(OBJ)/cpu/m68000/68020.o: $(OBJ)/cpu/m68000/68020.asm
|
|
|
|
@echo Assembling $<...
|
|
|
|
$(ASM) -o $@ $(ASMFLAGS) $(subst -D,-d,$(ASMDEFS)) $<
|
|
|
|
|
|
|
|
$(OBJ)/%.a:
|
|
|
|
@echo Archiving $@...
|
|
|
|
$(RM) $@
|
|
|
|
$(AR) cr $@ $^
|
|
|
|
|
|
|
|
makedir:
|
|
|
|
@echo make makedir is no longer necessary, just type make
|
|
|
|
|
|
|
|
$(sort $(OBJDIRS)):
|
|
|
|
$(MD) $@
|
|
|
|
|
|
|
|
maketree: $(sort $(OBJDIRS))
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo Deleting object tree $(OBJ)...
|
|
|
|
$(RM) -r $(OBJ)
|
|
|
|
@echo Deleting $(EMULATOR)...
|
|
|
|
$(RM) $(EMULATOR)
|
|
|
|
|
|
|
|
clean68k:
|
|
|
|
@echo Deleting 68k files...
|
|
|
|
$(RM) -r $(OBJ)/cpuintrf.o
|
|
|
|
$(RM) -r $(OBJ)/drivers/cps2.o
|
|
|
|
$(RM) -r $(OBJ)/cpu/m68000
|
|
|
|
|
|
|
|
|