Skip to content

Commit

Permalink
Doin' some Makefile reformatting. Trying to move as many things out o…
Browse files Browse the repository at this point in the history
…f the MESS makefile as possible.
  • Loading branch information
John Vilk committed Sep 28, 2012
1 parent 6d74bb1 commit 038cb5a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 19 deletions.
50 changes: 37 additions & 13 deletions makefile
Expand Up @@ -6,10 +6,15 @@
#
###########################################################################

#-------------------------------------------------------------------------------
# Variables
#-------------------------------------------------------------------------------

# Absolute directory path to emscripten / closure compiler.
EMSCRIPTEN_DIR = $(CURDIR)/third_party/emscripten
CLOSURE_DIR = $(EMSCRIPTEN_DIR)/third_party/closure-compiler

# Path to specific tools invoked during the build process.
EMMAKE = $(EMSCRIPTEN_DIR)/emmake
CLOSURE = $(CLOSURE_DIR)/compiler.jar

Expand All @@ -36,25 +41,44 @@ ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64)
NATIVE_OBJ := $(NATIVE_OBJ)64
endif

GAME = "./bin/cosmofighter2.zip"
BIOS = "./bin/coleco.zip"
# Flags shared between the native tools build and emscripten build.
# TODO: Document why each of these are set / what they do.
SHARED_FLAGS = OSD=sdl \
NOWERROR=1 \
NOASM=1 \
NO_X11=1 \
NO_DEBUGGER=1 \

# Flags used to build the native tools.
NATIVE_MESS_FLAGS = PREFIX=native OSD=sdl NOWERROR=1 NOASM=1 NO_X11=1 \
NO_DEBUGGER=1 CC=$(NATIVE_CC) CXX=$(NATIVE_CXX) \
AR=$(NATIVE_AR) LD=$(NATIVE_LD)
# TODO: Document why each of these are set / what they do.
NATIVE_MESS_FLAGS = PREFIX=native \
CC=$(NATIVE_CC) \
CXX=$(NATIVE_CXX) \
AR=$(NATIVE_AR) \
LD=$(NATIVE_LD) \
OPTIMIZE=3

# Flags used to make the emscripten build
EMSCRIPTEN_MESS_FLAGS = TARGET=mess SUBTARGET=tiny OSD=sdl CROSS_BUILD=1 \
NATIVE_OBJ="$(NATIVE_OBJ)" \
TARGETOS=emscripten NOWERROR=1 NOASM=1 NO_X11=1 \
NO_DEBUGGER=1 PTR64=0
# TODO: Document why each of these are set / what they do.
EMSCRIPTEN_MESS_FLAGS = TARGET=mess \
SUBTARGET=tiny \
CROSS_BUILD=1 \
NATIVE_OBJ="$(NATIVE_OBJ)" \
TARGETOS=emscripten \
PTR64=0 \
SYMLEVEL=2 \
VERBOSE=1 \
OPTIMIZE=0

#-------------------------------------------------------------------------------
# Build Rules
#-------------------------------------------------------------------------------

default:
@if [ ! -f $(GAME) ]; then echo "Missing game file: $(GAME)"; exit 1; fi
@if [ ! -f $(BIOS) ]; then echo "Missing BIOS: $(BIOS)"; exit 1; fi
cd mess; make $(NATIVE_MESS_FLAGS) buildtools
cd mess; $(EMMAKE) make $(EMSCRIPTEN_MESS_FLAGS)
cd mess; make $(SHARED_FLAGS) $(NATIVE_MESS_FLAGS) buildtools
cd mess; $(EMMAKE) make $(SHARED_FLAGS) $(EMSCRIPTEN_MESS_FLAGS)
mv mess/messtiny mess/messtiny.bc
$(EMSCRIPTEN_DIR)/emcc -s DISABLE_EXCEPTION_CATCHING=0 mess/messtiny.bc \
-o messtiny.js --post-js post.js --embed-file $(BIOS) \
Expand All @@ -63,6 +87,6 @@ default:
--js_output_file mess_closure.js

clean:
cd mess; make $(NATIVE_MESS_FLAGS) clean
cd mess; $(EMMAKE) make $(EMSCRIPTEN_MESS_FLAGS) clean
cd mess; make $(SHARED_FLAGS) $(NATIVE_MESS_FLAGS) clean
cd mess; $(EMMAKE) make $(SHARED_FLAGS) $(EMSCRIPTEN_MESS_FLAGS) clean
rm mess/messtiny.bc messtiny.js mess_closure.js
12 changes: 6 additions & 6 deletions mess/makefile
Expand Up @@ -217,7 +217,7 @@ BUILD_ZLIB = 1

# specify symbols level or leave commented to use the default
# (default is SYMLEVEL = 2 normally; use 1 if you only need backtrace)
SYMLEVEL = 2
# SYMLEVEL = 2

# uncomment next line to dump the symbols to a .sym file
# DUMPSYM = 1
Expand All @@ -229,11 +229,11 @@ SYMLEVEL = 2
# MAP = 1

# uncomment next line to generate verbose build information
VERBOSE = 1
# VERBOSE = 1

# specify optimization level or leave commented to use the default
# (default is OPTIMIZE = 3 normally, or OPTIMIZE = 0 with symbols)
OPTIMIZE = 3
# OPTIMIZE = 3


###########################################################################
Expand Down Expand Up @@ -284,7 +284,7 @@ endif
#-------------------------------------------------

# extension for executables
EXE =
EXE =

ifeq ($(TARGETOS),win32)
EXE = .exe
Expand Down Expand Up @@ -408,7 +408,7 @@ endif
ifdef DEBUG
DEFS += -DMAME_DEBUG
else
DEFS += -DNDEBUG
DEFS += -DNDEBUG
endif

# define MAME_PROFILER if we are a profiling build
Expand Down Expand Up @@ -511,7 +511,7 @@ CONLYFLAGS += \

# warnings only applicable to OBJ-C compiles
COBJFLAGS += \
-Wpointer-arith
-Wpointer-arith

# TODO(jvilk): Where are the CPPONLYFLAGS?

Expand Down

0 comments on commit 038cb5a

Please sign in to comment.