diff --git a/config-extra.mak.example b/config-extra.mak.example new file mode 100644 index 00000000..567ab470 --- /dev/null +++ b/config-extra.mak.example @@ -0,0 +1,27 @@ +# +# during 'make', this file is included from the tcc Makefile +# +# this is an example, how to help tcc to find +# the c library and the startup files for cross compiling. +# +# we expect here, that the GNU libc is used and that the related development files +# are installed in a subdirectory with the target triplet used by gcc +# + +# set CONFIG_TRIPLET for cross compiler targets +DEF-i386+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"i386-linux-gnu\" " +DEF-x86_64+=-UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-linux-gnu\" " + +# many api/fp combinations are possible for arm +DEF-arm+=-UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"arm-linux-gnueabihf\" " +DEF-arm64+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"aarch64-linux-gnu\" " + +DEF-riscv64+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"riscv64-linux-gnu\" " +# For win32/win64 targets, we expect mingw 64 +# is is for additional packes, as tcc has ist own win32 startfiles +DEF-i386-win32+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"i686-w64-mingw32\" " +DEF-x86_64-win32+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-w64-mingw32\" " + +# is a free cross compile toolchain for macos available? +#DEF-x86_64-osx+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-apple-darwin\" " +#DEF-arm64-osx+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"aarch64-apple-darwin\" " diff --git a/tcc.h b/tcc.h index 0c7208f7..a589ad3c 100644 --- a/tcc.h +++ b/tcc.h @@ -260,7 +260,9 @@ extern long double strtold (const char *__nptr, char **__endptr); /* path to find crt1.o, crti.o and crtn.o */ #ifndef CONFIG_TCC_CRTPREFIX -# define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) +# define CONFIG_TCC_CRTPREFIX \ + ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \ + ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/lib" #endif #ifndef CONFIG_USR_INCLUDE @@ -277,6 +279,8 @@ extern long double strtold (const char *__nptr, char **__endptr); # define CONFIG_TCC_SYSINCLUDEPATHS \ "{B}/include" \ ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \ + ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/include" \ + ":" USE_TRIPLET(CONFIG_SYSROOT "/usr/local") "/include" \ ":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE) # endif #endif @@ -289,6 +293,8 @@ extern long double strtold (const char *__nptr, char **__endptr); # define CONFIG_TCC_LIBPATHS \ "{B}" \ ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \ + ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/lib" \ + ":" USE_TRIPLET(CONFIG_SYSROOT "/usr/local") "/lib" \ ":" ALSO_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) \ ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/" CONFIG_LDDIR) # endif