Pārlūkot izejas kodu

Correctly set app type for main file.
Sort files for app linkage.
Added asm support.

woollybah 10 gadi atpakaļ
vecāks
revīzija
f4e48f96a7
2 mainītis faili ar 46 papildinājumiem un 22 dzēšanām
  1. 36 3
      bmk_make.bmx
  2. 10 19
      bmk_modutil.bmx

+ 36 - 3
bmk_make.bmx

@@ -182,7 +182,7 @@ Type TBuildManager
 
 
 		CalculateDependencies(source, False, opt_all)
 		CalculateDependencies(source, False, opt_all)
 
 
-		bcc_opts :+ " -t " + opt_apptype
+		source.bcc_opts :+ " -t " + opt_apptype
 	
 	
 		' create bmx stages :
 		' create bmx stages :
 		Local gen:TSourceFile = CreateGenStage(source)
 		Local gen:TSourceFile = CreateGenStage(source)
@@ -191,6 +191,8 @@ Type TBuildManager
 	End Method
 	End Method
 	
 	
 	Method DoBuild(app_build:Int = False)
 	Method DoBuild(app_build:Int = False)
+		Local arc_order:TList = New TList
+	
 		Local files:TList = New TList
 		Local files:TList = New TList
 		For Local file:TSourceFile = EachIn sources.Values()
 		For Local file:TSourceFile = EachIn sources.Values()
 			files.AddLast(file)
 			files.AddLast(file)
@@ -207,6 +209,13 @@ Type TBuildManager
 			Local s:String
 			Local s:String
 			For Local m:TSourceFile = EachIn batch
 			For Local m:TSourceFile = EachIn batch
 
 
+				' sort archives for app linkage
+				If m.modid Then
+					If Not arc_order.Contains(m.arc_path) Then
+						arc_order.AddFirst(m.arc_path)
+					End If
+				End If
+
 				Local build_path:String = ExtractDir(m.path) + "/.bmx"
 				Local build_path:String = ExtractDir(m.path) + "/.bmx"
 				
 				
 				If Not FileType(build_path) Then
 				If Not FileType(build_path) Then
@@ -246,7 +255,16 @@ Type TBuildManager
 									CompileC csrc_path,cobj_path, m.cc_opts
 									CompileC csrc_path,cobj_path, m.cc_opts
 								Else
 								Else
 									' asm compilation
 									' asm compilation
-									' TODO
+
+									Local src_path:String = StripExt(m.obj_path) + ".s"
+									Local obj_path:String = StripExt(m.obj_path) + ".o"
+
+									If Not opt_quiet Then
+										Print "Compiling:" + StripDir(src_path)
+									End If
+
+									Assemble src_path, obj_path
+
 								End If
 								End If
 							Case STAGE_LINK
 							Case STAGE_LINK
 
 
@@ -276,7 +294,17 @@ Type TBuildManager
 										End If
 										End If
 										
 										
 										Local links:TList = New TList
 										Local links:TList = New TList
-										m.GetLinks(links)
+										Local opts:TList = New TList
+										m.GetLinks(links, opts)
+
+										For Local arc:String = EachIn arc_order
+											links.AddLast(arc)
+										Next
+										
+										For Local o:String = EachIn opts
+											links.AddLast(o)
+										Next
+
 										LinkApp opt_outfile, links, False, globals.Get("ld_opts")
 										LinkApp opt_outfile, links, False, globals.Get("ld_opts")
 									End If
 									End If
 
 
@@ -482,6 +510,11 @@ Type TBuildManager
 	End Method
 	End Method
 	
 	
 	Method GetMod:TSourceFile(m:String, rebuild:Int = False)
 	Method GetMod:TSourceFile(m:String, rebuild:Int = False)
+	
+		If opt_all And ((opt_modfilter And ((m).Find(opt_modfilter) = 0)) Or (Not opt_modfilter)) And Not app_main Then
+			rebuild = True
+		End If
+	
 		Local path:String = ModulePath(m)
 		Local path:String = ModulePath(m)
 		Local id:String = ModuleIdent(m)
 		Local id:String = ModuleIdent(m)
 		Local src_path:String = path + "/" + id + ".bmx"
 		Local src_path:String = path + "/" + id + ".bmx"

+ 10 - 19
bmk_modutil.bmx

@@ -124,18 +124,13 @@ Type TSourceFile
 		Return t
 		Return t
 	End Method
 	End Method
 
 
-	Method GetLinks(list:TList, modsOnly:Int = False)
+	Method GetLinks(list:TList, opts:TList, modsOnly:Int = False)
 
 
 		If list And stage = STAGE_LINK Then
 		If list And stage = STAGE_LINK Then
-			Local p:String
-			If modid Then
-				p = arc_path
-			Else
-				p = obj_path
-			End If
-
-			If Not list.Contains(p) Then
-				list.AddLast(p)
+			If Not modid Then
+				If Not list.Contains(obj_path) Then
+					list.AddLast(obj_path)
+				End If
 			End If
 			End If
 		End If
 		End If
 
 
@@ -143,11 +138,7 @@ Type TSourceFile
 			For Local s:TSourceFile = EachIn depsList
 			For Local s:TSourceFile = EachIn depsList
 				If Not modsOnly Or (modsOnly And s.modid) Then
 				If Not modsOnly Or (modsOnly And s.modid) Then
 					If Not stage Then
 					If Not stage Then
-						If s.modid Then
-							If Not list.Contains(s.arc_path) Then
-								list.AddLast(s.arc_path)
-							End If
-						Else
+						If Not s.modid Then
 							If Not list.Contains(s.obj_path) Then
 							If Not list.Contains(s.obj_path) Then
 								list.AddLast(s.obj_path)
 								list.AddLast(s.obj_path)
 							End If
 							End If
@@ -155,7 +146,7 @@ Type TSourceFile
 					End If
 					End If
 				End If
 				End If
 				
 				
-				s.GetLinks(list, modsOnly)
+				s.GetLinks(list, opts, modsOnly)
 
 
 			Next
 			Next
 		End If
 		End If
@@ -163,7 +154,7 @@ Type TSourceFile
 		If moddeps Then
 		If moddeps Then
 
 
 			For Local s:TSourceFile = EachIn moddeps.Values()
 			For Local s:TSourceFile = EachIn moddeps.Values()
-				s.GetLinks(list, True)
+				s.GetLinks(list, opts, True)
 			Next
 			Next
 		End If
 		End If
 
 
@@ -178,8 +169,8 @@ Type TSourceFile
 
 
 		If ext_files Then
 		If ext_files Then
 			For Local f:String = EachIn ext_files
 			For Local f:String = EachIn ext_files
-				If Not list.Contains(f) Then
-					list.AddLast(f)
+				If Not opts.Contains(f) Then
+					opts.AddLast(f)
 				End If
 				End If
 			Next
 			Next
 		End If
 		End If