changeset 527:00f2128ca0a4

Look for the right libtinycc name, add TOSTR() macro, tweak make/make.sh to use it for one value as a test.
author Rob Landley <rob@landley.net>
date Wed, 05 Dec 2007 18:33:34 -0600
parents 4a8e25b7f510
children 32ecdbcb7282
files make/make.sh tcc.h tccelf.c
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/make/make.sh	Wed Dec 05 16:47:19 2007 -0600
+++ b/make/make.sh	Wed Dec 05 18:33:34 2007 -0600
@@ -16,7 +16,8 @@
   # Build tinycc with a specific architecture and search paths.
 
   $DEBUG $CC tcc.c -o ${TARGET}-tinycc_unstripped $CFLAGS $LIBS \
-    '-DTINYCC_TARGET_$i' \
+    "-DTINYCC_TARGET_$1" \
+    "-DTINYCC_TARGET=$1" \
     '-DTINYCC_VERSION="'"$TINYCC_VERSION"'"' \
     '-DTINYCC_LIBDIR="'"$TINYCC_LIBDIR"'"' \
     '-DCC_CRTDIR="'"$CC_CRTDIR"'"' \
@@ -26,7 +27,7 @@
   [ $? -ne 0 ] && exit 1
 
   # If this would be a native compiler for this host, create "tinycc" symlink
-  if [ "$i" == "$HOST" ]
+  if [ "$1" == "$HOST" ]
   then
     $DEBUG rm -f tinycc
     $DEBUG ln -s ${TARGET}-tinycc tinycc
--- a/tcc.h	Wed Dec 05 16:47:19 2007 -0600
+++ b/tcc.h	Wed Dec 05 18:33:34 2007 -0600
@@ -8,6 +8,11 @@
  */
 #define _GNU_SOURCE
 
+// Macros to convert incoming config macros to strings.
+
+#define TOSTR(x) TOSTR2(x)
+#define TOSTR2(x) #x
+
 #ifdef CONFIG_TCCBOOT
 
 #include "tccboot.h"
--- a/tccelf.c	Wed Dec 05 16:47:19 2007 -0600
+++ b/tccelf.c	Wed Dec 05 18:33:34 2007 -0600
@@ -1011,7 +1011,7 @@
     // add libc
     if (!s1->nostdlib) {
         tcc_add_library(s1, "c");
-        tcc_add_library(s1, "tinycc");
+        tcc_add_library(s1, "tinycc-" TOSTR(TINYCC_TARGET));
       // add crt end if not memory output
       if (s1->output_type != TCC_OUTPUT_MEMORY)
           tcc_add_file(s1, CC_CRTDIR "/crtn.o");