From 038cb5a64aeeb755aa55ac88ab477b04234ddeda Mon Sep 17 00:00:00 2001 From: John Vilk Date: Fri, 28 Sep 2012 17:57:18 -0400 Subject: [PATCH] Doin' some Makefile reformatting. Trying to move as many things out of the MESS makefile as possible. --- makefile | 50 +++++++++++++++++++++++++++++++++++++------------- mess/makefile | 12 ++++++------ 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/makefile b/makefile index 0e938b524b..470b2d465e 100755 --- a/makefile +++ b/makefile @@ -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 @@ -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) \ @@ -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 diff --git a/mess/makefile b/mess/makefile index 2d074332d9..4588dab5fd 100644 --- a/mess/makefile +++ b/mess/makefile @@ -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 @@ -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 ########################################################################### @@ -284,7 +284,7 @@ endif #------------------------------------------------- # extension for executables -EXE = +EXE = ifeq ($(TARGETOS),win32) EXE = .exe @@ -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 @@ -511,7 +511,7 @@ CONLYFLAGS += \ # warnings only applicable to OBJ-C compiles COBJFLAGS += \ - -Wpointer-arith + -Wpointer-arith # TODO(jvilk): Where are the CPPONLYFLAGS?