mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
use pokemontools scan_includes.py
It might look the same as before, but this new name is much better! Well done!
This commit is contained in:
parent
cad6f30f83
commit
34d579d9f9
2
Makefile
2
Makefile
@ -29,7 +29,7 @@ ROMS := pokecrystal.gbc
|
|||||||
ALL_DEPENDENCIES :=
|
ALL_DEPENDENCIES :=
|
||||||
# generate a list of dependencies for each object file
|
# generate a list of dependencies for each object file
|
||||||
$(shell $(foreach obj, $(OBJS), \
|
$(shell $(foreach obj, $(OBJS), \
|
||||||
$(eval $(obj:.o=)_DEPENDENCIES := $(shell $(PYTHON) scan_includes.py $(obj:.o=.asm) | sed s/globals.asm//g)) \
|
$(eval $(obj:.o=)_DEPENDENCIES := $(shell $(PYTHON) extras/pokemontools/scan_includes.py $(obj:.o=.asm) | sed s/globals.asm//g)) \
|
||||||
))
|
))
|
||||||
$(shell $(foreach obj, $(OBJS), \
|
$(shell $(foreach obj, $(OBJS), \
|
||||||
$(eval ALL_DEPENDENCIES += $($(obj:.o=)_DEPENDENCIES)) \
|
$(eval ALL_DEPENDENCIES += $($(obj:.o=)_DEPENDENCIES)) \
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
Recursively scan an asm file for rgbasm INCLUDEs and INCBINs.
|
|
||||||
Used to generate dependencies for each rgbasm object.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
def recursive_scan(filename, includes = []):
|
|
||||||
if (filename[-4:] == '.asm' or filename[-3] == '.tx') and os.path.exists(filename):
|
|
||||||
lines = open(filename).readlines()
|
|
||||||
for line in lines:
|
|
||||||
for directive in ('INCLUDE', 'INCBIN'):
|
|
||||||
if directive in line:
|
|
||||||
line = line[:line.find(';')]
|
|
||||||
if directive in line:
|
|
||||||
include = line.split('"')[1]
|
|
||||||
if include not in includes:
|
|
||||||
includes += [include]
|
|
||||||
includes = recursive_scan(include, includes)
|
|
||||||
break
|
|
||||||
return includes
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
filenames = sys.argv[1:]
|
|
||||||
for filename in filenames:
|
|
||||||
sys.stdout.write(' '.join(recursive_scan(filename)))
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user