Let's say I'm creating an application package with some scripts, maybe a daemon or even an auxiliary binary ... When compiling such a binary ... maybe. / configure / make it only with relative path? For example, a more conscientious Makefile will include provisions such as ...
--bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/hiawatha] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR]
This is great, you can install everything on /opt/local instead of /usr/local . Maybe even go crazy and rename the binaries via sed .. I get this.
But what remains incomprehensible in my tiny brain, if the ability to arbitrarily set paths in this way expands the possibilities of comparing directories with respect to the executable , similarly ...
--prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --prefix=./ aka [../relative/to/binary]
So, for example, no matter where you started bin , he always knew that the .conf file would be in the same folder, in this relative ../etc folder ../etc or perhaps even right next to it, in the same directory, ./ . Similarly, you can guarantee write access to log files and pid files, etc., without wondering about your permissions / directories structure ...
This would allow the directory structure of /bin /etc /lib /var to be completely transferred within the PATH, to which I can guarantee some semblance of predictability ... but I donโt think it just โworksโ. And I'm not sure, just โlink staticallyโ or otherwise? really creates binaries that can be moved to another system (although for this scenario, those that have the same supporting libraries in the same places so as not to confuse the problem) Is cross-compilation possible in this way? And can you build for multiple architectures in the same build cycle? (E.g. i386 and x86_64 at the same time)
Perhaps I could use the recommendation of a good GNU / GCC primer (CC, CFLAGS, LDFLAGS, -l, -I and CPP 101, etc.), but this was not written for (and by) Math teacher - at 70 years?