diff --git a/Source/nragev20/DirectInput.cpp b/Source/nragev20/DirectInput.cpp index 00a3911ba..ddde4f1a1 100644 --- a/Source/nragev20/DirectInput.cpp +++ b/Source/nragev20/DirectInput.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include #include "commonIncludes.h" diff --git a/Source/nragev20/FileAccess.cpp b/Source/nragev20/FileAccess.cpp index 28e010af2..69b0aa0de 100644 --- a/Source/nragev20/FileAccess.cpp +++ b/Source/nragev20/FileAccess.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/Source/nragev20/Interface.cpp b/Source/nragev20/Interface.cpp index 2a3ead60a..1d7bcc656 100644 --- a/Source/nragev20/Interface.cpp +++ b/Source/nragev20/Interface.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include "commonIncludes.h" #include "DirectInput.h" diff --git a/Source/nragev20/Makefile b/Source/nragev20/Makefile index aae16ecbc..9e2ec7d21 100644 --- a/Source/nragev20/Makefile +++ b/Source/nragev20/Makefile @@ -1,6 +1,28 @@ -CXX := g++ -LD := g++ -WINDRES := windres +IS_GIT := $(if $(shell git rev-parse --show-toplevel 2>/dev/null),1) +IS_HG := $(if $(shell hg root 2>/dev/null),1) + +ifeq ($(IS_HG),1) +$(info This is a hg repository) +GIT_VERSION := "hg:$(shell hg identify --id)" +VERSION_BUILD := 0 +endif + +ifeq ($(IS_GIT),1) +$(info This is a git repository) +GIT_VERSION := "git:$(shell git describe --always --long --dirty=+ 2>/dev/null)" +VERSION_BUILD := 0 +endif + +ifeq ($(or $(IS_GIT),$(IS_HG)),) +$(info Not inside a repository) +GIT_VERSION := "?" +VERSION_BUILD := 0 +endif + + +CXX ?= g++ +LD := $(CXX) +WINDRES ?= windres OBJECTS := \ Debug.o \ @@ -18,6 +40,8 @@ RESOURCE := NRagePluginV2.res TARGET := PJ64_NRage.dll CPPFLAGS := \ + -DGIT_VERSION=\"$(GIT_VERSION)\" \ + -DVERSION_BUILD=$(VERSION_BUILD) \ -DNOMINMAX CXXFLAGS := \ @@ -33,8 +57,13 @@ LIBS := \ -lgdi32 \ -lole32 \ -loleaut32 \ - -luuid \ - -static -lwinpthread + -luuid + +ifeq ($(DYN_WINPTHREAD),1) +LIBS += -lwinpthread +else +LIBS += -static -lwinpthread +endif LDFLAGS := \ -mwindows \ @@ -45,17 +74,23 @@ DEPFILES := $(addprefix .deps/,$(OBJECTS:.o=.d)) .PHONY: all clean -all: .deps $(TARGET) +all: .deps Version.h $(TARGET) -include $(DEPFILES) clean: - rm -f $(TARGET) $(OBJECTS) $(RESOURCE) $(DEPFILES) - rm -rf .deps + -rm -f $(TARGET) + -rm -f $(OBJECTS) $(RESOURCE) + -rm -f $(DEPFILES) + -rm -rf .deps + -rm -f Version.h .deps: mkdir -p $@ +Version.h: Version.h.in + cp $< $@ + %.res: %.rc $(WINDRES) -O coff -o $@ -i $< diff --git a/Source/nragev20/NRagePluginV2.cpp b/Source/nragev20/NRagePluginV2.cpp index 2d34c15e5..4a758fef1 100644 --- a/Source/nragev20/NRagePluginV2.cpp +++ b/Source/nragev20/NRagePluginV2.cpp @@ -22,9 +22,9 @@ */ #include -#include +#include #include -#include +#include #include "commonIncludes.h" diff --git a/Source/nragev20/NRagePluginV2.rc b/Source/nragev20/NRagePluginV2.rc index acace5071..691d4d86c 100644 --- a/Source/nragev20/NRagePluginV2.rc +++ b/Source/nragev20/NRagePluginV2.rc @@ -8,7 +8,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "WinResrc.h" +#include "winresrc.h" #ifdef IDC_STATIC #undef IDC_STATIC @@ -558,14 +558,14 @@ END // PROFILE // -IDR_PROFILE_DEFAULT1 PROFILE "configs\\Controller1.cpf" +IDR_PROFILE_DEFAULT1 PROFILE "configs/Controller1.cpf" ///////////////////////////////////////////////////////////////////////////// // // SHORTCUT // -IDR_SHORTCUTS_DEFAULT SHORTCUT "configs\\Shortcuts.sc" +IDR_SHORTCUTS_DEFAULT SHORTCUT "configs/Shortcuts.sc" #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/nragev20/PakIO.cpp b/Source/nragev20/PakIO.cpp index 246fea82d..3de8838ea 100644 --- a/Source/nragev20/PakIO.cpp +++ b/Source/nragev20/PakIO.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include "commonIncludes.h" diff --git a/Source/nragev20/Version.h.in b/Source/nragev20/Version.h.in index 2f08772cd..4dc7e828e 100644 --- a/Source/nragev20/Version.h.in +++ b/Source/nragev20/Version.h.in @@ -26,8 +26,12 @@ #define VERSION_MAJOR 2 #define VERSION_MINOR 5 #define VERSION_REVISION 3 +#ifndef VERSION_BUILD #define VERSION_BUILD 9999 +#endif +#ifndef GIT_VERSION #define GIT_VERSION "" +#endif #define VER_FILE_DESCRIPTION_STR "N-Rage for Project64" #define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD diff --git a/Source/nragev20/XInputController.cpp b/Source/nragev20/XInputController.cpp index c630e6438..8a0efea64 100644 --- a/Source/nragev20/XInputController.cpp +++ b/Source/nragev20/XInputController.cpp @@ -20,15 +20,16 @@ */ //code from http://msdn.microsoft.com/en-us/library/ee417014(VS.85).aspx +#include +#include + #include #include +#include #include "XInputController.h" #include "FileAccess.h" -#include -#include #include "resource.h" -#include //We need to keep track of XInput control id's int iXinputControlId = 0;