rgbds icon indicating copy to clipboard operation
rgbds copied to clipboard

Support `-P/--preinclude` to pre-INCLUDE a file

Open Rangi42 opened this issue 2 years ago • 5 comments

Fixes #1041

Rangi42 avatar Sep 01 '22 23:09 Rangi42

I would use -I constants.asm instead of INCLUDing that all the time when/if this is merged.

Rangi42 avatar Sep 02 '22 00:09 Rangi42

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"?

ISSOtm avatar Sep 02 '22 06:09 ISSOtm

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.

evie-calico avatar Sep 02 '22 10:09 evie-calico

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.

Rangi42 avatar Sep 02 '22 13:09 Rangi42

Following discussion with @ISSOtm , call this -P/--preinclude, only allow one such file, and support -i include paths but not -MG.

Rangi42 avatar Sep 08 '22 21:09 Rangi42

Made some changes to the docs locally to ensure they render correctly.

ISSOtm avatar Sep 24 '22 10:09 ISSOtm