mirror of
https://github.com/libretro/mame2003-plus-libretro.git
synced 2024-11-30 03:50:24 +00:00
87f91b8f44
The MAMEOS option to make is no longer needed. The output library will have the proper name. The build will no longer try to execute the resulting library. ROM set verification tools are no longer built.
201 lines
5.4 KiB
Makefile
201 lines
5.4 KiB
Makefile
# 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
|
|
X86_MIPS3_DRC = 1
|
|
|
|
# uncomment next line to use cygwin compiler
|
|
# COMPILESYSTEM_CYGWIN = 1
|
|
|
|
MAMEOS = libretro
|
|
|
|
# CPU core include paths
|
|
VPATH=src $(wildcard src/cpu/*)
|
|
|
|
# compiler, linker and utilities
|
|
AR = @ar
|
|
NATIVECC = @gcc
|
|
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.
|
|
OBJ = obj/mame
|
|
DEFS = -DLSB_FIRST -DINLINE="static __inline__" -Dasm=__asm__
|
|
|
|
CFLAGS = -std=gnu99 -Isrc -Isrc/includes -Isrc/$(MAMEOS) -I$(OBJ)/cpu/m68000 -Isrc/cpu/m68000
|
|
|
|
ifdef SYMBOLS
|
|
CFLAGS += -O0 -Wall -Wno-unused -g
|
|
else
|
|
CFLAGS += -DNDEBUG \
|
|
$(ARCH) -O3 -fomit-frame-pointer -fstrict-aliasing \
|
|
-Wall -Wno-sign-compare -Wunused \
|
|
-Wpointer-arith -Wbad-function-cast -Wcast-align -Waggregate-return \
|
|
-Wshadow -Wstrict-prototypes -Wundef \
|
|
-Wformat-security -Wwrite-strings \
|
|
-Wdisabled-optimization \
|
|
# -Wredundant-decls
|
|
# -Wfloat-equal
|
|
# -Wunreachable-code -Wpadded
|
|
# -W had to remove because of the "missing initializer" warning
|
|
# -Wlarger-than-262144 \
|
|
# -Wcast-qual \
|
|
# -Wwrite-strings \
|
|
# -Wconversion \
|
|
# -Wmissing-prototypes \
|
|
# -Wmissing-declarations
|
|
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
|
|
|
|
# platform .mak files will want to add to this
|
|
LIBS = -lz
|
|
|
|
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
|
|
|
|
ifeq ($(TARGET),mmsnd)
|
|
OBJDIRS += $(OBJ)/mmsnd $(OBJ)/mmsnd/machine $(OBJ)/mmsnd/drivers $(OBJ)/mmsnd/sndhrdw
|
|
endif
|
|
|
|
include src/$(MAMEOS)/$(MAMEOS).mak
|
|
all: maketree $(EMULATOR)
|
|
|
|
# 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
|
|
|
|
ifdef COMPILESYSTEM_CYGWIN
|
|
CFLAGS += -mno-cygwin
|
|
LDFLAGS += -mno-cygwin
|
|
endif
|
|
|
|
# combine the various definitions to one
|
|
CDEFS = $(DEFS) $(COREDEFS) $(CPUDEFS) $(SOUNDDEFS) $(ASMDEFS) $(DBGDEFS)
|
|
|
|
# primary target
|
|
$(EMULATOR): $(OBJS) $(COREOBJS) $(OSOBJS) $(DRVLIBS)
|
|
# always recompile the version string
|
|
$(CC) $(CDEFS) $(CFLAGSPEDANTIC) $(PLATCFLAGS) -c src/version.c -o $(OBJ)/version.o
|
|
@echo Linking $@...
|
|
$(LD) $(LDFLAGS) $(OBJS) $(COREOBJS) $(OSOBJS) $(LIBS) $(DRVLIBS) -o $@
|
|
|
|
$(OBJ)/$(MAMEOS)/%.o: src/$(MAMEOS)/%.c
|
|
@echo Compiling $<...
|
|
$(CC) $(CDEFS) $(CFLAGSOSDEPEND) $(PLATCFLAGS) -c $< -o $@
|
|
|
|
$(OBJ)/%.o: src/%.c
|
|
@echo Compiling $<...
|
|
$(CC) $(CDEFS) $(CFLAGS) $(PLATCFLAGS) -c $< -o $@
|
|
|
|
# compile generated C files for the 68000 emulator
|
|
$(M68000_GENERATED_OBJS): $(OBJ)/cpu/m68000/m68kmake$(EXE)
|
|
@echo Compiling $(subst .o,.c,$@)...
|
|
$(CC) $(CDEFS) $(CFLAGSPEDANTIC) $(PLATCFLAGS) -c $*.c -o $@
|
|
|
|
# additional rule, because m68kcpu.c includes the generated m68kops.h :-/
|
|
$(OBJ)/cpu/m68000/m68kcpu.o: $(OBJ)/cpu/m68000/m68kmake$(EXE)
|
|
|
|
# generate C source files for the 68000 emulator
|
|
$(OBJ)/cpu/m68000/m68kmake$(EXE): src/cpu/m68000/m68kmake.c
|
|
@echo M68K make $<...
|
|
$(NATIVECC) $(CDEFS) $(CFLAGSPEDANTIC) -DDOS -o $(OBJ)/cpu/m68000/m68kmake$(EXE) $<
|
|
@echo Generating M68K source files...
|
|
$(OBJ)/cpu/m68000/m68kmake$(EXE) $(OBJ)/cpu/m68000 src/cpu/m68000/m68k_in.c
|
|
|
|
# generate asm source files for the 68000/68020 emulators
|
|
$(OBJ)/cpu/m68000/68000.asm: src/cpu/m68000/make68k.c
|
|
@echo Compiling $<...
|
|
$(NATIVECC) $(CDEFS) $(CFLAGSPEDANTIC) -O0 -DDOS -o $(OBJ)/cpu/m68000/make68k$(EXE) $<
|
|
@echo Generating $@...
|
|
@$(OBJ)/cpu/m68000/make68k$(EXE) $@ $(OBJ)/cpu/m68000/68000tab.asm 00
|
|
|
|
$(OBJ)/cpu/m68000/68020.asm: src/cpu/m68000/make68k.c
|
|
@echo Compiling $<...
|
|
$(NATIVECC) $(CDEFS) $(CFLAGSPEDANTIC) -O0 -DDOS -o $(OBJ)/cpu/m68000/make68k$(EXE) $<
|
|
@echo Generating $@...
|
|
@$(OBJ)/cpu/m68000/make68k$(EXE) $@ $(OBJ)/cpu/m68000/68020tab.asm 20
|
|
|
|
# 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
|
|
|
|
|