Revert "tcc.h: Extend search path for include, lib and crt"
This reverts commit 2507c71704
.
Why crowd up search-paths for the normal native compiler with
all sort of invalid stuff. Why -UCONFIG_TRIPLET if it isn't
set at all for cross-compilers. Also, the patch still didn't
do anything useful "out of the box".
Instead I'd suggest to do something more simple and more effective.
See Makefile:
- set search paths for cross-compilers to /usr/<triplet> by default
- Install any built "xxx-tcc" and "xxx-libtcc1.a", even if not listed
with PROGS_CROSS/LIBTCC1_CROSS
- Support ELF-<target> = ... to set the elf interpreter
Some common gnu-triplets are supported by default
TRIPLET-i386 ?= i386-linux-gnu
TRIPLET-x86_64 ?= x86_64-linux-gnu
TRIPLET-arm ?= arm-linux-gnueabihf
TRIPLET-arm64 ?= aarch64-linux-gnu
TRIPLET-riscv64 ?= riscv64-linux-gnu
Other triplets can be given explicitly, for example like this:
$ make cross-arm-eabi TRIPLET-arm-eabi=arm-linux-gnueabi
$ sudo make install
This commit is contained in:
parent
e41730f11a
commit
e5eedc0cda
3 changed files with 19 additions and 36 deletions
20
Makefile
20
Makefile
|
@ -171,6 +171,7 @@ DEFINES += $(if $(ROOT-$T),-DCONFIG_SYSROOT="\"$(ROOT-$T)\"")
|
|||
DEFINES += $(if $(CRT-$T),-DCONFIG_TCC_CRTPREFIX="\"$(CRT-$T)\"")
|
||||
DEFINES += $(if $(LIB-$T),-DCONFIG_TCC_LIBPATHS="\"$(LIB-$T)\"")
|
||||
DEFINES += $(if $(INC-$T),-DCONFIG_TCC_SYSINCLUDEPATHS="\"$(INC-$T)\"")
|
||||
DEFINES += $(if $(ELF-$T),-DCONFIG_TCC_ELFINTERP="\"$(ELF-$T)\"")
|
||||
DEFINES += $(DEF-$(or $(findstring win,$T),unx))
|
||||
|
||||
ifneq ($(X),)
|
||||
|
@ -186,6 +187,19 @@ endif
|
|||
# include custom configuration (see make help)
|
||||
-include config-extra.mak
|
||||
|
||||
ifneq ($(X),)
|
||||
# assume support files for cross-targets in "/usr/<triplet>" by default
|
||||
TRIPLET-i386 ?= i386-linux-gnu
|
||||
TRIPLET-x86_64 ?= x86_64-linux-gnu
|
||||
TRIPLET-arm ?= arm-linux-gnueabihf
|
||||
TRIPLET-arm64 ?= aarch64-linux-gnu
|
||||
TRIPLET-riscv64 ?= riscv64-linux-gnu
|
||||
TR = $(if $(TRIPLET-$T),$T,ignored)
|
||||
CRT-$(TR) ?= /usr/$(TRIPLET-$T)/lib
|
||||
LIB-$(TR) ?= {B}:/usr/$(TRIPLET-$T)/lib
|
||||
INC-$(TR) ?= {B}/include:/usr/$(TRIPLET-$T)/include
|
||||
endif
|
||||
|
||||
CORE_FILES = tcc.c tcctools.c libtcc.c tccpp.c tccgen.c tccdbg.c tccelf.c tccasm.c tccrun.c
|
||||
CORE_FILES += tcc.h config.h libtcc.h tcctok.h
|
||||
i386_FILES = $(CORE_FILES) i386-gen.c i386-link.c i386-asm.c i386-asm.h i386-tok.h
|
||||
|
@ -339,7 +353,7 @@ INSTALLBIN = install -m755 $(STRIP_$(CONFIG_strip))
|
|||
STRIP_yes = -s
|
||||
|
||||
LIBTCC1_W = $(filter %-win32-libtcc1.a %-wince-libtcc1.a,$(LIBTCC1_CROSS))
|
||||
LIBTCC1_U = $(filter-out $(LIBTCC1_W),$(LIBTCC1_CROSS))
|
||||
LIBTCC1_U = $(filter-out $(LIBTCC1_W),$(wildcard *-libtcc1.a))
|
||||
IB = $(if $1,$(IM) mkdir -p $2 && $(INSTALLBIN) $1 $2)
|
||||
IBw = $(call IB,$(wildcard $1),$2)
|
||||
IF = $(if $1,$(IM) mkdir -p $2 && $(INSTALL) $1 $2)
|
||||
|
@ -351,7 +365,7 @@ B_O = bcheck.o bt-exe.o bt-log.o bt-dll.o
|
|||
|
||||
# install progs & libs
|
||||
install-unx:
|
||||
$(call IBw,$(PROGS) $(PROGS_CROSS),"$(bindir)")
|
||||
$(call IBw,$(PROGS) *-tcc,"$(bindir)")
|
||||
$(call IFw,$(LIBTCC1) $(B_O) $(LIBTCC1_U),"$(tccdir)")
|
||||
$(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/include")
|
||||
$(call $(if $(findstring .so,$(LIBTCC)),IBw,IFw),$(LIBTCC),"$(libdir)")
|
||||
|
@ -487,6 +501,8 @@ help:
|
|||
@echo " LIB-i386 = {B}/i386-linux/lib:{B}/i386-linux/usr/lib"
|
||||
@echo " INC-i386 = {B}/lib/include:{B}/i386-linux/usr/include"
|
||||
@echo " DEF-i386 += -D__linux__"
|
||||
@echo " Or to configure a cross compiler for system-files in /usr/<triplet>"
|
||||
@echo " TRIPLET-arm-eabi = arm-linux-gnueabi"
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
endif # ($(INCLUDED),no)
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
#
|
||||
# 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\" "
|
8
tcc.h
8
tcc.h
|
@ -260,9 +260,7 @@ 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 \
|
||||
ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \
|
||||
":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/lib"
|
||||
# define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_USR_INCLUDE
|
||||
|
@ -279,8 +277,6 @@ 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
|
||||
|
@ -293,8 +289,6 @@ 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
|
||||
|
|
Loading…
Add table
Reference in a new issue