aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-31 10:29:48 +0100
committermarha <marha@users.sourceforge.net>2013-01-31 10:29:48 +0100
commit49c196c1056aaed97ff5cf43beff5c436d783b99 (patch)
tree6fb821e2c4d3d4c0eedbd53fe0f37dce29412037 /tools
parentb77427f7685360a51b4e2384ef4d0235723b410e (diff)
downloadvcxsrv-49c196c1056aaed97ff5cf43beff5c436d783b99.tar.gz
vcxsrv-49c196c1056aaed97ff5cf43beff5c436d783b99.tar.bz2
vcxsrv-49c196c1056aaed97ff5cf43beff5c436d783b99.zip
mhmake: solved file date checking on 64-bit windows
Diffstat (limited to 'tools')
-rw-r--r--tools/mhmake/makefile16
-rw-r--r--tools/mhmake/src/build.cpp2
-rw-r--r--tools/mhmake/src/fileinfo.cpp17
-rw-r--r--tools/mhmake/src/fileinfo.h12
-rw-r--r--tools/mhmake/src/mhmake.cpp7
-rw-r--r--tools/mhmake/src/mhmakefileparser.cpp6
-rw-r--r--tools/mhmake/src/util.h2
7 files changed, 50 insertions, 12 deletions
diff --git a/tools/mhmake/makefile b/tools/mhmake/makefile
index b9aa0998b..f6a5a8ded 100644
--- a/tools/mhmake/makefile
+++ b/tools/mhmake/makefile
@@ -6,17 +6,23 @@ MHMAKESLNFILE=mhmakevc10.sln
BUILDCMD=devenv.com $(MHMAKESLNFILE) /build
endif
+ifdef IS64
+SUBCONF=|x64
+SUBCONFDIR=64
+else
+SUBCONF=|Win32
+endif
.PHONY: all mhmake_dbg mhmake cleanthis
-all: debug\mhmake_dbg.exe release\mhmake.exe
+all: debug$(SUBCONFDIR)\mhmake_dbg.exe release$(SUBCONFDIR)\mhmake.exe
DEPS=$(wildcard src\*)
-debug\mhmake_dbg.exe: $(DEPS)
- $(BUILDCMD) "Debug|Win32"
+debug$(SUBCONFDIR)\mhmake_dbg.exe: $(DEPS)
+ $(BUILDCMD) "Debug$(SUBCONF)"
-release\mhmake.exe: $(DEPS)
- $(BUILDCMD) "Release|Win32"
+release$(SUBCONFDIR)\mhmake.exe: $(DEPS)
+ $(BUILDCMD) "Release$(SUBCONF)"
clean: cleanthis
diff --git a/tools/mhmake/src/build.cpp b/tools/mhmake/src/build.cpp
index ed9647d17..46e4f4916 100644
--- a/tools/mhmake/src/build.cpp
+++ b/tools/mhmake/src/build.cpp
@@ -1227,7 +1227,7 @@ mh_pid_t mhmakefileparser::ExecuteCommand(string Command, bool &IgnoreError, str
break;
}
if (!Command.length())
- (mh_pid_t)0;
+ return (mh_pid_t)0;
string InCommand=Command;
if (g_Quiet)
Echo=false;
diff --git a/tools/mhmake/src/fileinfo.cpp b/tools/mhmake/src/fileinfo.cpp
index 884d645b5..d9d16c1e3 100644
--- a/tools/mhmake/src/fileinfo.cpp
+++ b/tools/mhmake/src/fileinfo.cpp
@@ -96,6 +96,16 @@ string fileinfo::GetName() const
///////////////////////////////////////////////////////////////////////////////
mh_time_t fileinfo::realGetDate() const
{
+#ifdef WIN32
+ WIN32_FILE_ATTRIBUTE_DATA Attr;
+ BOOL Ret=GetFileAttributesEx(m_AbsFileName.c_str(), GetFileExInfoStandard, &Attr);
+ if (!Ret)
+ ((fileinfo*)this)->m_Date.SetNotExist();
+ else if (Attr.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
+ ((fileinfo*)this)->m_Date.SetDir();
+ else
+ ((fileinfo*)this)->m_Date=*(mh_basetime_t*)&Attr.ftLastWriteTime;
+#else
struct stat Buf;
if (-1==stat(m_AbsFileName.c_str(),&Buf))
((fileinfo*)this)->m_Date.SetNotExist();
@@ -103,6 +113,7 @@ mh_time_t fileinfo::realGetDate() const
((fileinfo*)this)->m_Date.SetDir();
else
((fileinfo*)this)->m_Date=Buf.st_mtime;
+#endif
return m_Date;
}
@@ -141,7 +152,13 @@ bool fileinfo::IsDir() const
///////////////////////////////////////////////////////////////////////////////
void fileinfo::SetDateToNow()
{
+#ifdef WIN32
+ FILETIME ft;
+ GetSystemTimeAsFileTime(&ft);
+ m_Date=*(mh_basetime_t*)&ft;
+#else
m_Date=time(NULL);
+#endif
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/tools/mhmake/src/fileinfo.h b/tools/mhmake/src/fileinfo.h
index b658ac677..f504a3cf3 100644
--- a/tools/mhmake/src/fileinfo.h
+++ b/tools/mhmake/src/fileinfo.h
@@ -67,6 +67,12 @@ inline string stringify(const T& x)
return o.str();
}
+#ifdef WIN32
+typedef unsigned _int64 mh_basetime_t;
+#else
+typedef unsigned long mh_basetime_t;
+#endif
+
#define TIMESAFETY 3
class mh_time
{
@@ -76,13 +82,13 @@ class mh_time
NOTEXISTTIME=1,
DIRTIME =2+TIMESAFETY
};
- unsigned long m_Time;
+ mh_basetime_t m_Time;
bool operator < (const mh_time &Src);
public:
mh_time(){m_Time=DATENOTVALID;}
- mh_time(time_t Time) : m_Time((unsigned long)Time) {}
- mh_time(unsigned long Time) : m_Time(Time) {}
+ mh_time(time_t Time) : m_Time((mh_basetime_t)Time) {}
+ mh_time(mh_basetime_t Time) : m_Time(Time) {}
mh_time(const mh_time &Time) : m_Time(Time.m_Time) {}
void SetDir(void)
diff --git a/tools/mhmake/src/mhmake.cpp b/tools/mhmake/src/mhmake.cpp
index ef515b0b2..735453af6 100644
--- a/tools/mhmake/src/mhmake.cpp
+++ b/tools/mhmake/src/mhmake.cpp
@@ -75,8 +75,11 @@ int __CDECL main(int argc, char* argv[])
{
mhmakefileparser::InitBuildTime();
- char PlatformEnv[]="PLATFORM="PLATFORM;
- putenv(PlatformEnv);
+ if (!getenv("Platform"))
+ {
+ char PlatformEnv[]="PLATFORM="PLATFORM;
+ putenv(PlatformEnv);
+ }
vector<string> CmdLineArgs;
for (int i=1; i<argc; i++)
diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp
index 55ad056db..4a50d6edd 100644
--- a/tools/mhmake/src/mhmakefileparser.cpp
+++ b/tools/mhmake/src/mhmakefileparser.cpp
@@ -1190,7 +1190,13 @@ mh_time_t mhmakefileparser::m_sBuildTime;
void mhmakefileparser::InitBuildTime()
{
+#ifdef WIN32
+ FILETIME ft;
+ GetSystemTimeAsFileTime(&ft);
+ m_sBuildTime=*(mh_basetime_t*)&ft;
+#else
m_sBuildTime=time(NULL);
+#endif
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h
index e7f9ccf57..b1a18c3ed 100644
--- a/tools/mhmake/src/util.h
+++ b/tools/mhmake/src/util.h
@@ -50,7 +50,7 @@
#define PLATFORM "linux"
#endif
-#define MHMAKEVER "3.0.19"
+#define MHMAKEVER "3.0.21"
class makecommand
{