made sources build use info from mame.lst (nw)

This commit is contained in:
Miodrag Milanovic 2016-03-02 14:21:26 +01:00
parent 8a84dd2232
commit b489eb202c
4 changed files with 18 additions and 62 deletions

View File

@ -167,45 +167,10 @@ def parse_file(root, srcfile, folder):
return 0
def parse_file_for_drivers(root, srcfile):
try:
fp = open(root + srcfile, 'r')
except IOError:
sys.stderr.write("Unable to open source file '%s'\n" % srcfile)
return 1
in_comment = 0
linenum = 0
for line in fp.readlines():
content = ''
linenum+=1
srcptr = 0
while srcptr < len(line):
c = line[srcptr]
srcptr+=1
if ord(c)==13 or ord(c)==10:
if ord(c)==13 and ord(line[srcptr])==10:
srcptr+=1
continue
if c==' ' or ord(c)==9:
continue
if in_comment==1 and c=='*' and line[srcptr]=='/' :
srcptr+=1
in_comment = 0
continue
if in_comment:
continue
if c=='/' and line[srcptr]=='*' :
srcptr+=1
in_comment = 1
continue
if c=='/' and line[srcptr]=='/' :
break
content += c
content = content.strip()
if len(content)>0:
if content.startswith('COMP') or content.startswith('CONS') or content.startswith('GAME') or content.startswith('SYST') or content.startswith('GAMEL'):
splitname = content.split(',', 3)
if len(splitname)>1:
drivers.append(splitname[1])
srcfile = srcfile.replace('\\','/')
if srcfile.startswith('src/mame/drivers'):
splitname = srcfile.split('/', 4)
drivers.append(splitname[3])
return 0
def parse_lua_file(srcfile):
@ -245,32 +210,13 @@ for filename in deps_files_included:
for filename in sys.argv[2].rsplit(',') :
parse_file_for_drivers(root,filename)
# display output
if sys.argv[3]=='drivers':
# add a reference to the ___empty driver
drivers.append("___empty")
# start with a header
print('#include "emu.h"\n')
print('#include "drivenum.h"\n')
#output the list of externs first
for drv in sorted(drivers):
print("GAME_EXTERN(%s);" % drv)
print(drv)
print("")
# then output the array
print("const game_driver * const driver_list::s_drivers_sorted[%d] =" % len(drivers))
print("{")
for drv in sorted(drivers):
print("\t&GAME_NAME(%s)," % drv)
print("};")
print("")
# also output a global count
print("int driver_list::s_driver_count = %d;\n" % len(drivers))
if sys.argv[3]=='target':
for line in components:
sys.stdout.write("%s\n" % line)

View File

@ -118,7 +118,7 @@ if len(sys.argv) < 2 or len(sys.argv) > 3:
if len(sys.argv) == 3:
if parse_filter_file(sys.argv[2]) :
sys.exit(1)
sys.stderr.write("%d sources found\n" % len(sourcelist))
sys.stderr.write("%d source file(s) found\n" % len(sourcelist))
if parse_file(sys.argv[1]) :
sys.exit(1)
@ -128,7 +128,7 @@ if len(drivlist)==0 :
sys.stderr.write("No drivers found\n")
sys.exit(1)
sys.stderr.write("%d drivers found\n" % len(drivlist))
sys.stderr.write("%d driver(s) found\n" % len(drivlist))
# add a reference to the ___empty driver
drivlist.append("___empty")

View File

@ -1292,7 +1292,7 @@ configuration { }
if (_OPTIONS["SOURCES"] ~= nil) then
OUT_STR = os.outputof( PYTHON .. " " .. MAME_DIR .. "scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["SOURCES"] .. " target " .. _OPTIONS["subtarget"])
load(OUT_STR)()
os.outputof( PYTHON .. " " .. MAME_DIR .. "scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["SOURCES"] .. " drivers " .. _OPTIONS["subtarget"] .. " > ".. GEN_DIR .. _OPTIONS["target"] .. "/" .. _OPTIONS["subtarget"].."/drivlist.cpp")
os.outputof( PYTHON .. " " .. MAME_DIR .. "scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["SOURCES"] .. " drivers " .. _OPTIONS["subtarget"] .. " > ".. GEN_DIR .. _OPTIONS["target"] .. "/" .. _OPTIONS["subtarget"]..".flt")
end
group "libs"

View File

@ -306,6 +306,16 @@ if (_OPTIONS["SOURCES"] == nil) then
end
end
if (_OPTIONS["SOURCES"] ~= nil) then
dependency {
{
GEN_DIR .. _target .. "/" .. _subtarget .."/drivlist.cpp", MAME_DIR .. "src/".._target .."/" .. _target ..".lst", true },
}
custombuildtask {
{ GEN_DIR .. _target .."/" .. _subtarget ..".flt" , GEN_DIR .. _target .. "/" .. _subtarget .."/drivlist.cpp", { MAME_DIR .. "scripts/build/makelist.py", MAME_DIR .. "src/".._target .."/" .. _target ..".lst" }, {"@echo Building driver list...", PYTHON .. " $(1) $(2) $(<) > $(@)" }},
}
end
if _OPTIONS["FORCE_VERSION_COMPILE"]=="1" then
configuration { "gmake" }
dependency {