diff --git a/Cocoa/Info.plist b/Cocoa/Info.plist index f2ae5d0a..0998d0d4 100644 --- a/Cocoa/Info.plist +++ b/Cocoa/Info.plist @@ -54,7 +54,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.0 + Version @VERSION CFBundleSignature ???? CFBundleSupportedPlatforms diff --git a/Makefile b/Makefile index 1788b30a..4be3e79d 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,8 @@ else default: sdl endif +VERSION := 0.1 + BIN := build/bin OBJ := build/obj @@ -15,7 +17,7 @@ LDFLAGS += -lc -lm CONF ?= debug ifeq ($(shell uname -s),Darwin) -CFLAGS += -F/Library/Frameworks +CFLAGS += -F/Library/Frameworks -DVERSION="$(VERSION)" OCFLAGS += -x objective-c -fobjc-arc -Wno-deprecated-declarations -isysroot $(shell xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.9 LDFLAGS += -framework AppKit SDL_LDFLAGS := -framework SDL @@ -67,15 +69,15 @@ $(OBJ)/%.m.o: %.m $(BIN)/Sameboy.app: $(BIN)/Sameboy.app/Contents/MacOS/Sameboy \ $(shell echo Cocoa/*.icns) \ - $(shell echo Cocoa/info.plist) \ + Cocoa/License.html \ + Cocoa/info.plist \ $(BIN)/BootROMs/dmg_boot.bin \ $(BIN)/BootROMs/cgb_boot.bin \ $(BIN)/Sameboy.app/Contents/Resources/Base.lproj/Document.nib \ - $(BIN)/Sameboy.app/Contents/Resources/Base.lproj/MainMenu.nib \ - Cocoa/License.html + $(BIN)/Sameboy.app/Contents/Resources/Base.lproj/MainMenu.nib mkdir -p $(BIN)/Sameboy.app/Contents/Resources cp Cocoa/*.icns $(BIN)/BootROMs/dmg_boot.bin $(BIN)/BootROMs/cgb_boot.bin $(BIN)/Sameboy.app/Contents/Resources/ - cp Cocoa/info.plist $(BIN)/Sameboy.app/Contents/ + sed s/@VERSION/$(VERSION)/ < Cocoa/info.plist > $(BIN)/Sameboy.app/Contents/info.plist cp Cocoa/License.html $(BIN)/Sameboy.app/Contents/Resources/Credits.html $(BIN)/Sameboy.app/Contents/MacOS/Sameboy: $(CORE_OBJECTS) $(COCOA_OBJECTS) diff --git a/SDL/main.c b/SDL/main.c index 00dabd81..ef01bed1 100644 --- a/SDL/main.c +++ b/SDL/main.c @@ -134,6 +134,10 @@ int main(int argc, char **argv) GB_gameboy_t gb; bool dmg = false; +#define str(x) #x +#define xstr(x) str(x) + fprintf(stderr, "SameBoy v" xstr(VERSION) "\n"); + if (argc == 1 || argc > 3) { usage: fprintf(stderr, "Usage: %s [--dmg] rom\n", argv[0]);