diff --git a/Makefile b/Makefile
index 2444159922..8073885645 100644
--- a/Makefile
+++ b/Makefile
@@ -58,7 +58,7 @@ RETROLAUNCH_OBJ = tools/retrolaunch/main.o \
HEADERS = $(wildcard */*.h) $(wildcard *.h)
ifeq ($(findstring Haiku,$(OS)),)
- LIBS = -lm
+ LIBS = -lm
endif
DEFINES = -DHAVE_CONFIG_H -DHAVE_SCREENSHOTS -DRARCH_INTERNAL
@@ -92,7 +92,7 @@ endif
ifeq ($(HAVE_RGUI), 1)
OBJ += frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_context.o file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
- DEFINES += -DHAVE_MENU
+ DEFINES += -DHAVE_MENU
endif
ifeq ($(HAVE_THREADS), 1)
@@ -158,8 +158,8 @@ ifeq ($(HAVE_AL), 1)
endif
ifeq ($(HAVE_V4L2),1)
- OBJ += camera/video4linux2.o
- DEFINES += -DHAVE_CAMERA -DHAVE_V4L2
+ OBJ += camera/video4linux2.o
+ DEFINES += -DHAVE_CAMERA -DHAVE_V4L2
endif
ifeq ($(HAVE_JACK),1)
@@ -196,7 +196,7 @@ ifeq ($(HAVE_SDL), 1)
endif
ifeq ($(HAVE_OMAP), 1)
- OBJ += gfx/omap_gfx.o
+ OBJ += gfx/omap_gfx.o
endif
ifeq ($(HAVE_OPENGL), 1)
@@ -343,8 +343,8 @@ endif
ifeq ($(HAVE_NEON),1)
OBJ += audio/sinc_neon.o
- # When compiled without this, tries to attempt to compile sinc lerp,
- # which will error out
+ # When compiled without this, tries to attempt to compile sinc lerp,
+ # which will error out
DEFINES += -DSINC_LOWER_QUALITY -DHAVE_NEON
endif
@@ -389,6 +389,12 @@ ifeq ($(NOUNUSED_VARIABLE), yes)
CFLAGS += -Wno-unused-variable
endif
+GIT_VERSION := $(shell git rev-parse --short HEAD)
+ifneq ($(GIT_VERSION),)
+ DEFINES += -DHAVE_GIT_VERSION -DGIT_VERSION=\"$(GIT_VERSION)\"
+ OBJ += git_version.o
+endif
+
all: $(TARGET) config.mk
@@ -416,19 +422,25 @@ tools/retrolaunch/retrolaunch: $(RETROLAUNCH_OBJ)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
-tools/linuxraw_joypad.o: input/linuxraw_joypad.c
+.FORCE:
+
+git_version.o: git_version.c .FORCE
+ @$(if $(Q), $(shell echo echo CC $<),)
+ $(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+
+tools/linuxraw_joypad.o: input/linuxraw_joypad.c $(HEADERS)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
-tools/udev_joypad.o: input/udev_joypad.c
+tools/udev_joypad.o: input/udev_joypad.c $(HEADERS)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
-tools/input_common_launch.o: input/input_common.c
+tools/input_common_launch.o: input/input_common.c $(HEADERS)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_RETROLAUNCH -c -o $@ $<
-tools/input_common_joyconfig.o: input/input_common.c
+tools/input_common_joyconfig.o: input/input_common.c $(HEADERS)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
diff --git a/Makefile.win b/Makefile.win
index 3aeb9be1f2..4ad77c1b70 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -51,6 +51,8 @@ JOBJ := conf/config_file.o \
input/dinput.o \
input/winxinput_joypad.o
+HEADERS = $(wildcard */*.h) $(wildcard *.h)
+
CC = gcc
CXX = g++
WINDRES = windres
@@ -264,25 +266,37 @@ else
endif
endif
+GIT_VERSION := $(shell git rev-parse --short HEAD)
+ifneq ($(GIT_VERSION),)
+ DEFINES += -DHAVE_GIT_VERSION -DGIT_VERSION=\"$(GIT_VERSION)\"
+ OBJ += git_version.o
+endif
+
all: $(TARGET) $(JTARGET)
$(TARGET): $(OBJ)
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(CXX) -o $@ $(OBJ) $(LIBS) $(LDFLAGS) $(LDCXXFLAGS)
-%.o: %.c
+%.o: %.c $(HEADERS)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
-tools/input_common_joyconfig.o: input/input_common.c
+.FORCE:
+
+git_version.o: git_version.c .FORCE
+ @$(if $(Q), $(shell echo echo CC $<),)
+ $(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+
+tools/input_common_joyconfig.o: input/input_common.c $(HEADERS)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
-%.o: %.cpp
+%.o: %.cpp $(HEADERS)
@$(if $(Q), $(shell echo echo CXX $<),)
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -c -o $@ $<
-%.o: %.rc
+%.o: %.rc $(HEADERS)
@$(if $(Q), $(shell echo echo WINDRES $<),)
$(Q)$(WINDRES) -o $@ $<
diff --git a/git_version.c b/git_version.c
new file mode 100644
index 0000000000..83a32fc82e
--- /dev/null
+++ b/git_version.c
@@ -0,0 +1,17 @@
+/* RetroArch - A frontend for libretro.
+ * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
+ *
+ * RetroArch is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with RetroArch.
+ * If not, see .
+ */
+
+const char rarch_git_version[] = GIT_VERSION;
+
diff --git a/git_version.h b/git_version.h
new file mode 100644
index 0000000000..e406cff7ac
--- /dev/null
+++ b/git_version.h
@@ -0,0 +1,23 @@
+/* RetroArch - A frontend for libretro.
+ * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
+ *
+ * RetroArch is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with RetroArch.
+ * If not, see .
+ */
+
+#ifndef RARCH_VERSION_H__
+#define RARCH_VERSION_H__
+
+// Put this in a separate file so we don't have to rebuilt retroarch.c every single build.
+extern const char rarch_git_version[];
+
+#endif
+
diff --git a/retroarch.c b/retroarch.c
index 7437bc3d1d..ad5fd0f6b3 100644
--- a/retroarch.c
+++ b/retroarch.c
@@ -38,6 +38,7 @@
#include "compat/posix_string.h"
#include "input/keyboard_line.h"
#include "input/input_common.h"
+#include "git_version.h"
#ifdef _WIN32
#ifdef _XBOX
@@ -751,8 +752,11 @@ static void print_compiler(FILE *file)
static void print_help(void)
{
puts("===================================================================");
- /* To get around error 'too many decimal points in number - expected ')' before numeric constant */
+#ifdef HAVE_GIT_VERSION
+ printf("RetroArch: Frontend for libretro -- v" PACKAGE_VERSION " -- %s --\n", rarch_git_version);
+#else
puts("RetroArch: Frontend for libretro -- v" PACKAGE_VERSION " --");
+#endif
print_compiler(stdout);
puts("===================================================================");
puts("Usage: retroarch [rom file] [options...]");
@@ -2985,6 +2989,10 @@ int rarch_main_init(int argc, char *argv[])
{
RARCH_LOG_OUTPUT("=== Build =======================================");
print_compiler(stderr);
+ RARCH_LOG_OUTPUT("Version: %s\n", PACKAGE_VERSION);
+#ifdef HAVE_GIT_VERSION
+ RARCH_LOG_OUTPUT("Git: %s\n", rarch_git_version);
+#endif
RARCH_LOG_OUTPUT("=================================================\n");
}