mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-26 03:50:07 +08:00
configure: --triplet= option, Makefile: cleanup
This commit is contained in:
parent
0be098929a
commit
02919cd275
66
Makefile
66
Makefile
@ -90,17 +90,17 @@ ARM64_FILES = $(CORE_FILES) arm64-gen.c
|
||||
C67_FILES = $(CORE_FILES) c67-gen.c tcccoff.c
|
||||
|
||||
ifdef CONFIG_WIN32
|
||||
PROGS+=tiny_impdef$(EXESUF) tiny_libmaker$(EXESUF)
|
||||
ifeq ($(ARCH),x86-64)
|
||||
NATIVE_FILES=$(WIN64_FILES)
|
||||
PROGS_CROSS=$(WIN32_CROSS)
|
||||
LIBTCC1_CROSS=lib/i386-win32/libtcc1.a
|
||||
else
|
||||
NATIVE_FILES=$(WIN32_FILES)
|
||||
PROGS_CROSS=$(WIN64_CROSS)
|
||||
LIBTCC1_CROSS=lib/x86_64-win32/libtcc1.a
|
||||
endif
|
||||
PROGS_CROSS+=$(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
||||
PROGS+=tiny_impdef$(EXESUF) tiny_libmaker$(EXESUF) $(LIBTCC)
|
||||
ifeq ($(ARCH),x86-64)
|
||||
NATIVE_FILES=$(WIN64_FILES)
|
||||
PROGS_CROSS=$(WIN32_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
||||
LIBTCC1_CROSS=lib/i386-win32/libtcc1.a
|
||||
else
|
||||
NATIVE_FILES=$(WIN32_FILES)
|
||||
PROGS_CROSS=$(WIN64_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
||||
LIBTCC1_CROSS=lib/x86_64-win32/libtcc1.a
|
||||
endif
|
||||
|
||||
else ifeq ($(ARCH),i386)
|
||||
NATIVE_FILES=$(I386_FILES)
|
||||
PROGS_CROSS=$(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
|
||||
@ -217,39 +217,32 @@ lib/%/libtcc1.a : FORCE $(PROGS_CROSS)
|
||||
FORCE:
|
||||
|
||||
# install
|
||||
TCC_INCLUDES = stdarg.h stddef.h stdbool.h float.h varargs.h
|
||||
INSTALL=install
|
||||
|
||||
ifdef STRIP_BINARIES
|
||||
INSTALLBIN=$(INSTALL) -s
|
||||
else
|
||||
INSTALLBIN=$(INSTALL)
|
||||
endif
|
||||
INSTALL = install
|
||||
INSTALLBIN = install $(STRIP_$(STRIP_BINARIES))
|
||||
STRIP_yes = -s
|
||||
|
||||
install-strip: install
|
||||
$(STRIP) $(foreach PROG,$(PROGS),"$(bindir)"/$(PROG))
|
||||
ifdef CONFIG_WIN32
|
||||
$(STRIP) "$(bindir)/$(LIBTCC)"
|
||||
endif
|
||||
install-strip: STRIP_BINARIES = yes
|
||||
|
||||
ifndef CONFIG_WIN32
|
||||
install: $(PROGS) $(TCCLIBS) $(TCCDOCS)
|
||||
install:
|
||||
mkdir -p "$(bindir)"
|
||||
$(INSTALLBIN) -m755 $(PROGS) "$(bindir)"
|
||||
mkdir -p "$(mandir)/man1"
|
||||
-$(INSTALL) -m644 tcc.1 "$(mandir)/man1"
|
||||
mkdir -p "$(infodir)"
|
||||
-$(INSTALL) -m644 tcc-doc.info "$(infodir)"
|
||||
mkdir -p "$(tccdir)"
|
||||
mkdir -p "$(tccdir)/include"
|
||||
ifneq ($(LIBTCC1),)
|
||||
$(INSTALL) -m644 $(LIBTCC1) "$(tccdir)"
|
||||
endif
|
||||
$(INSTALL) -m644 $(addprefix $(TOPSRC)/include/,$(TCC_INCLUDES)) $(TOPSRC)/tcclib.h "$(tccdir)/include"
|
||||
mkdir -p "$(tccdir)/include"
|
||||
$(INSTALL) -m644 $(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h "$(tccdir)/include"
|
||||
mkdir -p "$(libdir)"
|
||||
$(INSTALL) -m644 $(LIBTCC) "$(libdir)"
|
||||
mkdir -p "$(includedir)"
|
||||
$(INSTALL) -m644 $(TOPSRC)/libtcc.h "$(includedir)"
|
||||
|
||||
mkdir -p "$(mandir)/man1"
|
||||
-$(INSTALL) -m644 tcc.1 "$(mandir)/man1"
|
||||
mkdir -p "$(infodir)"
|
||||
-$(INSTALL) -m644 tcc-doc.info "$(infodir)"
|
||||
mkdir -p "$(docdir)"
|
||||
-$(INSTALL) -m644 tcc-doc.html "$(docdir)"
|
||||
ifdef CONFIG_CROSS
|
||||
@ -264,28 +257,25 @@ endif
|
||||
|
||||
uninstall:
|
||||
rm -fv $(foreach P,$(PROGS),"$(bindir)/$P")
|
||||
rm -fv $(foreach P,$(LIBTCC1),"$(tccdir)/$P")
|
||||
rm -fv $(foreach P,$(TCC_INCLUDES),"$(tccdir)/include/$P")
|
||||
rm -fv "$(mandir)/man1/tcc.1" "$(infodir)/tcc-doc.info"
|
||||
rm -fv "$(libdir)/$(LIBTCC)" "$(includedir)/libtcc.h"
|
||||
rm -fv $(libdir)/libtcc.so*
|
||||
rm -rv "$(tccdir)"
|
||||
rm -fv "$(mandir)/man1/tcc.1" "$(infodir)/tcc-doc.info"
|
||||
rm -fv "$(docdir)/tcc-doc.html"
|
||||
rm -rv "$(tccdir)"
|
||||
else
|
||||
# on windows
|
||||
install: $(PROGS) $(TCCLIBS) $(TCCDOCS)
|
||||
install:
|
||||
mkdir -p "$(tccdir)"
|
||||
mkdir -p "$(tccdir)/lib"
|
||||
mkdir -p "$(tccdir)/include"
|
||||
mkdir -p "$(tccdir)/examples"
|
||||
mkdir -p "$(tccdir)/doc"
|
||||
mkdir -p "$(tccdir)/libtcc"
|
||||
$(INSTALLBIN) -m755 $(PROGS) $(LIBTCC) "$(tccdir)"
|
||||
$(INSTALLBIN) -m755 $(PROGS) "$(tccdir)"
|
||||
$(INSTALL) -m644 libtcc1.a $(TOPSRC)/win32/lib/*.def "$(tccdir)/lib"
|
||||
cp -r $(TOPSRC)/win32/include/. "$(tccdir)/include"
|
||||
cp -r $(TOPSRC)/win32/examples/. "$(tccdir)/examples"
|
||||
cp $(TOPSRC)/tests/libtcc_test.c "$(tccdir)/examples"
|
||||
$(INSTALL) -m644 $(addprefix $(TOPSRC)/include/,$(TCC_INCLUDES)) $(TOPSRC)/tcclib.h "$(tccdir)/include"
|
||||
$(INSTALL) -m644 $(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h "$(tccdir)/include"
|
||||
$(INSTALL) -m644 tcc-doc.html $(TOPSRC)/win32/tcc-win32.txt "$(tccdir)/doc"
|
||||
$(INSTALL) -m644 $(TOPSRC)/libtcc.h libtcc.def "$(tccdir)/libtcc"
|
||||
ifdef CONFIG_CROSS
|
||||
|
46
configure
vendored
46
configure
vendored
@ -42,6 +42,7 @@ tcc_sysincludepaths=""
|
||||
tcc_libpaths=""
|
||||
tcc_crtprefix=""
|
||||
tcc_elfinterp=""
|
||||
triplet=
|
||||
tcc_lddir=
|
||||
confvars=
|
||||
cpu=
|
||||
@ -116,6 +117,8 @@ for opt do
|
||||
;;
|
||||
--elfinterp=*) tcc_elfinterp=`echo $opt | cut -d '=' -f 2`
|
||||
;;
|
||||
--triplet=*) triplet=`echo $opt | cut -d '=' -f 2`
|
||||
;;
|
||||
--cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
|
||||
;;
|
||||
--enable-gprof) gprof="yes"
|
||||
@ -293,6 +296,7 @@ Advanced options (experts only):
|
||||
--libpaths=... specify system library paths, colon separated
|
||||
--crtprefix=... specify locations of crt?.o, colon separated
|
||||
--elfinterp=... specify elf interpreter
|
||||
--triplet=... specify system library/include directory triplet
|
||||
EOF
|
||||
#echo "NOTE: The object files are build at the place where configure is launched"
|
||||
exit 1
|
||||
@ -312,12 +316,18 @@ if test -z "$cross_prefix" ; then
|
||||
gcc_major="$($CONFTEST version)"
|
||||
gcc_minor="$($CONFTEST minor)"
|
||||
if test "$mingw32" = "no" ; then
|
||||
triplet="$($CONFTEST triplet)"
|
||||
if test -f "/usr/lib/$triplet/crti.o" ; then
|
||||
tcc_lddir="lib"
|
||||
multiarch_triplet="$triplet"
|
||||
elif test "$cpu" != "x86" -a -f "/usr/lib64/crti.o" ; then
|
||||
tcc_lddir="lib64"
|
||||
|
||||
if test -z "$triplet"; then
|
||||
tt="$($CONFTEST triplet)"
|
||||
if test -n "$tt" -a -f "/usr/lib/$tt/crti.o" ; then
|
||||
triplet="$tt"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$triplet"; then
|
||||
if test ! -f "/usr/lib/crti.o" -a -f "/usr/lib64/crti.o" ; then
|
||||
tcc_lddir="lib64"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$cpu" = "armv4l" ; then
|
||||
@ -331,21 +341,10 @@ if test -z "$cross_prefix" ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# multiarch_triplet=${libc_dir#*/}
|
||||
# multiarch_triplet=${multiarch_triplet%/}
|
||||
# tcc_lddir="${libc_dir%%/*}"
|
||||
# if test -n "$multiarch_triplet" ; then
|
||||
# tcc_lddir="$tcc_lddir/$multiarch_triplet"
|
||||
# fi
|
||||
|
||||
if test -f "/lib/ld-uClibc.so.0" ; then
|
||||
confvars="$confvars uClibc"
|
||||
fi
|
||||
|
||||
# if test -z "$tcc_elfinterp" ; then
|
||||
# tcc_elfinterp="$(ldd $CONFTEST | grep '/ld-.*.so' | sed 's,\s*\(\S\+\).*,\1,')"
|
||||
# fi
|
||||
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@ -374,6 +373,8 @@ for i in $F_OPTIONS; do
|
||||
done
|
||||
rm -f cc_help.txt
|
||||
|
||||
fcho() { if test -n "$2"; then echo "$1$2"; else echo "$1-"; fi }
|
||||
|
||||
echo "Binary directory $bindir"
|
||||
echo "TinyCC directory $tccdir"
|
||||
echo "Library directory $libdir"
|
||||
@ -381,15 +382,16 @@ echo "Include directory $includedir"
|
||||
echo "Manual directory $mandir"
|
||||
echo "Info directory $infodir"
|
||||
echo "Doc directory $docdir"
|
||||
echo "Target root prefix $sysroot"
|
||||
fcho "Target root prefix " "$sysroot"
|
||||
echo "Source path $source_path"
|
||||
echo "C compiler $cc"
|
||||
echo "Target OS $targetos"
|
||||
echo "CPU $cpu"
|
||||
echo "Big Endian $bigendian"
|
||||
echo "gprof enabled $gprof"
|
||||
echo "cross compilers $build_cross"
|
||||
echo "use libgcc $use_libgcc"
|
||||
echo "Profiling $gprof"
|
||||
echo "Cross compilers $build_cross"
|
||||
echo "Use libgcc $use_libgcc"
|
||||
fcho "Triplet " "$triplet"
|
||||
|
||||
echo "Creating config.mak and config.h"
|
||||
|
||||
@ -437,7 +439,7 @@ print_mak CONFIG_TCC_LIBPATHS "$tcc_libpaths"
|
||||
print_mak CONFIG_TCC_CRTPREFIX "$tcc_crtprefix"
|
||||
print_mak CONFIG_TCC_ELFINTERP "$tcc_elfinterp"
|
||||
print_mak CONFIG_LDDIR "$tcc_lddir"
|
||||
print_mak CONFIG_MULTIARCHDIR "$multiarch_triplet"
|
||||
print_mak CONFIG_TRIPLET "$triplet"
|
||||
|
||||
echo "#define GCC_MAJOR $gcc_major" >> $TMPH
|
||||
echo "#define GCC_MINOR $gcc_minor" >> $TMPH
|
||||
|
@ -41,22 +41,21 @@ cross : TCC = $(TOP)/$(TARGET)-tcc$(EXESUF)
|
||||
I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O)
|
||||
X86_64_O = libtcc1.o alloca86_64.o alloca86_64-bt.o $(BCHECK_O)
|
||||
ARM_O = libtcc1.o armeabi.o alloca-arm.o
|
||||
WIN32_O = $(I386_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
|
||||
WIN64_O = $(X86_64_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
|
||||
ARM64_O = lib-arm64.o
|
||||
WIN32_O = crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
|
||||
|
||||
# build TCC runtime library to contain PIC code, so it can be linked
|
||||
# into shared libraries
|
||||
PICFLAGS = -fPIC
|
||||
|
||||
ifeq "$(TARGET)" "i386-win32"
|
||||
OBJ = $(addprefix $(DIR)/,$(WIN32_O))
|
||||
OBJ = $(addprefix $(DIR)/,$(I386_O) $(WIN32_O))
|
||||
TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
|
||||
XCC = $(TCC) -B$(TOPSRC)/win32 -I$(TOPSRC)/include
|
||||
XAR = $(DIR)/tiny_libmaker$(EXESUF)
|
||||
XFLAGS = $(TGT)
|
||||
else ifeq "$(TARGET)" "x86_64-win32"
|
||||
OBJ = $(addprefix $(DIR)/,$(WIN64_O))
|
||||
OBJ = $(addprefix $(DIR)/,$(X86_64_O) $(WIN32_O))
|
||||
TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
|
||||
XCC = $(TCC) -B$(TOPSRC)/win32 -I$(TOPSRC)/include
|
||||
XAR = $(DIR)/tiny_libmaker$(EXESUF)
|
||||
@ -110,4 +109,4 @@ $(OBJ) $(XAR) : $(DIR)/exists
|
||||
@echo $@ > $@
|
||||
|
||||
clean :
|
||||
rm -rfv i386-win32 x86_64-win32 i386 x86_64 arm arm64
|
||||
rm -rf i386-win32 x86_64-win32 i386 x86_64 arm arm64
|
||||
|
31
tcc.h
31
tcc.h
@ -173,24 +173,19 @@
|
||||
# define CONFIG_TCCDIR "."
|
||||
#endif
|
||||
#ifndef CONFIG_LDDIR
|
||||
# ifdef TCC_TARGET_X86_64
|
||||
# define CONFIG_LDDIR "lib64"
|
||||
# else
|
||||
# define CONFIG_LDDIR "lib"
|
||||
# endif
|
||||
# define CONFIG_LDDIR "lib"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MULTIARCHDIR
|
||||
# define USE_MUADIR(s) s "/" CONFIG_MULTIARCHDIR
|
||||
# define ALSO_MUADIR(s) s "/" CONFIG_MULTIARCHDIR ":" s
|
||||
#ifdef CONFIG_TRIPLET
|
||||
# define USE_TRIPLET(s) s "/" CONFIG_TRIPLET
|
||||
# define ALSO_TRIPLET(s) USE_TRIPLET(s) ":" s
|
||||
#else
|
||||
# define USE_MUADIR(s) s
|
||||
# define ALSO_MUADIR(s) s
|
||||
# define USE_TRIPLET(s) s
|
||||
# define ALSO_TRIPLET(s) s
|
||||
#endif
|
||||
|
||||
/* path to find crt1.o, crti.o and crtn.o */
|
||||
#ifndef CONFIG_TCC_CRTPREFIX
|
||||
# define CONFIG_TCC_CRTPREFIX USE_MUADIR(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR)
|
||||
# define CONFIG_TCC_CRTPREFIX USE_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR)
|
||||
#endif
|
||||
|
||||
/* Below: {B} is substituted by CONFIG_TCCDIR (rsp. -B option) */
|
||||
@ -202,8 +197,8 @@
|
||||
# else
|
||||
# define CONFIG_TCC_SYSINCLUDEPATHS \
|
||||
"{B}/include" \
|
||||
":" ALSO_MUADIR(CONFIG_SYSROOT "/usr/local/include") \
|
||||
":" ALSO_MUADIR(CONFIG_SYSROOT "/usr/include")
|
||||
":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/include") \
|
||||
":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/include")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -213,9 +208,9 @@
|
||||
# define CONFIG_TCC_LIBPATHS "{B}/lib"
|
||||
# else
|
||||
# define CONFIG_TCC_LIBPATHS \
|
||||
ALSO_MUADIR(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \
|
||||
":" ALSO_MUADIR(CONFIG_SYSROOT "/" CONFIG_LDDIR) \
|
||||
":" ALSO_MUADIR(CONFIG_SYSROOT "/usr/local/" CONFIG_LDDIR)
|
||||
ALSO_TRIPLET(CONFIG_SYSROOT "/usr/" CONFIG_LDDIR) \
|
||||
":" ALSO_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) \
|
||||
":" ALSO_TRIPLET(CONFIG_SYSROOT "/usr/local/" CONFIG_LDDIR)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -261,7 +256,7 @@
|
||||
#endif
|
||||
|
||||
/* library to use with CONFIG_USE_LIBGCC instead of libtcc1.a */
|
||||
#define TCC_LIBGCC USE_MUADIR(CONFIG_SYSROOT "/" CONFIG_LDDIR) "/libgcc_s.so.1"
|
||||
#define TCC_LIBGCC USE_TRIPLET(CONFIG_SYSROOT "/" CONFIG_LDDIR) "/libgcc_s.so.1"
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user