summaryrefslogtreecommitdiffstats
path: root/boiler-monster/original-pic-4.2.5/build.vbs
diff options
context:
space:
mode:
Diffstat (limited to 'boiler-monster/original-pic-4.2.5/build.vbs')
-rw-r--r--boiler-monster/original-pic-4.2.5/build.vbs77
1 files changed, 77 insertions, 0 deletions
diff --git a/boiler-monster/original-pic-4.2.5/build.vbs b/boiler-monster/original-pic-4.2.5/build.vbs
new file mode 100644
index 0000000..989fbf1
--- /dev/null
+++ b/boiler-monster/original-pic-4.2.5/build.vbs
@@ -0,0 +1,77 @@
+'Build.vbs
+'Generate MPLAB include script
+'-----------------------------
+'
+Option Explicit
+
+Dim sh, fso, src, fd
+Dim ts, name, timestr
+Dim proj, regpath, build
+
+Const incfile = "build.asm"
+
+Set sh = CreateObject("WScript.Shell")
+Set fso = CreateObject("Scripting.FileSystemObject")
+
+'Make sure to be working in the project directory
+sh.CurrentDirectory = fso.GetParentFolderName(Wscript.ScriptFullName)
+
+'Determine the last modification time of the sources
+ts = DateValue("1/1/1970")
+For Each name In fso.GetFolder(".").Files
+ If LCase(fso.GetExtensionName(name)) = "asm" Then
+ If fso.GetFileName(name) <> incfile Then
+ Set src = fso.GetFile(name)
+ If DateDiff("S", ts, src.DateLastModified) > 0 Then
+ ts = src.DateLastModified
+ End If
+ End If
+ End If
+Next
+
+'Check if the include file needs to be regenerated
+If fso.FileExists(incfile) Then
+ Set src = fso.GetFile(incfile)
+ If DateDiff("S", ts, src.DateLastModified) >= 0 Then
+ Wscript.StdOut.WriteLine "Source was not changed"
+ Wscript.Quit
+ End If
+End If
+
+'Format the last modification time
+timestr = right("0" & hour(ts), 2) & ":" & _
+ right("0" & minute(ts), 2) & " " & _
+ right("0" & day(ts), 2) & "-" & _
+ right("0" & month(ts), 2) & "-" & year(ts)
+
+'Determine the project name
+If WScript.Arguments.Count > 0 Then
+ 'The project name was specified on the command line
+ proj = WScript.Arguments.item(0)
+Else
+ 'Derive the project name from the current directory
+ proj = fso.GetFileName(fso.GetAbsolutePathName("."))
+End If
+
+'Get the build revision from the registry
+regpath = "HKLM\SOFTWARE\Microchip\MPLAB IDE\Projects\" & proj & "\Revision"
+On Error Resume Next
+build = sh.RegRead(regpath)
+If Hex(Err.number) = "80070002" Then
+ build = 1
+Else
+ build = build + 1
+End If
+On Error GoTo 0
+'Update the registry
+sh.RegWrite regpath, build, "REG_DWORD"
+
+'Create the build.asm file
+Set fd = fso.CreateTextFile(incfile)
+fd.WriteLine "#define build """ & build & """"
+fd.WriteLine "#define tstamp """ & timestr & """"
+fd.Close
+
+'Report the build revision to standard output as well
+Wscript.StdOut.WriteLine "Build revision: " & build
+Wscript.StdOut.WriteLine "Build time & date: " & timestr