changeset 517:c1746b069e44

Add make.sh back, along with clean.sh and install.sh.
author Rob Landley <rob@landley.net>
date Mon, 26 Nov 2007 06:03:53 -0600
parents c3122e5db591
children b69ff9e2578a
files make/clean.sh make/install.sh make/make.sh
diffstat 3 files changed, 83 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/clean.sh	Mon Nov 26 06:03:53 2007 -0600
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+source configure
+
+# Need to figure out how much of this is needed...
+$DEBUG rm -f *~ *.o *.a *-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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/install.sh	Mon Nov 26 06:03:53 2007 -0600
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+source ./configure
+
+# Install libraries
+
+mkdir -p "$TINYCC_LIBDIR"
+cp libtinycc-*.a "$TINYCC_LIBDIR"
+
+# Install headers
+
+mkdir -p "$TINYCC_HEADERDIR"
+cp include/* "$TINYCC_HEADERDIR"
+
+# Install binaries
+cp *-tinycc /usr/local/bin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/make.sh	Mon Nov 26 06:03:53 2007 -0600
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+# Usage: ./make [ARCH]
+#
+# With no arguments, builds all targets.  Else build target(s) listed on
+# command line.  Special target "native" builds a native compiler.
+
+TINYCC_VERSION=0.9.25
+
+DOLOCAL="-B. -I./include -I."
+
+function build()
+{
+  source ./configure -v
+
+  # Build tinycc with a specific architecture and search paths.
+
+  $DEBUG $CC tcc.c -o ${TARGET}-tinycc_unstripped $CFLAGS $LIBS \
+    '-DTINYCC_TARGET_$i' \
+    '-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
+  [ $? -ne 0 ] && exit 1
+
+  # If this would be a native compiler for this host, create "tinycc" symlink
+  if [ "$i" == "$HOST" ]
+  then
+    $DEBUG rm -f tinycc
+    $DEBUG ln -s ${TARGET}-tinycc tinycc
+  fi
+
+  # Build libtinycc1.a
+
+  if [ -f $TARGET/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
+  fi
+}
+
+# Figure out what target(s) to build for.
+
+[ $# -ne 0 ] && TARGETS="$@"
+[ "$TARGETS" == "native" ] && TARGETS="$HOST"
+[ -z "$TARGETS" ] && TARGETS="i386 arm c67 win32"
+
+# Build each architecture
+
+for TARGET in $TARGETS
+do
+  build $TARGET || exit 1
+done