summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/build/makelist.py
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-03-02 12:48:46 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2016-03-02 12:49:37 +0100
commit8a84dd2232711cc9c3b89b3f8cb28fb9139bdd00 (patch)
tree6c36e1b59c1515524a9e0792ff87b1608f2d0fa1 /scripts/build/makelist.py
parentf15313bc070231f7fe13b2b63bf3d0ae55793171 (diff)
Added mame.lst as main list, it is now generated, and should be updated manually (nw)
Filtering for subtargets are done by flt files now
Diffstat (limited to 'scripts/build/makelist.py')
-rw-r--r--scripts/build/makelist.py64
1 files changed, 61 insertions, 3 deletions
diff --git a/scripts/build/makelist.py b/scripts/build/makelist.py
index 144dc636c8d..7783ee64d4d 100644
--- a/scripts/build/makelist.py
+++ b/scripts/build/makelist.py
@@ -8,6 +8,7 @@ from __future__ import with_statement
import sys
drivlist = []
+sourcelist = []
def parse_file(srcfile):
try:
@@ -17,6 +18,7 @@ def parse_file(srcfile):
return 1
in_comment = 0
linenum = 0
+ curr_source = ''
for line in fp.readlines():
drivname = ''
linenum+=1
@@ -49,19 +51,75 @@ def parse_file(srcfile):
sys.stderr.write("Importing drivers from '%s'\n" % drivname[1:])
parse_file(drivname[1:])
continue
+ if drivname[0]=='@':
+ curr_source= drivname[8:]
+ continue
if not all(((c >='a' and c<='z') or (c>='0' and c<='9') or c=='_') for c in drivname):
sys.stderr.write("%s:%d - Invalid character in driver \"%s\"\n" % (srcfile, linenum, drivname))
return 1
else:
- drivlist.append(drivname)
+ if (curr_source == '') or (len(sourcelist)==0) or (curr_source in sourcelist):
+ drivlist.append(drivname)
return 0
+def parse_filter_file(srcfile):
+ try:
+ fp = open(srcfile, 'rt')
+ except IOError:
+ sys.stderr.write("Unable to open filter file '%s'\n" % srcfile)
+ return 1
+ in_comment = 0
+ linenum = 0
+ for line in fp.readlines():
+ sourcename = ''
+ linenum+=1
+ srcptr = 0
+ while srcptr < len(line):
+ c = line[srcptr]
+ srcptr+=1
+ if c==13 or c==10:
+ if c==13 and line[srcptr]==10:
+ srcptr+=1
+ continue
+ if c==' ' or 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
+ sourcename += c
+ sourcename = sourcename.strip()
+ if len(sourcename)>0:
+ if sourcename[0]=='#':
+ sys.stderr.write("Importing drivers from '%s'\n" % sourcename[1:])
+ parse_filter_file(sourcename[1:])
+ continue
+ if not all(((c >='a' and c<='z') or (c>='0' and c<='9') or c=='_' or c=='.' or c=='-') for c in sourcename):
+ sys.stderr.write("%s:%d - Invalid character in driver \"%s\"\n" % (srcfile, linenum, sourcename))
+ return 1
+ else:
+ sourcelist.append(sourcename)
+ return 0
-if len(sys.argv) < 2:
+
+if len(sys.argv) < 2 or len(sys.argv) > 3:
print('Usage:')
- print(' makelist <source.lst>')
+ print(' makelist <source.lst> [<filter.flt>]')
sys.exit(0)
+if len(sys.argv) == 3:
+ if parse_filter_file(sys.argv[2]) :
+ sys.exit(1)
+ sys.stderr.write("%d sources found\n" % len(sourcelist))
+
if parse_file(sys.argv[1]) :
sys.exit(1)