diff --git a/scripts/build/makedep.py b/scripts/build/makedep.py index a80582d0161..d70820a059f 100644 --- a/scripts/build/makedep.py +++ b/scripts/build/makedep.py @@ -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) diff --git a/scripts/build/makelist.py b/scripts/build/makelist.py index 7783ee64d4d..329ff374520 100644 --- a/scripts/build/makelist.py +++ b/scripts/build/makelist.py @@ -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") diff --git a/scripts/genie.lua b/scripts/genie.lua index 3e246cc34ac..ef5c945bb64 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -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" diff --git a/scripts/src/main.lua b/scripts/src/main.lua index efd1ca75f32..eafcc59f72e 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -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 {