about summary refs log tree commit diff
path: root/default.bam
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-02-24 16:03:58 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-02-24 16:03:58 +0000
commit4739966e14ca2df24d4f44fb814b6275b9bf2a3c (patch)
tree2398dee3380dfa48582a71a4f2d4278448fa6cb8 /default.bam
parent1ea859c431b33a384727c0016917dde15bceeff3 (diff)
downloadzcatch-4739966e14ca2df24d4f44fb814b6275b9bf2a3c.tar.gz
zcatch-4739966e14ca2df24d4f44fb814b6275b9bf2a3c.zip
larger restructure to improve security
Diffstat (limited to 'default.bam')
-rw-r--r--default.bam34
1 files changed, 32 insertions, 2 deletions
diff --git a/default.bam b/default.bam
index edba03ab..79945986 100644
--- a/default.bam
+++ b/default.bam
@@ -5,6 +5,11 @@ if family == "windows" then
 	dc_compiler = "scripts\\compiler.py"
 end
 
+netobj_compiler = "python scripts/netobj.py"
+if family == "windows" then
+	netobj_compiler = "scripts\\netobj.py"
+end
+
 dat2c_compiler = "python scripts/dat2c.py"
 if family == "windows" then
 	dat2c_compiler = "scripts\\dat2c.py"
@@ -56,6 +61,15 @@ function dc_cdata(output, data, script)
 	return os.execute(dc_compiler .. " " .. data .. " " .. script .. " -c " .. output)
 end
 
+function netobj_source(output, proto)
+	print("netobj source " .. PathFilename(output) .. " = " .. PathFilename(proto))
+	return os.execute(netobj_compiler .. " source " .. proto .. " " .. output)
+end
+
+function netobj_header(output, proto)
+	print("netobj header " .. PathFilename(output) .. " = " .. PathFilename(proto))
+	return os.execute(netobj_compiler .. " header " .. proto .. " " .. output)
+end
 
 function CHash(output, ...)
 	local inputs = {}
@@ -91,6 +105,17 @@ function Dat2c(datafile, sourcefile, arrayname)
 	return sourcefile
 end
 
+function NetObjCompile(protofile, sourcefile, headerfile)
+	protofile = Path(protofile)
+	sourcefile = Path(sourcefile)
+	headerfile = Path(headerfile)
+	bam_add_job("netobj_source", sourcefile, protofile)
+	bam_add_job("netobj_header", headerfile, protofile)
+	bam_add_dependency(sourcefile, protofile)
+	bam_add_dependency(headerfile, protofile)
+	return {source = sourcefile, header=headerfile}
+end
+
 function DataCompile(datafile, scriptfile, headerfile, sourcefile, outputdatafile)
 	datafile = Path(datafile)
 	scriptfile = Path(scriptfile)
@@ -137,11 +162,16 @@ networkdata = DataCompile(
 		"datasrc/network.dts", 
 		"src/game/generated/g_protocol_ids.h",
 		"src/game/generated/g_protocol_ids.cpp")
+		
+netobj = NetObjCompile(
+		"src/game/g_protocol.def",
+		"src/game/generated/g_protocol.cpp",
+		"src/game/generated/g_protocol.h")
 
 nethash = CHash(
 	"src/game/generated/nethash.c",
 	"src/engine/e_protocol.h",
-	"src/game/g_protocol.h",
+	"src/game/generated/g_protocol.h",
 	"src/game/g_tuning.h",
 	"src/game/g_game.cpp", networkdata.header)
 
@@ -260,7 +290,7 @@ function build(settings)
 	server = Compile(server_settings, Collect("src/engine/server/*.c"))
 	
 	masterserver = Compile(settings, Collect("src/mastersrv/*.cpp"))
-	game_shared = Compile(settings, Collect("src/game/*.cpp"), nethash)
+	game_shared = Compile(settings, Collect("src/game/*.cpp"), nethash, netobj.source)
 	game_client = Compile(settings, Collect("src/game/client/*.cpp"), clientdata.source, clientdata.cdata)
 	game_server = Compile(settings, Collect("src/game/server/*.cpp"), serverdata.source, serverdata.cdata)
 	game_editor = Compile(settings, Collect("src/game/editor/*.cpp"))