More quality of life features for new source layout:

Added support for wildcards in .flt filter files.  You'll need to quote
them to avoid /* being parsed as a comment initiator, like "seta/*.cpp"
on a line including the quotes.

Added an XSLT filter for listing system driver sources, like
mame -lx | xsltproc scripts/xslt/list-system-sources.xslt

Converted the ci subtarget (which isn't really used much) into a .flt
rather than .lua and .lst files.
This commit is contained in:
Vas Crabb 2022-06-29 01:29:04 +10:00
parent c639edbca7
commit 871837b123
7 changed files with 101 additions and 249 deletions

View File

@ -4,6 +4,7 @@
## copyright-holders:Vas Crabb
import argparse
import glob
import io
import os.path
import sys
@ -392,7 +393,7 @@ class DriverFilter:
[chr(x) for x in range(ord('a'), ord('z') + 1)] +
['_'])
def parse_filter(self, path, sourcefile, inclusion, exclusion):
def parse_filter(self, root, path, sourcefile, inclusion, exclusion):
def line_hook(text):
text = text.strip()
if text.startswith('#'):
@ -416,7 +417,14 @@ class DriverFilter:
sys.exit(1)
exclusion(text)
elif text:
sourcefile(text)
if (len(text) >= 2) and ((text[0] == '"') or (text[0] == "'")) and (text[0] == text[-1]):
text = text[1:-1]
paths = glob.glob(os.path.join(basepath, *text.split('/')))
if not paths:
sys.stderr.write('%s:%s: Pattern "%s" did not match any source files\n' % (path, parser.input_line, text))
sys.exit(1)
for source in paths:
sourcefile('/'.join(os.path.split(os.path.relpath(source, basepath))))
try:
filterfile = io.open(path, 'r', encoding='utf-8')
@ -424,6 +432,7 @@ class DriverFilter:
sys.stderr.write('Unable to open filter file "%s"\n' % (path, ))
sys.exit(1)
with filterfile:
basepath = os.path.join(root, 'src', 'mame')
handler = CppParser.Handler()
handler.line = line_hook
parser = CppParser(handler)
@ -507,7 +516,7 @@ class DriverLister(DriverFilter):
includes = set()
excludes = set()
if options.filter is not None:
self.parse_filter(options.filter, includesource, includedriver, excludedriver)
self.parse_filter(options.root, options.filter, includesource, includedriver, excludedriver)
sys.stderr.write('%d source file(s) found\n' % (len(sources), ))
self.sources = frozenset(sources)
self.includes = frozenset(includes)
@ -566,7 +575,7 @@ class DriverCollector(DriverFilter):
sources = set()
includes = set()
state = { 'prevsource': None }
self.parse_filter(options.filter, includesource, includedriver, excludedriver)
self.parse_filter(options.root, options.filter, includesource, includedriver, excludedriver)
self.parse_list(options.list, sourcefile, driver)
sys.stderr.write('%d source file(s) found\n' % (len(sources), ))
self.sources = sorted(sources)
@ -590,15 +599,14 @@ def split_path(path):
def parse_command_line():
parser = argparse.ArgumentParser()
parser.add_argument('-r', '--root', metavar='<srcroot>', default='.', help='path to emulator source root (defaults to working directory)')
subparsers = parser.add_subparsers(title='commands', dest='command', metavar='<command>')
subparser = subparsers.add_parser('sourcesproject', help='generate project directives for source files')
subparser.add_argument('-r', '--root', metavar='<srcroot>', default='.', help='path to emulator source root (defaults to working directory)')
subparser.add_argument('-t', '--target', metavar='<target>', required=True, help='generated emulator target name')
subparser.add_argument('sources', metavar='<srcfile>', nargs='+', help='source files to include')
subparser = subparsers.add_parser('filterproject', help='generate project directives using filter file')
subparser.add_argument('-r', '--root', metavar='<srcroot>', default='.', help='path to emulator source root (defaults to working directory)')
subparser.add_argument('-t', '--target', metavar='<target>', required=True, help='generated emulator target name')
subparser.add_argument('-f', '--filter', metavar='<fltfile>', required=True, help='input filter file')
subparser.add_argument('list', metavar='<lstfile>', help='input list file')

View File

@ -567,7 +567,7 @@ elseif (_OPTIONS["SOURCES"] == nil) and (_OPTIONS["SOURCEFILTER"] == nil) then
local driverlist = path.join(MAME_DIR, "src", _OPTIONS["target"], _OPTIONS["target"] .. ".lst")
local OUT_STR = os.outputof(
string.format(
"%s %s filterproject -r %s -t %s -f %s %s",
"%s %s -r %s filterproject -t %s -f %s %s",
PYTHON, makedep, MAME_DIR, _OPTIONS["subtarget"], subtargetfilter, driverlist))
load(OUT_STR)()
else
@ -1442,7 +1442,7 @@ if _OPTIONS["SOURCES"] ~= nil then
local OUT_STR = os.outputof(
string.format(
"%s %s sourcesproject -r %s -t %s %s",
"%s %s -r %s sourcesproject -t %s %s",
PYTHON, makedep, MAME_DIR, _OPTIONS["subtarget"], sourceargs))
load(OUT_STR)()
@ -1450,8 +1450,8 @@ if _OPTIONS["SOURCES"] ~= nil then
local driverfilter = path.join(GEN_DIR, _OPTIONS["target"], _OPTIONS["subtarget"] .. ".flt")
os.outputof(
string.format(
"%s %s sourcesfilter -l %s %s > %s",
PYTHON, makedep, driverlist, sourceargs, driverfilter))
"%s %s -r %s sourcesfilter -l %s %s > %s",
PYTHON, makedep, MAME_DIR, driverlist, sourceargs, driverfilter))
elseif _OPTIONS["SOURCEFILTER"] ~= nil then
local driverfilter = path.join(MAME_DIR, _OPTIONS["SOURCEFILTER"])
if not os.isfile(driverfilter) then
@ -1462,7 +1462,7 @@ elseif _OPTIONS["SOURCEFILTER"] ~= nil then
local driverlist = path.join(MAME_DIR, "src", _OPTIONS["target"], _OPTIONS["target"] .. ".lst")
local OUT_STR = os.outputof(
string.format(
"%s %s filterproject -r %s -t %s -f %s %s",
"%s %s -r %s filterproject -t %s -f %s %s",
PYTHON, makedep, MAME_DIR, _OPTIONS["subtarget"], driverfilter, driverlist))
load(OUT_STR)()
end

View File

@ -295,7 +295,7 @@ if (STANDALONE~=true) then
{ MAME_DIR .. "scripts/build/makedep.py", driverlist },
{
"@echo Building driver list...",
PYTHON .. " $(1) driverlist $(2) -f $(<) > $(@)"
PYTHON .. " $(1) -r " .. MAME_DIR .. " driverlist $(2) -f $(<) > $(@)"
}
},
}
@ -310,7 +310,7 @@ if (STANDALONE~=true) then
{ MAME_DIR .. "scripts/build/makedep.py", driverlist },
{
"@echo Building driver list...",
PYTHON .. " $(1) driverlist $(2) -f $(<) > $(@)"
PYTHON .. " $(1) -r " .. MAME_DIR .. " driverlist $(2) -f $(<) > $(@)"
}
},
}
@ -325,7 +325,7 @@ if (STANDALONE~=true) then
{ MAME_DIR .. "scripts/build/makedep.py", driverlist },
{
"@echo Building driver list...",
PYTHON .. " $(1) driverlist $(2) -f $(<) > $(@)"
PYTHON .. " $(1) -r " .. MAME_DIR .. " driverlist $(2) -f $(<) > $(@)"
}
},
}
@ -337,7 +337,7 @@ if (STANDALONE~=true) then
{ MAME_DIR .. "scripts/build/makedep.py" },
{
"@echo Building driver list...",
PYTHON .. " $(1) driverlist $(<) > $(@)"
PYTHON .. " $(1) -r " .. MAME_DIR .. " driverlist $(<) > $(@)"
}
},
}
@ -352,7 +352,7 @@ if (STANDALONE~=true) then
{ MAME_DIR .. "scripts/build/makedep.py" },
{
"@echo Building driver list...",
PYTHON .. " $(1) driverlist $(<) > $(@)"
PYTHON .. " $(1) -r " .. MAME_DIR .. " driverlist $(<) > $(@)"
}
},
}

View File

@ -1,190 +0,0 @@
-- license:BSD-3-Clause
-- copyright-holders:MAMEdev Team
---------------------------------------------------------------------------
--
-- ci.lua
--
-- Small driver-specific example makefile for use in CI
-- Use make SUBTARGET=ci to build
--
---------------------------------------------------------------------------
--------------------------------------------------
-- Specify all the CPU cores necessary for the
-- drivers referenced in ci.lst.
--------------------------------------------------
CPUS["Z80"] = true
CPUS["M6502"] = true
CPUS["MCS48"] = true
CPUS["MCS51"] = true
CPUS["M6800"] = true
CPUS["M6805"] = true
CPUS["M6809"] = true
CPUS["M680X0"] = true
CPUS["TMS9900"] = true
CPUS["COP400"] = true
CPUS["MIPS3"] = true
CPUS["ADSP21XX"] = true
CPUS["FR"] = true
--------------------------------------------------
-- Specify all the sound cores necessary for the
-- drivers referenced in ci.lst.
--------------------------------------------------
SOUNDS["SAMPLES"] = true
SOUNDS["DAC"] = true
SOUNDS["DISCRETE"] = true
SOUNDS["AY8910"] = true
SOUNDS["YM2151"] = true
SOUNDS["ASTROCADE"] = true
SOUNDS["TMS5220"] = true
SOUNDS["OKIM6295"] = true
SOUNDS["HC55516"] = true
SOUNDS["YM3812"] = true
SOUNDS["CEM3394"] = true
SOUNDS["VOTRAX"] = true
SOUNDS["DMADAC"] = true
SOUNDS["CDDA"] = true
SOUNDS["POKEY"] = true
--------------------------------------------------
-- specify available video cores
--------------------------------------------------
VIDEOS["PS2GIF"] = true
VIDEOS["PS2GS"] = true
--------------------------------------------------
-- specify available machine cores
--------------------------------------------------
MACHINES["6821PIA"] = true
MACHINES["ADC0808"] = true
MACHINES["TTL74148"] = true
MACHINES["TTL74153"] = true
MACHINES["TTL74157"] = true
MACHINES["TTL7474"] = true
MACHINES["TTL74259"] = true
MACHINES["RIOT6532"] = true
MACHINES["PIT8253"] = true
MACHINES["Z80CTC"] = true
MACHINES["Z80PIO"] = true
MACHINES["68681"] = true
MACHINES["BANKDEV"] = true
MACHINES["GEN_LATCH"] = true
MACHINES["INPUT_MERGER"] = true
MACHINES["OUTPUT_LATCH"] = true
MACHINES["TICKET"] = true
MACHINES["WATCHDOG"] = true
MACHINES["Z80DAISY"] = true
MACHINES["NETLIST"] = true
MACHINES["IDECTRL"] = true
MACHINES["PS2INTC"] = true
MACHINES["ER2055"] = true
--------------------------------------------------
-- specify available bus cores
--------------------------------------------------
BUSES["CENTRONICS"] = true
BUSES["ATA"] = true
--------------------------------------------------
-- This is the list of files that are necessary
-- for building all of the drivers referenced
-- in ci.lst
--------------------------------------------------
function createProjects_mame_ci(_target, _subtarget)
project ("mame_ci")
targetsubdir(_target .."_" .. _subtarget)
kind (LIBTYPE)
uuid (os.uuid("drv-mame-ci"))
addprojectflags()
precompiledheaders_novs()
includedirs {
MAME_DIR .. "src/osd",
MAME_DIR .. "src/emu",
MAME_DIR .. "src/devices",
MAME_DIR .. "src/mame/shared",
MAME_DIR .. "src/lib",
MAME_DIR .. "src/lib/util",
MAME_DIR .. "3rdparty",
GEN_DIR .. "mame/layout",
}
files{
MAME_DIR .. "src/mame/exidy/nl_carpolo.cpp",
MAME_DIR .. "src/mame/exidy/nl_carpolo.h",
MAME_DIR .. "src/mame/exidy/carpolo.cpp",
MAME_DIR .. "src/mame/exidy/carpolo.h",
MAME_DIR .. "src/mame/exidy/carpolo_m.cpp",
MAME_DIR .. "src/mame/exidy/carpolo_v.cpp",
MAME_DIR .. "src/mame/exidy/circus.cpp",
MAME_DIR .. "src/mame/exidy/circus.h",
MAME_DIR .. "src/mame/exidy/circus_a.cpp",
MAME_DIR .. "src/mame/exidy/circus_v.cpp",
MAME_DIR .. "src/mame/exidy/exidy.cpp",
MAME_DIR .. "src/mame/shared/exidysound.cpp",
MAME_DIR .. "src/mame/shared/exidysound.h",
MAME_DIR .. "src/mame/exidy/exidy440_a.cpp",
MAME_DIR .. "src/mame/exidy/exidy440_a.h",
MAME_DIR .. "src/mame/exidy/starfire.cpp",
MAME_DIR .. "src/mame/exidy/nl_fireone.cpp",
MAME_DIR .. "src/mame/exidy/nl_fireone.h",
MAME_DIR .. "src/mame/exidy/nl_starfire.cpp",
MAME_DIR .. "src/mame/exidy/nl_starfire.h",
MAME_DIR .. "src/mame/exidy/starfire.h",
MAME_DIR .. "src/mame/exidy/starfire_v.cpp",
MAME_DIR .. "src/mame/exidy/vertigo.cpp",
MAME_DIR .. "src/mame/exidy/vertigo.h",
MAME_DIR .. "src/mame/exidy/vertigo_m.cpp",
MAME_DIR .. "src/mame/exidy/vertigo_v.cpp",
MAME_DIR .. "src/mame/exidy/victory.cpp",
MAME_DIR .. "src/mame/exidy/victory.h",
MAME_DIR .. "src/mame/exidy/victory_v.cpp",
MAME_DIR .. "src/mame/midway/astrocde.cpp",
MAME_DIR .. "src/mame/midway/astrocde.h",
MAME_DIR .. "src/mame/midway/astrocde_v.cpp",
MAME_DIR .. "src/mame/midway/gridlee.cpp",
MAME_DIR .. "src/mame/midway/gridlee.h",
MAME_DIR .. "src/mame/midway/gridlee_a.cpp",
MAME_DIR .. "src/mame/midway/gridlee_v.cpp",
MAME_DIR .. "src/mame/midway/williams.cpp",
MAME_DIR .. "src/mame/midway/williams.h",
MAME_DIR .. "src/mame/midway/williams_m.cpp",
MAME_DIR .. "src/mame/shared/williamssound.cpp",
MAME_DIR .. "src/mame/shared/williamssound.h",
MAME_DIR .. "src/mame/midway/williams_v.cpp",
MAME_DIR .. "src/mame/shared/s11c_bg.cpp",
MAME_DIR .. "src/mame/shared/s11c_bg.h",
MAME_DIR .. "src/mame/gaelco/gaelco.cpp",
MAME_DIR .. "src/mame/gaelco/gaelco.h",
MAME_DIR .. "src/mame/gaelco/gaelco_v.cpp",
MAME_DIR .. "src/mame/gaelco/gaelcrpt.cpp",
MAME_DIR .. "src/mame/gaelco/wrally.cpp",
MAME_DIR .. "src/mame/gaelco/wrally.h",
MAME_DIR .. "src/mame/gaelco/wrally_v.cpp",
MAME_DIR .. "src/mame/gaelco/gaelco_wrally_sprites.cpp",
MAME_DIR .. "src/mame/gaelco/gaelco_wrally_sprites.h",
MAME_DIR .. "src/mame/gaelco/gaelco_ds5002fp.cpp",
MAME_DIR .. "src/mame/gaelco/gaelco_ds5002fp.h",
MAME_DIR .. "src/mame/venture/looping.cpp",
MAME_DIR .. "src/mame/misc/supertnk.cpp",
MAME_DIR .. "src/mame/rare/kinst.cpp",
MAME_DIR .. "src/mame/shared/dcs.cpp",
MAME_DIR .. "src/mame/shared/dcs.h",
MAME_DIR .. "src/mame/atari/akkaarrh.cpp",
}
end
function linkProjects_mame_ci(_target, _subtarget)
links {
"mame_ci",
}
end

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Prints unique source files for system drivers.
$ ./mamenld -listxml | xsltproc scripts/xslt/list-system-sources.xslt -
sega/segag80r.cpp
capcom/1942.cpp
midw8080/mw8080bw.cpp
sega/segas16b.cpp
sega/segas16a.cpp
atari/atarittl.cpp
cinemat/cinemat.cpp
exidy/exidyttl.cpp
misc/electra.cpp
irem/m62.cpp
misc/pse.cpp
ramtek/ramtek.cpp
misc/fungames.cpp
meadows/meadows.cpp
sega/vicdual.cpp
atari/pong.cpp
exidy/carpolo.cpp
univers/cheekyms.cpp
misc/cocoloco.cpp
sega/zaxxon.cpp
misc/crazybal.cpp
misc/chicago.cpp
sega/segag80v.cpp
exidy/starfire.cpp
taito/taitottl.cpp
atari/flyball.cpp
sega/segattl.cpp
misc/bailey.cpp
vtech/gamemachine.cpp
skeleton/hazeltin.cpp
sega/segas16b_isgsm.cpp
jpm/jpmsru.cpp
zaccaria/zaccaria.cpp
nintendo/mario.cpp
sega/monacogp.cpp
skeleton/palestra.cpp
nintendo/popeye.cpp
alliedl/aleisttl.cpp
misc/usbilliards.cpp
midway/sspeedr.cpp
ramtek/starcrus.cpp
skeleton/testpat.cpp
misc/a1supply.cpp
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes" indent="no" />
<xsl:key name="sourcekey" match="machine" use="@sourcefile" />
<xsl:template match="/">
<xsl:for-each select="*/machine[(@runnable = 'yes') and (generate-id() = generate-id(key('sourcekey', @sourcefile)))]">
<xsl:value-of select="concat(@sourcefile, '&#xA;')" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

