Merge pull request #1704 from oddMLan/nranges-revenge

[Nrage-input] Update Makefile to generate version.h
This commit is contained in:
zilmar 2020-02-10 21:12:42 +10:30 committed by GitHub
commit c126156dd6
9 changed files with 61 additions and 21 deletions

View File

@ -24,8 +24,8 @@
#include <algorithm> #include <algorithm>
#include <math.h> #include <math.h>
#include <InitGuid.h> #include <initguid.h>
#include <CGuid.h> #include <cguid.h>
#include <dinput.h> #include <dinput.h>
#include "commonIncludes.h" #include "commonIncludes.h"

View File

@ -25,7 +25,7 @@
#include <stdio.h> #include <stdio.h>
#include <windows.h> #include <windows.h>
#include <CommDlg.h> #include <commdlg.h>
#include <shlobj.h> #include <shlobj.h>
#include <tchar.h> #include <tchar.h>

View File

@ -24,7 +24,7 @@
#include <stdio.h> #include <stdio.h>
#include <windows.h> #include <windows.h>
#include <Commctrl.h> #include <commctrl.h>
#include "commonIncludes.h" #include "commonIncludes.h"
#include "DirectInput.h" #include "DirectInput.h"

View File

@ -1,6 +1,28 @@
CXX := g++ IS_GIT := $(if $(shell git rev-parse --show-toplevel 2>/dev/null),1)
LD := g++ IS_HG := $(if $(shell hg root 2>/dev/null),1)
WINDRES := windres
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 := \ OBJECTS := \
Debug.o \ Debug.o \
@ -18,6 +40,8 @@ RESOURCE := NRagePluginV2.res
TARGET := PJ64_NRage.dll TARGET := PJ64_NRage.dll
CPPFLAGS := \ CPPFLAGS := \
-DGIT_VERSION=\"$(GIT_VERSION)\" \
-DVERSION_BUILD=$(VERSION_BUILD) \
-DNOMINMAX -DNOMINMAX
CXXFLAGS := \ CXXFLAGS := \
@ -33,8 +57,13 @@ LIBS := \
-lgdi32 \ -lgdi32 \
-lole32 \ -lole32 \
-loleaut32 \ -loleaut32 \
-luuid \ -luuid
-static -lwinpthread
ifeq ($(DYN_WINPTHREAD),1)
LIBS += -lwinpthread
else
LIBS += -static -lwinpthread
endif
LDFLAGS := \ LDFLAGS := \
-mwindows \ -mwindows \
@ -45,17 +74,23 @@ DEPFILES := $(addprefix .deps/,$(OBJECTS:.o=.d))
.PHONY: all clean .PHONY: all clean
all: .deps $(TARGET) all: .deps Version.h $(TARGET)
-include $(DEPFILES) -include $(DEPFILES)
clean: clean:
rm -f $(TARGET) $(OBJECTS) $(RESOURCE) $(DEPFILES) -rm -f $(TARGET)
rm -rf .deps -rm -f $(OBJECTS) $(RESOURCE)
-rm -f $(DEPFILES)
-rm -rf .deps
-rm -f Version.h
.deps: .deps:
mkdir -p $@ mkdir -p $@
Version.h: Version.h.in
cp $< $@
%.res: %.rc %.res: %.rc
$(WINDRES) -O coff -o $@ -i $< $(WINDRES) -O coff -o $@ -i $<

View File

@ -22,9 +22,9 @@
*/ */
#include <windows.h> #include <windows.h>
#include <Commctrl.h> #include <commctrl.h>
#include <dinput.h> #include <dinput.h>
#include <Xinput.h> #include <xinput.h>
#include "commonIncludes.h" #include "commonIncludes.h"

View File

@ -8,7 +8,7 @@
// //
// Generated from the TEXTINCLUDE 2 resource. // Generated from the TEXTINCLUDE 2 resource.
// //
#include "WinResrc.h" #include "winresrc.h"
#ifdef IDC_STATIC #ifdef IDC_STATIC
#undef IDC_STATIC #undef IDC_STATIC
@ -558,14 +558,14 @@ END
// PROFILE // PROFILE
// //
IDR_PROFILE_DEFAULT1 PROFILE "configs\\Controller1.cpf" IDR_PROFILE_DEFAULT1 PROFILE "configs/Controller1.cpf"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// SHORTCUT // SHORTCUT
// //
IDR_SHORTCUTS_DEFAULT SHORTCUT "configs\\Shortcuts.sc" IDR_SHORTCUTS_DEFAULT SHORTCUT "configs/Shortcuts.sc"
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -25,7 +25,7 @@
#include <stdio.h> #include <stdio.h>
#include <windows.h> #include <windows.h>
#include <Commctrl.h> #include <commctrl.h>
#include <tchar.h> #include <tchar.h>
#include "commonIncludes.h" #include "commonIncludes.h"

View File

@ -26,8 +26,12 @@
#define VERSION_MAJOR 2 #define VERSION_MAJOR 2
#define VERSION_MINOR 5 #define VERSION_MINOR 5
#define VERSION_REVISION 3 #define VERSION_REVISION 3
#ifndef VERSION_BUILD
#define VERSION_BUILD 9999 #define VERSION_BUILD 9999
#endif
#ifndef GIT_VERSION
#define GIT_VERSION "" #define GIT_VERSION ""
#endif
#define VER_FILE_DESCRIPTION_STR "N-Rage for Project64" #define VER_FILE_DESCRIPTION_STR "N-Rage for Project64"
#define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD #define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD

View File

@ -20,15 +20,16 @@
*/ */
//code from http://msdn.microsoft.com/en-us/library/ee417014(VS.85).aspx //code from http://msdn.microsoft.com/en-us/library/ee417014(VS.85).aspx
#include <stdio.h>
#include <wchar.h>
#include <windows.h> #include <windows.h>
#include <wbemidl.h> #include <wbemidl.h>
#include <tchar.h>
#include "XInputController.h" #include "XInputController.h"
#include "FileAccess.h" #include "FileAccess.h"
#include <wchar.h>
#include <tchar.h>
#include "resource.h" #include "resource.h"
#include <stdio.h>
//We need to keep track of XInput control id's //We need to keep track of XInput control id's
int iXinputControlId = 0; int iXinputControlId = 0;