Skip to content

Commit

Permalink
Merge pull request jsmess#88 from salty-horse/version_string
Browse files Browse the repository at this point in the history
Add JSMESS version string to output JS. Closes jsmess#84
  • Loading branch information
DopefishJustin committed Apr 14, 2014
2 parents e31e36b + d31959e commit e30cf3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion makefile
Expand Up @@ -172,6 +172,7 @@ NATIVE_MESS_FLAGS := $(SHARED_MESS_FLAGS) $(NATIVE_MESS_FLAGS)

BIOS_FILES := $(foreach BIOS_FILE,$(BIOS),$(BIOS_DIR)/$(BIOS_FILE))

JSMESS_VERSION := $(shell git rev-parse --abbrev-ref HEAD) (commit $(shell git rev-parse HEAD))
JSMESS_MESS_BUILD_VERSION := $(shell tail --lines=1 third_party/mame/src/version.c | cut -d '"' -f 2)commit $(shell cat .git/modules/third_party/mame/HEAD))
JSMESS_EMCC_VERSION := $(shell third_party/emscripten/emcc --version | grep commit)

Expand Down Expand Up @@ -243,7 +244,8 @@ $(OBJ_DIR)/$(MESS_EXE)$(DEBUG_NAME).js.gz: $(OBJ_DIR)/$(MESS_EXE)$(DEBUG_NAME).j
# Runs emcc on LLVM bitcode version of MESS.
$(OBJ_DIR)/$(MESS_EXE)$(DEBUG_NAME).js: $(MAME_DIR)/$(MESS_EXE)$(DEBUG_NAME).bc $(TEMPLATE_DIR)/pre.js $(TEMPLATE_DIR)/post.js
$(EMCC) $(EMCC_FLAGS) $< -o $(OBJ_DIR)/$(MESS_EXE)$(DEBUG_NAME).js --pre-js $(TEMPLATE_DIR)/pre.js --post-js $(TEMPLATE_DIR)/post.js
@$(call SED_I,'s/JSMESS_MESS_BUILD_VERSION/$(subst /,\/, $(JSMESS_MESS_BUILD_VERSION))/' $(OBJ_DIR)/$(MESS_EXE)$(DEBUG_NAME).js)
@$(call SED_I,'s/JSMESS_JSMESS_VERSION/$(subst /,\/,$(JSMESS_VERSION))/' $(OBJ_DIR)/$(MESS_EXE)$(DEBUG_NAME).js)
@$(call SED_I,'s/JSMESS_MESS_BUILD_VERSION/$(subst /,\/,$(JSMESS_MESS_BUILD_VERSION))/' $(OBJ_DIR)/$(MESS_EXE)$(DEBUG_NAME).js)
@$(call SED_I,'s/JSMESS_EMCC_VERSION/$(JSMESS_EMCC_VERSION)/' $(OBJ_DIR)/$(MESS_EXE)$(DEBUG_NAME).js)
@$(call SED_I,'s/JSMESS_EMCC_FLAGS/$(subst ",\\", $(EMCC_FLAGS))/' $(OBJ_DIR)/$(MESS_EXE)$(DEBUG_NAME).js)
@$(call SED_I,'s/JSMESS_MESS_FLAGS/$(subst ",\\", $(subst /,\/, $(MESS_FLAGS)))/' $(OBJ_DIR)/$(MESS_EXE)$(DEBUG_NAME).js)
Expand Down
2 changes: 2 additions & 0 deletions templates/default/pre.js
Expand Up @@ -2,10 +2,12 @@ if(!window.console){ window.console = {log: function(){} }; }
var JSMESS = JSMESS || {};
JSMESS.running = false;
JSMESS.ready(function() { console.log("JSMESS is now running"); });
JSMESS.JSMESS_VERSION = "JSMESS_JSMESS_VERSION";
JSMESS.MESS_BUILD_VERSION = "JSMESS_MESS_BUILD_VERSION";
JSMESS.EMCC_VERSION = "JSMESS_EMCC_VERSION";
JSMESS.EMCC_FLAGS = "JSMESS_EMCC_FLAGS";
JSMESS.MESS_FLAGS = "JSMESS_MESS_FLAGS";
console.log("JSMESS VERSION == " + JSMESS.JSMESS_VERSION);
console.log("MESS BUILD_VERSION == " + JSMESS.MESS_BUILD_VERSION);
console.log("EMCC VERSION == " + JSMESS.EMCC_VERSION);
console.log("EMCC_FLAGS == " + JSMESS.EMCC_FLAGS);
Expand Down

0 comments on commit e30cf3e

Please sign in to comment.