2.3 Search Paths
Keywords: sdccman

#
2.3 Search Paths

Some search paths or parts of them are determined by configure variables (in italics, see section above). Further search paths are determined by environment variables during runtime.
The paths searched when running the compiler are as follows (the first catch wins):
1. Binary files (preprocessor, assembler and linker)

Search path | default | Win32 builds
$SDCC_HOME/$PPREFIX2BIN_DIR | $SDCC_HOME/bin | $SDCC_HOME\bin
Path of argv[0] (if available) | Path of argv[0] | Path of argv[0]
$PATH | $PATH | $PATH

2. Include files

# | Search path | default | Win32 builds
1 | —I dir | —I dir | —I dir
2 | $SDCC_INCLUDE | $SDCC_INCLUDE | $SDCC_INCLUDE
3 | $SDCC_HOME/ $PREFIX2DATA_DIR/ $INCLUDE_DIR_SUFFIX | $SDCC_HOME/ share/sdcc/include | $SDCC_HOME\include
4 | path(argv[0])/ $BIN2DATADIR/ $INCLUDE_DIR_SUFFIX | path(argv[0])/../ sdcc/include | path(argv[0])\..\include
5 | $DATADIR/ $INCLUDE_DIR_SUFFIX | /usr/local/share/ sdcc/include | (not on Win32)
6 | $SDCC_HOME/ $PREFIX2DATA_DIR/ non-free/ $INCLUDE_DIR_SUFFIX | $SDCC_HOME/share/ sdcc/non-free/include | $SDCC_HOME\non-free\include
7 | path(argv[0])/ $BIN2DATADIR/ non-free/ $INCLUDE_DIR_SUFFIX | path(argv[0])/../ sdcc/non-free/include | path(argv[0])\..\non-free\include
8 | $DATADIR/ non-free/ $INCLUDE_DIR_SUFFIX | /usr/local/share/ sdcc/non-free/include | (not on Win32)

The option —nostdinc disables all search paths except #1 and #2.
3. Library files

With the exception of ”—L dir” the model is auto-appended by the compiler (e.g. small, large, z80, ds390 etc.).

# | Search path | default | Win32 builds
1 | —L dir | —L dir | —L dir
2 | $SDCC_LIB/<model> | $SDCC_LIB/<model> | $SDCC_LIB/<model>
3 | $SDCC_LIB | $SDCC_LIB | $SDCC_LIB
4 | $SDCC_HOME/ $PREFIX2DATA_DIR/ $LIB_DIR_SUFFIX/ <model> | $SDCC_HOME/ share/sdcc/lib/<model> | $SDCC_HOME\ lib\<model>
5 | path(argv[0])/ $BIN2DATADIR/ $LIB_DIR_SUFFIX/ <model> | path(argv[0])/../sdcc/ lib/<model> | path(argv[0])\ ..\lib\ <model>
6 | $DATADIR/non-free/ $LIB_DIR_SUFFIX/ <model> | /usr/local/share/sdcc/ lib/<model> | (not on Win32)
7 | $SDCC_HOME/ $PREFIX2DATA_DIR/ non-free/ $LIB_DIR_SUFFIX/ <model> | $SDCC_HOME/share/sdcc/ non-free/lib/<model> | $SDCC_HOME\ lib\non-free\<model>
8 | path(argv[0])/ $BIN2DATADIR/ non-free/ $LIB_DIR_SUFFIX/ <model> | path(argv[0])/../sdcc/ non-free/lib/<model> | path(argv[0])\..\ lib\non-free\<model>
9 | $DATADIR/non-free/ $LIB_DIR_SUFFIX/ <model> | /usr/local/share/sdcc/ non-free/lib/ <model> | (not on Win32)

The option —nostdlib disables all search paths except #1 and #2.