diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-08-22 21:13:33 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-08-22 21:13:33 +0000 |
| commit | 0320d20a477e2edbf15f3d961add7c9cd5be7f94 (patch) | |
| tree | 589005b1e64381b5144cf3106c78befdc692deb2 /default.bam | |
| parent | 01fa2a14a22a4be0a735597902d1b136469604a0 (diff) | |
| download | zcatch-0320d20a477e2edbf15f3d961add7c9cd5be7f94.tar.gz zcatch-0320d20a477e2edbf15f3d961add7c9cd5be7f94.zip | |
fixed network hash versioning
Diffstat (limited to 'default.bam')
| -rw-r--r-- | default.bam | 69 |
1 files changed, 59 insertions, 10 deletions
diff --git a/default.bam b/default.bam index ef544015..537edaf6 100644 --- a/default.bam +++ b/default.bam @@ -10,11 +10,26 @@ if family == "windows" then dat2c_compiler = "scripts\\dat2c.py" end +cmd5_tool = "python scripts/cmd5.py" +if family == "windows" then + cmd5_tool = "scripts\\cmd5.py" +end + function rc(output, input) print("rc " .. PathFilename(input)) return os.execute("rc /fo " .. output .. " " .. input) end +function cmd5(output, inputs) + print("cmd5 " .. PathFilename(output)) + cmd = cmd5_tool .. " " + for i,v in inputs do + cmd = cmd .. v .. " " + end + cmd = cmd .. " > " .. output + return os.execute(cmd) +end + function dat2c(output, data, name) print("dat2c " .. PathFilename(output) .. " = " .. PathFilename(data)) return os.execute(dat2c_compiler .. " " .. data .. " " .. name .. " > " .. output) @@ -40,6 +55,25 @@ function dc_cdata(output, data, script) return os.execute(dc_compiler .. " " .. data .. " " .. script .. " -c " .. output) end + +function CHash(output, ...) + local inputs = {} + local ih = collect_input(arg) + + output = Path(output) + + -- compile all the files + for index, inname in ih do + table.insert(inputs, Path(inname)) + end + + bam_add_job("cmd5", output, inputs) + for index, inname in inputs do + bam_add_dependency(output, inname) + end + return output +end + function ResCompile(scriptfile) scriptfile = Path(scriptfile) output = PathBase(scriptfile) .. ".res" @@ -60,18 +94,26 @@ function DataCompile(datafile, scriptfile, headerfile, sourcefile, outputdatafil datafile = Path(datafile) scriptfile = Path(scriptfile) headerfile = Path(headerfile) - sourcefile = Path(sourcefile) - outputdatafile = Path(outputdatafile) - bam_add_job("dc_source", sourcefile, datafile, scriptfile) + bam_add_job("dc_header", headerfile, datafile, scriptfile) - bam_add_job("dc_cdata", outputdatafile, datafile, scriptfile) - bam_add_dependency(sourcefile, datafile) - bam_add_dependency(sourcefile, scriptfile) - bam_add_dependency(sourcefile, headerfile) bam_add_dependency(headerfile, datafile) bam_add_dependency(headerfile, scriptfile) - bam_add_dependency(outputdatafile, datafile) - bam_add_dependency(outputdatafile, scriptfile) + + if sourcefile then + sourcefile = Path(sourcefile) + bam_add_job("dc_source", sourcefile, datafile, scriptfile) + bam_add_dependency(sourcefile, datafile) + bam_add_dependency(sourcefile, scriptfile) + bam_add_dependency(sourcefile, headerfile) + end + + if outputdatafile then + outputdatafile = Path(outputdatafile) + bam_add_job("dc_cdata", outputdatafile, datafile, scriptfile) + bam_add_dependency(outputdatafile, datafile) + bam_add_dependency(outputdatafile, scriptfile) + end + return {cdata = outputdatafile, header=headerfile, source=sourcefile} end @@ -89,6 +131,13 @@ clientdata = DataCompile( "src/game/client/data/client_data.cpp", "src/game/client/data/client_internal.cpp") +networkdata = DataCompile( + "datasrc/teewars.ds", + "datasrc/network.dts", + "src/game/protocol_ids.h") + +nethash = CHash("src/game/nethash.c", "src/engine/protocol.h", "src/game/game_protocol.h", networkdata.header) + client_link_other = {} if family == "windows" then client_link_other = {ResCompile("other/icons/teewars.rc")} @@ -171,7 +220,7 @@ function build(settings) server = Compile(engine_settings, Collect("src/engine/server/*.c")) masterserver = Compile(settings, Collect("src/mastersrv/*.cpp")) - game_shared = Compile(settings, Collect("src/game/*.cpp")) + game_shared = Compile(settings, Collect("src/game/*.cpp"), nethash) 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) editor = Compile(settings, Collect("src/editor/*.cpp")) |