rgbds
rgbds copied to clipboard
Support `-P/--preinclude` to pre-INCLUDE a file
Fixes #1041
I would use -I constants.asm instead of INCLUDing that all the time when/if this is merged.
The main problem I have with this, is users trying to get into a codebase, not figuring out where all of these symbols are defined. Again, what's wrong with INCLUDE "constants.asm"?
Constants which should be in every single file should be there by default without the programmer having to remember them. Users not knowing where constants are defined is already a problem with -D or a master file in a unity build or exported constants (something you recommend). This just makes the experience a little less repetitive for the file or two which is needed everywhere. If it’s something someone doesn’t like because it might be confusing, they can simply not use the feature; the same applies to GCC’s -i.
There are pretty many possible sources of implicit behavior beyond what's in an .asm file that users have to learn about: -D values, the linkerscript, Makefile rules that either build all .asm files or only an explicit list, even the -h and -L transformations and the -p byte if they're wondering about the particular bytes in the ROM.
Following discussion with @ISSOtm , call this -P/--preinclude, only allow one such file, and support -i include paths but not -MG.
Made some changes to the docs locally to ensure they render correctly.