17
src/mame/ci.flt Normal file
View File

@ -0,0 +1,17 @@
atari/akkaarrh.cpp
exidy/carpolo.cpp
exidy/circus.cpp
exidy/exidy.cpp
exidy/starfire.cpp
exidy/vertigo.cpp
exidy/victory.cpp
gaelco/gaelco.cpp
gaelco/gaelcrpt.cpp
gaelco/wrally.cpp
midway/astrocde.cpp
midway/gridlee.cpp
midway/williams.cpp
misc/goldnpkr.cpp
misc/supertnk.cpp
rare/kinst.cpp
venture/looping.cpp

View File

@ -1,43 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
/******************************************************************************
ci.lst
List of all enabled drivers in the system. This file is parsed by
makelist.exe, sorted, and output as C code describing the drivers.
******************************************************************************/
robby // (c) 1981 Bally Midway
gridlee // [1983 Videa] prototype - no copyright notice
alienar // (c) 1985 Duncan Brown
carpolo // (c) 1977 Exidy
sidetrac // (c) 1979 Exidy
targ // (c) 1980 Exidy
spectar // (c) 1980 Exidy
teetert // (c) 1982 Exidy
hardhat // (c) 1982
fax // (c) 1983
fax2 // (c) 1983
circus // (c) 1977 Exidy
robotbwl // (c) 197? Exidy
crash // (c) 1979 Exidy
ripcord // (c) 1979 Exidy
starfire // (c) 1979 Exidy
starfirea // (c) 1979 Exidy
fireone // (c) 1979 Exidy
starfir2 // (c) 1979 Exidy
victory // (c) 1982
victorba // (c) 1982
topgunnr // (c) 1986
looping // (c) 1982 Video Games GMBH
supertnk // (c) 1981 VIDEO GAMES GmbH, W.-GERMANY
wrally // (c) 1993 - Ref 930705
kinst // (c) 1994 Rare
akkaarrh // (c) 1982 Atari (prototype)