larsbrinkhoff / lbForth

Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
GNU General Public License v3.0
414 stars 113 forks source link

include target.fth #90

Closed Phi-Ho closed 3 years ago

Phi-Ho commented 3 years ago

Hi,

'target.fth' is included in two different places:

src\compile.fth(36): include target.fth src\kernel.fth(109): include target.fth

and 'target.fth' exists in 3 relevant places:

. (build root) ./target/x86 ./target/x86/windows

Please advise which of these three would be included in 'src\compile.fth' and 'src\kernel.fth'

I also have two other related questions:

1/- What is the difference between "include" and "require"? 2/- How does "searched" work?

Regards, phiho

larsbrinkhoff commented 3 years ago

target.fth is a target-specific file. Different versions exists for all supported targets. The file that is included is in the build root, and it's a concatenation of targets/x86/target.fth and targets/x86/windows/targets.fth when you buid for TARGET=x86 OS=windows.

include always reads a file, but require doesn't if the file has been read previously.

searched takes a string and adds it to the file search path list. include etc tries all search paths in the list to find a file.