aboutsummaryrefslogtreecommitdiff
path: root/tools/mhmake/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mhmake/src')
-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
6 files changed, 39 insertions, 7 deletions
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
{