History

Revert "tcc.h: Extend search path for include, lib and crt"

This reverts commit 2507c7170443cf4cced4d2cda8ba3c8cc259adb1. 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

grischka committed 4 years ago

Commit e5eedc01 parent e41730f3 files · +19 −36Browse files

Unified · Split

3 files
  1. Makefile +18 −2
  2. config-extra.mak.example +0 −27
  3. tcc.h +1 −7
Makefile+18−2
@@ -171,6 +171,7 @@ DEFINES += $(if $(ROOT-$T),-DCONFIG_SYSROOT="\"$(ROOT-$T)\"") · 170 unmodified lines
171DEFINES += $(if $(CRT-$T),-DCONFIG_TCC_CRTPREFIX="\"$(CRT-$T)\"")171DEFINES += $(if $(CRT-$T),-DCONFIG_TCC_CRTPREFIX="\"$(CRT-$T)\"")
172DEFINES += $(if $(LIB-$T),-DCONFIG_TCC_LIBPATHS="\"$(LIB-$T)\"")172DEFINES += $(if $(LIB-$T),-DCONFIG_TCC_LIBPATHS="\"$(LIB-$T)\"")
173DEFINES += $(if $(INC-$T),-DCONFIG_TCC_SYSINCLUDEPATHS="\"$(INC-$T)\"")173DEFINES += $(if $(INC-$T),-DCONFIG_TCC_SYSINCLUDEPATHS="\"$(INC-$T)\"")
174DEFINES += $(if $(ELF-$T),-DCONFIG_TCC_ELFINTERP="\"$(ELF-$T)\"")
174DEFINES += $(DEF-$(or $(findstring win,$T),unx))175DEFINES += $(DEF-$(or $(findstring win,$T),unx))
175 176
176ifneq ($(X),)177ifneq ($(X),)
@@ -186,6 +187,19 @@ endif · 9 unmodified lines
186# include custom configuration (see make help)187# include custom configuration (see make help)
187-include config-extra.mak188-include config-extra.mak
188 189
190ifneq ($(X),)
191# assume support files for cross-targets in "/usr/<triplet>" by default
192TRIPLET-i386 ?= i386-linux-gnu
193TRIPLET-x86_64 ?= x86_64-linux-gnu
194TRIPLET-arm ?= arm-linux-gnueabihf
195TRIPLET-arm64 ?= aarch64-linux-gnu
196TRIPLET-riscv64 ?= riscv64-linux-gnu
197TR = $(if $(TRIPLET-$T),$T,ignored)
198CRT-$(TR) ?= /usr/$(TRIPLET-$T)/lib
199LIB-$(TR) ?= {B}:/usr/$(TRIPLET-$T)/lib
200INC-$(TR) ?= {B}/include:/usr/$(TRIPLET-$T)/include
201endif
202
189CORE_FILES = tcc.c tcctools.c libtcc.c tccpp.c tccgen.c tccdbg.c tccelf.c tccasm.c tccrun.c203CORE_FILES = tcc.c tcctools.c libtcc.c tccpp.c tccgen.c tccdbg.c tccelf.c tccasm.c tccrun.c
190CORE_FILES += tcc.h config.h libtcc.h tcctok.h204CORE_FILES += tcc.h config.h libtcc.h tcctok.h
191i386_FILES = $(CORE_FILES) i386-gen.c i386-link.c i386-asm.c i386-asm.h i386-tok.h205i386_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)) · 147 unmodified lines
339STRIP_yes = -s353STRIP_yes = -s
340 354
341LIBTCC1_W = $(filter %-win32-libtcc1.a %-wince-libtcc1.a,$(LIBTCC1_CROSS))355LIBTCC1_W = $(filter %-win32-libtcc1.a %-wince-libtcc1.a,$(LIBTCC1_CROSS))
342LIBTCC1_U = $(filter-out $(LIBTCC1_W),$(LIBTCC1_CROSS))356LIBTCC1_U = $(filter-out $(LIBTCC1_W),$(wildcard *-libtcc1.a))
343IB = $(if $1,$(IM) mkdir -p $2 && $(INSTALLBIN) $1 $2)357IB = $(if $1,$(IM) mkdir -p $2 && $(INSTALLBIN) $1 $2)
344IBw = $(call IB,$(wildcard $1),$2)358IBw = $(call IB,$(wildcard $1),$2)
345IF = $(if $1,$(IM) mkdir -p $2 && $(INSTALL) $1 $2)359IF = $(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 · 5 unmodified lines
351 365
352# install progs & libs366# install progs & libs
353install-unx:367install-unx:
354 $(call IBw,$(PROGS) $(PROGS_CROSS),"$(bindir)")368 $(call IBw,$(PROGS) *-tcc,"$(bindir)")
355 $(call IFw,$(LIBTCC1) $(B_O) $(LIBTCC1_U),"$(tccdir)")369 $(call IFw,$(LIBTCC1) $(B_O) $(LIBTCC1_U),"$(tccdir)")
356 $(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/include")370 $(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/include")
357 $(call $(if $(findstring .so,$(LIBTCC)),IBw,IFw),$(LIBTCC),"$(libdir)")371 $(call $(if $(findstring .so,$(LIBTCC)),IBw,IFw),$(LIBTCC),"$(libdir)")
@@ -487,6 +501,8 @@ help: · 129 unmodified lines
487 @echo " LIB-i386 = {B}/i386-linux/lib:{B}/i386-linux/usr/lib"501 @echo " LIB-i386 = {B}/i386-linux/lib:{B}/i386-linux/usr/lib"
488 @echo " INC-i386 = {B}/lib/include:{B}/i386-linux/usr/include"502 @echo " INC-i386 = {B}/lib/include:{B}/i386-linux/usr/include"
489 @echo " DEF-i386 += -D__linux__"503 @echo " DEF-i386 += -D__linux__"
504 @echo " Or to configure a cross compiler for system-files in /usr/<triplet>"
505 @echo " TRIPLET-arm-eabi = arm-linux-gnueabi"
490 506
491# --------------------------------------------------------------------------507# --------------------------------------------------------------------------
492endif # ($(INCLUDED),no)508endif # ($(INCLUDED),no)
config-extra.mak.example+0−27
@@ -1,27 +0,0 @@
1#
2# during 'make', this file is included from the tcc Makefile
3#
4# this is an example, how to help tcc to find
5# the c library and the startup files for cross compiling.
6#
7# we expect here, that the GNU libc is used and that the related development files
8# are installed in a subdirectory with the target triplet used by gcc
9#
10
11# set CONFIG_TRIPLET for cross compiler targets
12DEF-i386+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"i386-linux-gnu\" "
13DEF-x86_64+=-UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-linux-gnu\" "
14
15# many api/fp combinations are possible for arm
16DEF-arm+=-UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"arm-linux-gnueabihf\" "
17DEF-arm64+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"aarch64-linux-gnu\" "
18
19DEF-riscv64+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"riscv64-linux-gnu\" "
20# For win32/win64 targets, we expect mingw 64
21# is is for additional packes, as tcc has ist own win32 startfiles
22DEF-i386-win32+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"i686-w64-mingw32\" "
23DEF-x86_64-win32+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-w64-mingw32\" "
24
25# is a free cross compile toolchain for macos available?
26#DEF-x86_64-osx+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"x86_64-apple-darwin\" "
27#DEF-arm64-osx+= -UCONFIG_TRIPLET -DCONFIG_TRIPLET="\"aarch64-apple-darwin\" "
tcc.h+1−7
@@ -260,9 +260,7 @@ extern long double strtold (const char *__nptr, char **__endptr); · 259 unmodified lines
260 260
261/* path to find crt1.o, crti.o and crtn.o */261/* path to find crt1.o, crti.o and crtn.o */
262#ifndef CONFIG_TCC_CRTPREFIX262#ifndef CONFIG_TCC_CRTPREFIX
263# define CONFIG_TCC_CRTPREFIX \263# define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR)
264 ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \
265 ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/lib"
266#endif264#endif
267 265
268#ifndef CONFIG_USR_INCLUDE266#ifndef CONFIG_USR_INCLUDE
@@ -279,8 +277,6 @@ extern long double strtold (const char *__nptr, char **__endptr); · 10 unmodified lines
279# define CONFIG_TCC_SYSINCLUDEPATHS \277# define CONFIG_TCC_SYSINCLUDEPATHS \
280 "{B}/include" \278 "{B}/include" \
281 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \279 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \
282 ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/include" \
283 ":" USE_TRIPLET(CONFIG_SYSROOT "/usr/local") "/include" \
284 ":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE)280 ":" ALSO_TRIPLET(CONFIG_SYSROOT CONFIG_USR_INCLUDE)
285# endif281# endif
286#endif282#endif
@@ -293,8 +289,6 @@ extern long double strtold (const char *__nptr, char **__endptr); · 6 unmodified lines
293# define CONFIG_TCC_LIBPATHS \289# define CONFIG_TCC_LIBPATHS \
294 "{B}" \290 "{B}" \
295 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \291 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \
296 ":" USE_TRIPLET(CONFIG_SYSROOT "/usr") "/lib" \
297 ":" USE_TRIPLET(CONFIG_SYSROOT "/usr/local") "/lib" \
298 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) \292 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) \
299 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/" CONFIG_LDDIR)293 ":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/" CONFIG_LDDIR)
300# endif294# endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t