2007-12-17 16:19:59 +01:00
|
|
|
###########################################################################
|
|
|
|
#
|
|
|
|
# makefile
|
|
|
|
#
|
|
|
|
# Core makefile for building MAME and derivatives
|
|
|
|
#
|
2008-01-06 01:47:40 +01:00
|
|
|
# Copyright (c) Nicola Salmoria and the MAME Team.
|
2007-12-17 16:19:59 +01:00
|
|
|
# Visit http://mamedev.org for licensing and usage restrictions.
|
|
|
|
#
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
################# BEGIN USER-CONFIGURABLE OPTIONS #####################
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# specify core target: mame, mess, etc.
|
|
|
|
# specify subtarget: mame, mess, tiny, etc.
|
|
|
|
# build rules will be included from
|
|
|
|
# src/$(TARGET)/$(SUBTARGET).mak
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
ifndef TARGET
|
|
|
|
TARGET = mame
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef SUBTARGET
|
|
|
|
SUBTARGET = $(TARGET)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# specify OSD layer: windows, sdl, etc.
|
|
|
|
# build rules will be included from
|
|
|
|
# src/osd/$(OSD)/$(OSD).mak
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
ifndef OSD
|
2010-01-13 17:27:27 +01:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2007-12-17 16:19:59 +01:00
|
|
|
OSD = windows
|
2010-01-13 17:27:27 +01:00
|
|
|
TARGETOS = win32
|
|
|
|
else
|
|
|
|
OSD = sdl
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
|
|
|
|
2008-02-22 01:17:36 +01:00
|
|
|
ifndef CROSS_BUILD_OSD
|
|
|
|
CROSS_BUILD_OSD = $(OSD)
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
2008-05-12 00:15:13 +02:00
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# specify OS target, which further differentiates
|
|
|
|
# the underlying OS; supported values are:
|
|
|
|
# win32, unix, macosx, os2
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
ifndef TARGETOS
|
2010-01-13 17:27:27 +01:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2007-12-17 16:19:59 +01:00
|
|
|
TARGETOS = win32
|
|
|
|
else
|
|
|
|
TARGETOS = unix
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-12-17 17:37:57 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# configure name of final executable
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# uncomment and specify prefix to be added to the name
|
|
|
|
# PREFIX =
|
|
|
|
|
|
|
|
# uncomment and specify suffix to be added to the name
|
|
|
|
# SUFFIX =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# specify architecture-specific optimizations
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# uncomment and specify architecture-specific optimizations here
|
|
|
|
# some examples:
|
|
|
|
# optimize for I686: ARCHOPTS = -march=pentiumpro
|
|
|
|
# optimize for Core 2: ARCHOPTS = -march=pentium-m -msse3
|
|
|
|
# optimize for G4: ARCHOPTS = -mcpu=G4
|
|
|
|
# note that we leave this commented by default so that you can
|
|
|
|
# configure this in your environment and never have to think about it
|
|
|
|
# ARCHOPTS =
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# specify program options; see each option below
|
|
|
|
# for details
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
2008-02-02 09:57:39 +01:00
|
|
|
# uncomment next line to build a debug version
|
2009-07-30 00:46:08 +02:00
|
|
|
# DEBUG = 1
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
# uncomment next line to include the internal profiler
|
|
|
|
# PROFILER = 1
|
|
|
|
|
2008-05-12 00:15:13 +02:00
|
|
|
# uncomment the force the universal DRC to always use the C backend
|
|
|
|
# you may need to do this if your target architecture does not have
|
|
|
|
# a native backend
|
|
|
|
# FORCE_DRC_C_BACKEND = 1
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2010-01-13 04:49:37 +01:00
|
|
|
# uncomment next line to build using unix-style libsdl on Mac OS X
|
|
|
|
# (vs. the native framework port). Normal users should not enable this.
|
|
|
|
# MACOSX_USE_LIBSDL = 1
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
2010-01-13 17:27:27 +01:00
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# specify build options; see each option below
|
|
|
|
# for details
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# uncomment next line if you are building for a 64-bit target
|
|
|
|
# PTR64 = 1
|
|
|
|
|
2007-12-17 17:37:57 +01:00
|
|
|
# uncomment next line if you are building for a big-endian target
|
|
|
|
# BIGENDIAN = 1
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# 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
|
2009-07-30 00:52:54 +02:00
|
|
|
# SYMBOLS = 1
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
# uncomment next line to include profiling information from the compiler
|
|
|
|
# PROFILE = 1
|
|
|
|
|
|
|
|
# uncomment next line to generate a link map for exception handling in windows
|
2009-07-30 00:52:54 +02:00
|
|
|
# MAP = 1
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2008-04-02 10:28:58 +02:00
|
|
|
# uncomment next line to generate verbose build information
|
|
|
|
# VERBOSE = 1
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# specify optimization level or leave commented to use the default
|
|
|
|
# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
|
|
|
|
# OPTIMIZE = 3
|
|
|
|
|
|
|
|
|
|
|
|
###########################################################################
|
|
|
|
################## END USER-CONFIGURABLE OPTIONS ######################
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# sanity check the configuration
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# specify a default optimization level if none explicitly stated
|
|
|
|
ifndef OPTIMIZE
|
|
|
|
ifndef SYMBOLS
|
|
|
|
OPTIMIZE = 3
|
|
|
|
else
|
|
|
|
OPTIMIZE = 0
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# profiler defaults to on for DEBUG builds
|
|
|
|
ifdef DEBUG
|
|
|
|
ifndef PROFILER
|
|
|
|
PROFILER = 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# platform-specific definitions
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# extension for executables
|
|
|
|
EXE =
|
|
|
|
|
|
|
|
ifeq ($(TARGETOS),win32)
|
|
|
|
EXE = .exe
|
|
|
|
endif
|
|
|
|
ifeq ($(TARGETOS),os2)
|
|
|
|
EXE = .exe
|
|
|
|
endif
|
|
|
|
|
2008-02-22 01:17:36 +01:00
|
|
|
ifndef BUILD_EXE
|
|
|
|
BUILD_EXE = $(EXE)
|
|
|
|
endif
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# compiler, linker and utilities
|
|
|
|
AR = @ar
|
|
|
|
CC = @gcc
|
2010-01-03 22:31:44 +01:00
|
|
|
LD = @g++
|
2007-12-17 16:19:59 +01:00
|
|
|
MD = -mkdir$(EXE)
|
|
|
|
RM = @rm -f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# form the name of the executable
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
2010-01-13 17:27:27 +01:00
|
|
|
# reset all internal prefixes/suffixes
|
|
|
|
PREFIXSDL =
|
|
|
|
SUFFIX64 =
|
|
|
|
SUFFIXDEBUG =
|
|
|
|
|
|
|
|
# Windows SDL builds get an SDL prefix
|
|
|
|
ifeq ($(OSD),sdl)
|
|
|
|
ifeq ($(TARGETOS),win32)
|
|
|
|
PREFIXSDL = sdl
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2010-01-03 22:31:44 +01:00
|
|
|
# 64-bit builds get a '64' suffix
|
|
|
|
ifdef PTR64
|
|
|
|
SUFFIX64 = 64
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
|
|
|
|
2010-01-03 22:31:44 +01:00
|
|
|
# debug builds just get the 'd' suffix and nothing more
|
|
|
|
ifdef DEBUG
|
|
|
|
SUFFIXDEBUG = d
|
2009-02-28 23:10:06 +01:00
|
|
|
endif
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# the name is just 'target' if no subtarget; otherwise it is
|
|
|
|
# the concatenation of the two (e.g., mametiny)
|
|
|
|
ifeq ($(TARGET),$(SUBTARGET))
|
|
|
|
NAME = $(TARGET)
|
|
|
|
else
|
|
|
|
NAME = $(TARGET)$(SUBTARGET)
|
|
|
|
endif
|
|
|
|
|
2010-01-03 22:31:44 +01:00
|
|
|
# fullname is prefix+name+suffix+suffix64+suffixdebug
|
2010-01-13 17:27:27 +01:00
|
|
|
FULLNAME = $(PREFIX)$(PREFIXSDL)$(NAME)$(SUFFIX)$(SUFFIX64)$(SUFFIXDEBUG)
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
# add an EXE suffix to get the final emulator name
|
|
|
|
EMULATOR = $(FULLNAME)$(EXE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# source and object locations
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# all sources are under the src/ directory
|
|
|
|
SRC = src
|
|
|
|
|
|
|
|
# build the targets in different object dirs, so they can co-exist
|
|
|
|
OBJ = obj/$(OSD)/$(FULLNAME)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# compile-time definitions
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# CR/LF setup: use both on win32/os2, CR only on everything else
|
|
|
|
DEFS = -DCRLF=2
|
|
|
|
|
|
|
|
ifeq ($(TARGETOS),win32)
|
|
|
|
DEFS = -DCRLF=3
|
|
|
|
endif
|
|
|
|
ifeq ($(TARGETOS),os2)
|
|
|
|
DEFS = -DCRLF=3
|
|
|
|
endif
|
|
|
|
|
|
|
|
# map the INLINE to something digestible by GCC
|
2010-01-05 23:01:10 +01:00
|
|
|
DEFS += -DINLINE="static inline"
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
# define LSB_FIRST if we are a little-endian target
|
2007-12-17 17:37:57 +01:00
|
|
|
ifndef BIGENDIAN
|
2007-12-17 16:19:59 +01:00
|
|
|
DEFS += -DLSB_FIRST
|
|
|
|
endif
|
|
|
|
|
|
|
|
# define PTR64 if we are a 64-bit target
|
|
|
|
ifdef PTR64
|
|
|
|
DEFS += -DPTR64
|
|
|
|
endif
|
|
|
|
|
|
|
|
# define MAME_DEBUG if we are a debugging build
|
|
|
|
ifdef DEBUG
|
|
|
|
DEFS += -DMAME_DEBUG
|
|
|
|
else
|
|
|
|
DEFS += -DNDEBUG
|
|
|
|
endif
|
|
|
|
|
|
|
|
# define MAME_PROFILER if we are a profiling build
|
|
|
|
ifdef PROFILER
|
|
|
|
DEFS += -DMAME_PROFILER
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# compile flags
|
2009-02-28 23:10:06 +01:00
|
|
|
# CCOMFLAGS are common flags
|
|
|
|
# CONLYFLAGS are flags only used when compiling for C
|
|
|
|
# CPPONLYFLAGS are flags only used when compiling for C++
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
|
2009-02-28 23:10:06 +01:00
|
|
|
# start with empties for everything
|
|
|
|
CCOMFLAGS =
|
|
|
|
CONLYFLAGS =
|
|
|
|
CPPONLYFLAGS =
|
|
|
|
|
|
|
|
# CFLAGS is defined based on C or C++ targets
|
|
|
|
# (remember, expansion only happens when used, so doing it here is ok)
|
|
|
|
CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
|
|
|
|
|
|
|
|
# we compile C-only to C89 standard with GNU extensions
|
|
|
|
# we compile C++ code to C++98 standard with GNU extensions
|
|
|
|
CONLYFLAGS += -std=gnu89
|
|
|
|
CPPONLYFLAGS += -x c++ -std=gnu++98
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2007-12-17 17:37:57 +01:00
|
|
|
# this speeds it up a bit by piping between the preprocessor/compiler/assembler
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -pipe
|
2007-12-17 17:37:57 +01:00
|
|
|
|
2009-02-28 23:10:06 +01:00
|
|
|
# add -g if we need symbols, and ensure we have frame pointers
|
2007-12-17 16:19:59 +01:00
|
|
|
ifdef SYMBOLS
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -g -fno-omit-frame-pointer
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
|
|
|
|
2008-04-02 10:28:58 +02:00
|
|
|
# add -v if we need verbose build information
|
|
|
|
ifdef VERBOSE
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -v
|
2008-04-02 10:28:58 +02:00
|
|
|
endif
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# add profiling information for the compiler
|
|
|
|
ifdef PROFILE
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -pg
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
# add the optimization flag
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -O$(OPTIMIZE)
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
# if we are optimizing, include optimization options
|
|
|
|
# and make all errors into warnings
|
|
|
|
ifneq ($(OPTIMIZE),0)
|
2010-01-13 04:49:37 +01:00
|
|
|
ifneq ($(TARGETOS),os2)
|
|
|
|
ifndef NOWERROR
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -Werror -fno-strict-aliasing $(ARCHOPTS)
|
2010-01-13 04:49:37 +01:00
|
|
|
else
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
endif
|
|
|
|
|
2009-02-28 23:10:06 +01:00
|
|
|
# add a basic set of warnings
|
|
|
|
CCOMFLAGS += \
|
|
|
|
-Wall \
|
|
|
|
-Wcast-align \
|
|
|
|
-Wundef \
|
|
|
|
-Wformat-security \
|
|
|
|
-Wwrite-strings \
|
|
|
|
-Wno-sign-compare
|
|
|
|
|
|
|
|
# warnings only applicable to C compiles
|
|
|
|
CONLYFLAGS += \
|
|
|
|
-Wpointer-arith \
|
|
|
|
-Wbad-function-cast \
|
|
|
|
-Wstrict-prototypes
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# include paths
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# add core include paths
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += \
|
2007-12-17 16:19:59 +01:00
|
|
|
-I$(SRC)/$(TARGET) \
|
|
|
|
-I$(OBJ)/$(TARGET)/layout \
|
|
|
|
-I$(SRC)/emu \
|
|
|
|
-I$(OBJ)/emu \
|
|
|
|
-I$(OBJ)/emu/layout \
|
|
|
|
-I$(SRC)/lib/util \
|
|
|
|
-I$(SRC)/osd \
|
|
|
|
-I$(SRC)/osd/$(OSD) \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# linking flags
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# LDFLAGS are used generally; LDFLAGSEMULATOR are additional
|
|
|
|
# flags only used when linking the core emulator
|
2010-01-13 04:49:37 +01:00
|
|
|
LDFLAGS =
|
|
|
|
ifneq ($(TARGETOS),macosx)
|
|
|
|
ifneq ($(TARGETOS),os2)
|
|
|
|
ifneq ($(TARGETOS),solaris)
|
2007-12-17 16:19:59 +01:00
|
|
|
LDFLAGS = -Wl,--warn-common
|
2010-01-13 04:49:37 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
LDFLAGSEMULATOR =
|
|
|
|
|
|
|
|
# add profiling information for the linker
|
|
|
|
ifdef PROFILE
|
|
|
|
LDFLAGS += -pg
|
|
|
|
endif
|
|
|
|
|
|
|
|
# strip symbols and other metadata in non-symbols and non profiling builds
|
|
|
|
ifndef SYMBOLS
|
|
|
|
ifndef PROFILE
|
2010-01-13 04:49:37 +01:00
|
|
|
ifneq ($(TARGETOS),macosx)
|
2007-12-17 16:19:59 +01:00
|
|
|
LDFLAGS += -s
|
|
|
|
endif
|
|
|
|
endif
|
2010-01-13 04:49:37 +01:00
|
|
|
endif
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
# output a map file (emulator only)
|
|
|
|
ifdef MAP
|
|
|
|
LDFLAGSEMULATOR += -Wl,-Map,$(FULLNAME).map
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# define the standard object directory; other
|
|
|
|
# projects can add their object directories to
|
|
|
|
# this variable
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
OBJDIRS = $(OBJ)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# define standard libarires for CPU and sounds
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
LIBEMU = $(OBJ)/libemu.a
|
|
|
|
LIBCPU = $(OBJ)/libcpu.a
|
2009-08-22 08:25:07 +02:00
|
|
|
LIBDASM = $(OBJ)/libdasm.a
|
2007-12-17 16:19:59 +01:00
|
|
|
LIBSOUND = $(OBJ)/libsound.a
|
|
|
|
LIBUTIL = $(OBJ)/libutil.a
|
|
|
|
LIBOCORE = $(OBJ)/libocore.a
|
|
|
|
LIBOSD = $(OBJ)/libosd.a
|
|
|
|
|
|
|
|
VERSIONOBJ = $(OBJ)/version.o
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# either build or link against the included
|
|
|
|
# libraries
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# start with an empty set of libs
|
|
|
|
LIBS =
|
|
|
|
|
|
|
|
# add expat XML library
|
|
|
|
ifdef BUILD_EXPAT
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -I$(SRC)/lib/expat
|
2007-12-17 16:19:59 +01:00
|
|
|
EXPAT = $(OBJ)/libexpat.a
|
|
|
|
else
|
|
|
|
LIBS += -lexpat
|
|
|
|
EXPAT =
|
|
|
|
endif
|
|
|
|
|
|
|
|
# add ZLIB compression library
|
|
|
|
ifdef BUILD_ZLIB
|
2009-02-28 23:10:06 +01:00
|
|
|
CCOMFLAGS += -I$(SRC)/lib/zlib
|
2007-12-17 16:19:59 +01:00
|
|
|
ZLIB = $(OBJ)/libz.a
|
|
|
|
else
|
|
|
|
LIBS += -lz
|
|
|
|
ZLIB =
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
2010-01-03 22:31:44 +01:00
|
|
|
# 'default' target needs to go here, before the
|
2007-12-17 16:19:59 +01:00
|
|
|
# include files which define additional targets
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
2010-01-03 22:31:44 +01:00
|
|
|
default: maketree buildtools emulator
|
|
|
|
|
|
|
|
all: default tools
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2009-02-28 23:10:06 +01:00
|
|
|
|
|
|
|
|
2008-02-22 01:17:36 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# defines needed by multiple make files
|
|
|
|
#-------------------------------------------------
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2008-02-22 01:17:36 +01:00
|
|
|
BUILDSRC = $(SRC)/build
|
|
|
|
BUILDOBJ = $(OBJ)/build
|
|
|
|
BUILDOUT = $(BUILDOBJ)
|
2007-12-17 16:19:59 +01:00
|
|
|
|
2009-02-28 23:10:06 +01:00
|
|
|
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
#-------------------------------------------------
|
|
|
|
# include the various .mak files
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
# include OSD-specific rules first
|
|
|
|
include $(SRC)/osd/$(OSD)/$(OSD).mak
|
|
|
|
|
|
|
|
# then the various core pieces
|
|
|
|
include $(SRC)/$(TARGET)/$(SUBTARGET).mak
|
|
|
|
include $(SRC)/emu/emu.mak
|
|
|
|
include $(SRC)/lib/lib.mak
|
|
|
|
include $(SRC)/build/build.mak
|
2008-02-22 01:17:36 +01:00
|
|
|
-include $(SRC)/osd/$(CROSS_BUILD_OSD)/build.mak
|
2007-12-17 16:19:59 +01:00
|
|
|
include $(SRC)/tools/tools.mak
|
|
|
|
|
|
|
|
# combine the various definitions to one
|
2010-01-02 21:21:00 +01:00
|
|
|
CDEFS = $(DEFS)
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# primary targets
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
emulator: maketree $(BUILD) $(EMULATOR)
|
|
|
|
|
|
|
|
buildtools: maketree $(BUILD)
|
|
|
|
|
|
|
|
tools: maketree $(TOOLS)
|
|
|
|
|
|
|
|
maketree: $(sort $(OBJDIRS))
|
|
|
|
|
2009-09-21 11:03:25 +02:00
|
|
|
clean: $(OSDCLEAN)
|
2007-12-17 16:19:59 +01:00
|
|
|
@echo Deleting object tree $(OBJ)...
|
|
|
|
$(RM) -r $(OBJ)
|
|
|
|
@echo Deleting $(EMULATOR)...
|
|
|
|
$(RM) $(EMULATOR)
|
|
|
|
@echo Deleting $(TOOLS)...
|
|
|
|
$(RM) $(TOOLS)
|
|
|
|
ifdef MAP
|
|
|
|
@echo Deleting $(FULLNAME).map...
|
|
|
|
$(RM) $(FULLNAME).map
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# directory targets
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
$(sort $(OBJDIRS)):
|
|
|
|
$(MD) -p $@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# executable targets and dependencies
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
2007-12-17 17:41:39 +01:00
|
|
|
ifndef EXECUTABLE_DEFINED
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
# always recompile the version string
|
2010-01-13 04:49:37 +01:00
|
|
|
$(VERSIONOBJ): $(DRVLIBS) $(LIBOSD) $(LIBEMU) $(LIBCPU) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(LIBOCORE) $(RESFILE)
|
|
|
|
|
|
|
|
$(EMULATOR): $(VERSIONOBJ) $(DRVLIBS) $(LIBOSD) $(LIBEMU) $(LIBCPU) $(LIBDASM) $(LIBSOUND) $(LIBUTIL) $(EXPAT) $(ZLIB) $(LIBOCORE) $(RESFILE)
|
2007-12-17 16:19:59 +01:00
|
|
|
@echo Linking $@...
|
|
|
|
$(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $^ $(LIBS) -o $@
|
|
|
|
|
2007-12-17 17:41:39 +01:00
|
|
|
endif
|
|
|
|
|
2007-12-17 16:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------
|
|
|
|
# generic rules
|
|
|
|
#-------------------------------------------------
|
|
|
|
|
|
|
|
$(OBJ)/%.o: $(SRC)/%.c | $(OSPREBUILD)
|
|
|
|
@echo Compiling $<...
|
|
|
|
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(OBJ)/%.pp: $(SRC)/%.c | $(OSPREBUILD)
|
|
|
|
@echo Compiling $<...
|
|
|
|
$(CC) $(CDEFS) $(CFLAGS) -E $< -o $@
|
|
|
|
|
|
|
|
$(OBJ)/%.s: $(SRC)/%.c | $(OSPREBUILD)
|
|
|
|
@echo Compiling $<...
|
|
|
|
$(CC) $(CDEFS) $(CFLAGS) -S $< -o $@
|
|
|
|
|
|
|
|
$(OBJ)/%.lh: $(SRC)/%.lay $(FILE2STR)
|
|
|
|
@echo Converting $<...
|
|
|
|
@$(FILE2STR) $< $@ layout_$(basename $(notdir $<))
|
|
|
|
|
|
|
|
$(OBJ)/%.fh: $(SRC)/%.png $(PNG2BDC) $(FILE2STR)
|
|
|
|
@echo Converting $<...
|
|
|
|
@$(PNG2BDC) $< $(OBJ)/temp.bdc
|
|
|
|
@$(FILE2STR) $(OBJ)/temp.bdc $@ font_$(basename $(notdir $<)) UINT8
|
|
|
|
|
|
|
|
$(OBJ)/%.a:
|
|
|
|
@echo Archiving $@...
|
|
|
|
$(RM) $@
|
|
|
|
$(AR) -cr $@ $^
|
|
|
|
|
|
|
|
ifeq ($(TARGETOS),macosx)
|
|
|
|
$(OBJ)/%.o: $(SRC)/%.m | $(OSPREBUILD)
|
|
|
|
@echo Objective-C compiling $<...
|
|
|
|
$(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
|
|
|
|
endif
|