We use scan_includes to recursively list dependencies for our .asm files. Historically this has been because rgbasm -M was (a) slow and (b) did not usefully handle dependecies which did not yet exist (e.g. INCBIN "not-yet-generated.2bpp").
However, scan_includes has its own problems. It does not handle \ line continuations, """multi-line strings""", or /* block comments /*. It does not handle READFILE dependencies. It also does not handle indirect dependencies that depend on macro or interpolation expansion (e.g. INCLUDE "file{d:num}.asm", or tileset Foo, foo where MACRO tileset does \1GFX:: INCBIN "gfx/tilesets/\2.2bpp").
RGBDS 0.9.4 introduced the -MC flag, which handles not-yet-existing dependencies the way we'd want. So I think it's worth testing again to see how well it performs. Even if scan_includes is still worth keeping for performance reasons, it could do moderately more complex parsing of the .asm to handle more syntax.
Some test cases:
; These are NOT dependencies
db """multi-line
INCBIN "no"
strings"""
/* block
INCBIN "no"
comments */
invoke_macro arg, \
INCBIN "no", \
arg
invoke_macro INCBIN "no"
; These ARE dependencies
def s equs READFILE("yes")
We use
scan_includesto recursively list dependencies for our .asm files. Historically this has been becausergbasm -Mwas (a) slow and (b) did not usefully handle dependecies which did not yet exist (e.g.INCBIN "not-yet-generated.2bpp").However,
scan_includeshas its own problems. It does not handle\line continuations,"""multi-line strings""", or/* block comments /*. It does not handleREADFILEdependencies. It also does not handle indirect dependencies that depend on macro or interpolation expansion (e.g.INCLUDE "file{d:num}.asm", ortileset Foo, foowhereMACRO tilesetdoes\1GFX:: INCBIN "gfx/tilesets/\2.2bpp").RGBDS 0.9.4 introduced the
-MCflag, which handles not-yet-existing dependencies the way we'd want. So I think it's worth testing again to see how well it performs. Even ifscan_includesis still worth keeping for performance reasons, it could do moderately more complex parsing of the .asm to handle more syntax.Some test cases: