Browse Source

Adds support for setting command-line options in custom.bmk.

woollybah 9 years ago
parent
commit
e3f673a8ff
3 changed files with 87 additions and 10 deletions
  1. 1 0
      bmk.bmx
  2. 76 1
      bmk_config.bmx
  3. 10 9
      bmk_ng.bmx

+ 1 - 0
bmk.bmx

@@ -1,5 +1,6 @@
 '
 '
 ' Change History :
 ' Change History :
+' 3.14 05/06/2016 - Can now set command-line options via custom.bmk.
 ' 3.13 21/05/2016 - Added default simd cc_opt for x64 (-msse4).
 ' 3.13 21/05/2016 - Added default simd cc_opt for x64 (-msse4).
 ' 3.12 17/04/2016 - App link optimisations.
 ' 3.12 17/04/2016 - App link optimisations.
 ' 3.11 20/02/2016 - Added -nostrictupgrade option for NG.
 ' 3.11 20/02/2016 - Added -nostrictupgrade option for NG.

+ 76 - 1
bmk_config.bmx

@@ -6,7 +6,7 @@ Import BRL.StandardIO
 ?macos
 ?macos
 Import Pub.MacOS
 Import Pub.MacOS
 ?
 ?
-Const BMK_VERSION:String = "3.13"
+Const BMK_VERSION:String = "3.14"
 
 
 Const ALL_SRC_EXTS$="bmx;i;c;m;h;cpp;cxx;mm;hpp;hxx;s;cc"
 Const ALL_SRC_EXTS$="bmx;i;c;m;h;cpp;cxx;mm;hpp;hxx;s;cc"
 
 
@@ -34,11 +34,16 @@ Global opt_appstub$="brl.appstub" ' BaH 28/9/2007
 Global opt_universal=False
 Global opt_universal=False
 Global opt_target_platform:String
 Global opt_target_platform:String
 Global opt_gdbdebug=False
 Global opt_gdbdebug=False
+Global opt_gdbdebug_set=False
 Global opt_standalone=False
 Global opt_standalone=False
+Global opt_standalone_set=False
 Global opt_nolog
 Global opt_nolog
 Global opt_quickscan=False
 Global opt_quickscan=False
+Global opt_quickscan_set=False
 Global opt_nostrictupgrade=False
 Global opt_nostrictupgrade=False
+Global opt_nostrictupgrade_set=False
 Global opt_warnover=False
 Global opt_warnover=False
+Global opt_warnover_set=False
 
 
 Global opt_dumpbuild
 Global opt_dumpbuild
 
 
@@ -217,14 +222,19 @@ Function ParseConfigArgs$[]( args$[] )
 			End Select
 			End Select
 		Case "gdb"
 		Case "gdb"
 			opt_gdbdebug = True
 			opt_gdbdebug = True
+			opt_gdbdebug_set = True
 		Case "standalone"
 		Case "standalone"
 			opt_standalone = True
 			opt_standalone = True
+			opt_standalone_set = True
 		Case "quick"
 		Case "quick"
 			opt_quickscan = True
 			opt_quickscan = True
+			opt_quickscan = True
 		Case "nostrictupgrade"
 		Case "nostrictupgrade"
 			opt_nostrictupgrade = True
 			opt_nostrictupgrade = True
+			opt_nostrictupgrade_set = True
 		Case "w"
 		Case "w"
 			opt_warnover = True
 			opt_warnover = True
+			opt_warnover_set = True
 		Default
 		Default
 			CmdError "Invalid option '" + arg[1..] + "'"
 			CmdError "Invalid option '" + arg[1..] + "'"
 		End Select
 		End Select
@@ -434,3 +444,68 @@ Function VersionInfo(gcc:String, cores:Int)
 	
 	
 	Print s + "~n"
 	Print s + "~n"
 End Function
 End Function
+
+Function AsConfigurable:Int(key:String, value:String)
+	Local config:Int = False
+	Local set:Int = 0
+	Select key
+		Case "opt_warnover"
+			If Not opt_warnover_set Then
+				opt_warnover = Int(value)
+				set = 1
+			Else
+				If opt_warnover <> Int(value) Then
+					set = 2
+				End If
+			End If
+			config = True
+		Case "opt_quickscan"
+			If Not opt_quickscan_set Then
+				opt_quickscan = Int(value)
+				set = 1
+			Else
+				If opt_quickscan <> Int(value) Then
+					set = 2
+				End If
+			End If
+			config = True
+		Case "opt_gdbdebug"
+			If Not opt_gdbdebug_set Then
+				opt_gdbdebug = Int(value)
+				set = 1
+			Else
+				If opt_gdbdebug <> Int(value) Then
+					set = 2
+				End If
+			End If
+			config = True
+		Case "opt_standalone"
+			If Not opt_standalone_set Then
+				opt_standalone = Int(value)
+				set = 1
+			Else
+				If opt_standalone <> Int(value) Then
+					set = 2
+				End If
+			End If
+			config = True
+		Case "opt_nostrictupgrade"
+			If Not opt_nostrictupgrade_set Then
+				opt_nostrictupgrade = Int(value)
+				set = 1
+			Else
+				If opt_nostrictupgrade <> Int(value) Then
+					set = 2
+				End If
+			End If
+			config = True
+	End Select
+	If set And opt_verbose Then
+		If set = 1 Then
+			Print "Using " + key.ToUpper() + " = " + value
+		Else
+			Print "Config " + key.ToUpper() + " = " + value + "  was NOT used because command-line arguments override it"
+		End If
+	End If
+	Return config
+End Function

+ 10 - 9
bmk_ng.bmx

@@ -853,17 +853,18 @@ Type TBMKGlobals
 	
 	
 	' adds value to the end of variable
 	' adds value to the end of variable
 	Method Add(variable:String, value:String)
 	Method Add(variable:String, value:String)
-		variable = variable.ToUpper()
-
-		Local v:Object = vars.ValueForKey(variable)
-		If Not TOptionVariable(v) Then
-			If v Then
-				SetVar(variable, String(v) + " " + value)
-			Else
-				SetVar(variable, value)
+		If Not AsConfigurable(variable.ToLower(), value) Then
+			variable = variable.ToUpper()
+	
+			Local v:Object = vars.ValueForKey(variable)
+			If Not TOptionVariable(v) Then
+				If v Then
+					SetVar(variable, String(v) + " " + value)
+				Else
+					SetVar(variable, value)
+				End If
 			End If
 			End If
 		End If
 		End If
-
 	End Method
 	End Method
 
 
 	Method AddOption(variable:String, key:String, value:String)
 	Method AddOption(variable:String, key:String, value:String)