Mercurial > hg > tinycc
changeset 529:df3c131bf2f6
Unfortunately gcc defines things like "i386" to 1 (and not just __i386__
like a sane compiler would do), so using the TOSTR macro paths or filenames
containing the name of the host get replaced with "1". (So the i386 target
built fine on x86-64, but not on x86.) Back to painfully putting quotes in -D.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 07 Dec 2007 11:30:34 -0600 |
parents | 32ecdbcb7282 |
children | 756927e16211 |
files | make/clean.sh make/make.sh tcc.c tcc.h tccelf.c |
diffstat | 5 files changed, 25 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/make/clean.sh Wed Dec 05 20:31:56 2007 -0600 +++ b/make/clean.sh Fri Dec 07 11:30:34 2007 -0600 @@ -3,8 +3,6 @@ source configure # Need to figure out how much of this is needed... -$DEBUG rm -f *~ *.o *.a tinycc *-tinycc *-tinycc_unstripped tinycc.1 tcct \ - tcc_g tcctest.ref *.bin *.i ex2 core gmon.out test.out test.ref a.out \ - tcc_p *.exe *.lib tcc.pod libtcc_test i386/*.o \ - tcctest[1234] test[1234].out tcc win32/lib/*.o - +$DEBUG rm -f *~ *.o *.a tinycc *-tinycc *-tinycc_unstripped tinycc.1 \ + tcctest.ref *.bin *.i ex2 core gmon.out test.out test.ref a.out \ + *.exe *.lib libtcc_test tcctest[1234] test[1234].out tcc win32/lib/*.o
--- a/make/make.sh Wed Dec 05 20:31:56 2007 -0600 +++ b/make/make.sh Fri Dec 07 11:30:34 2007 -0600 @@ -15,32 +15,33 @@ # Build tinycc with a specific architecture and search paths. - $DEBUG $CC tcc.c -o ${TARGET}-tinycc_unstripped $CFLAGS $LIBS \ + $DEBUG $CC tcc.c -o $1-tinycc_unstripped $CFLAGS $LIBS \ -DTINYCC_TARGET_$1 \ - -DTINYCC_TARGET=$1 \ - -DTINYCC_VERSION=$TINYCC_VERSION \ - -DTINYCC_LIBDIR=$TINYCC_LIBDIR \ - -DCC_CRTDIR=$CC_CRTDIR \ - -DCC_LIBPATH=$CC_LIBPATH \ - -DCC_HEADERPATH=$CC_HEADERPATH && - $DEBUG $STRIP ${TARGET}-tinycc_unstripped -o ${TARGET}-tinycc + -DTINYCC_TARGET='"'$1'"' \ + -DTINYCC_VERSION='"'$TINYCC_VERSION'"' \ + -DTINYCC_LIBDIR='"'$TINYCC_LIBDIR'"' \ + -DCC_CRTDIR='"'$CC_CRTDIR'"' \ + -DCC_LIBPATH='"'$CC_LIBPATH'"' \ + -DCC_HEADERPATH='"'$CC_HEADERPATH'"' && + $DEBUG $STRIP $1-tinycc_unstripped -o $1-tinycc [ $? -ne 0 ] && exit 1 # If this would be a native compiler for this host, create "tinycc" symlink if [ "$1" == "$HOST" ] then $DEBUG rm -f tinycc - $DEBUG ln -s ${TARGET}-tinycc tinycc + $DEBUG ln -s $1-tinycc tinycc fi # Build libtinycc1.a - if [ -f $TARGET/alloca.S ] + if [ -f $1/alloca.S ] then - $DEBUG ./$TARGET-tinycc $DOLOCAL -o libtinycc1.o -c libtinycc1.c && - $DEBUG ./$TARGET-tinycc $DOLOCAL -o alloca.o -c $TARGET/alloca.S && - $DEBUG ./$TARGET-tinycc $DOLOCAL -o bound-alloca.o -c $TARGET/bound-alloca.S && - $DEBUG $AR rcs libtinycc-${TARGET}.a libtinycc1.o alloca.o bound-alloca.o + $DEBUG mkdir -p lib/$1 + $DEBUG ./$1-tinycc $DOLOCAL -o libtinycc1-$1.o -c libtinycc1.c && + $DEBUG ./$1-tinycc $DOLOCAL -o alloca-$1.o -c $1/alloca.S && + $DEBUG ./$1-tinycc $DOLOCAL -o bound-alloca-$1.o -c $1/bound-alloca.S && + $DEBUG $AR rcs libtinycc-$1.a {libtinycc1,alloca,bound-alloca}-$1.o fi }
--- a/tcc.c Wed Dec 05 20:31:56 2007 -0600 +++ b/tcc.c Fri Dec 07 11:30:34 2007 -0600 @@ -9116,7 +9116,7 @@ char buf[1024]; snprintf(buf, sizeof(buf), "%s/lib", tinycc_path); add_dynarray_path(s, buf, &(s->library_paths)); - add_dynarray_path(s, TOSTR(CC_LIBPATH), &(s->library_paths)); + add_dynarray_path(s, CC_LIBPATH, &(s->library_paths)); } /* if bound checking, then add corresponding sections */ @@ -9154,8 +9154,8 @@ && !s->nostdlib) { if (s->output_type != TCC_OUTPUT_DLL) - tcc_add_file(s, TOSTR(CC_CRTDIR) "/crt1.o"); - tcc_add_file(s, TOSTR(CC_CRTDIR) "/crti.o"); + tcc_add_file(s, CC_CRTDIR "/crt1.o"); + tcc_add_file(s, CC_CRTDIR "/crti.o"); } #endif return 0; @@ -9268,7 +9268,7 @@ void show_version(void) { - printf("tinycc version " TOSTR(TINYCC_VERSION) "\n"); + printf("tinycc version " TINYCC_VERSION "\n"); } void help(TCCState *s) @@ -9664,7 +9664,7 @@ tinycc_path = path; } #else - tinycc_path = TOSTR(TINYCC_LIBDIR); + tinycc_path = TINYCC_LIBDIR; #endif optind = parse_args(s, argc - 1, argv + 1) + 1;
--- a/tcc.h Wed Dec 05 20:31:56 2007 -0600 +++ b/tcc.h Fri Dec 07 11:30:34 2007 -0600 @@ -8,11 +8,6 @@ */ #define _GNU_SOURCE -// Macros to convert configuration data to strings. One evaluates the config -// data as a macro, the other converts it to a string. -#define TOSTR(x) TOSTR2(x) -#define TOSTR2(x) #x - #ifdef CONFIG_TCCBOOT #include "tccboot.h"
--- a/tccelf.c Wed Dec 05 20:31:56 2007 -0600 +++ b/tccelf.c Fri Dec 07 11:30:34 2007 -0600 @@ -1011,10 +1011,10 @@ // add libc if (!s1->nostdlib) { tcc_add_library(s1, "c"); - tcc_add_library(s1, "tinycc-" TOSTR(TINYCC_TARGET)); + tcc_add_library(s1, "tinycc-" TINYCC_TARGET); // add crt end if not memory output if (s1->output_type != TCC_OUTPUT_MEMORY) - tcc_add_file(s1, TOSTR(CC_CRTDIR) "/crtn.o"); + tcc_add_file(s1, CC_CRTDIR "/crtn.o"); } }