changeset 311:248897b4c27e

[project @ 2004-10-07 21:11:43 by bellard] win32 configure
author bellard
date Thu, 07 Oct 2004 21:11:43 +0000
parents 0e049e2831f0
children 11e77c170aea
files Changelog Makefile VERSION configure libtcc_test.c tcc.c
diffstat 6 files changed, 92 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/Changelog	Thu Oct 07 20:15:50 2004 +0000
+++ b/Changelog	Thu Oct 07 21:11:43 2004 +0000
@@ -6,6 +6,7 @@
 - fixed assignment of const struct in struct
 - line comment fix (reported by Bertram Felgenhauer)
 - initial TMS320C67xx target support (TK)
+- win32 configure
 
 version 0.9.20:
 
--- a/Makefile	Thu Oct 07 20:15:50 2004 +0000
+++ b/Makefile	Thu Oct 07 21:11:43 2004 +0000
@@ -4,7 +4,10 @@
 include config.mak
 
 CFLAGS=-O2 -g -Wall
+ifndef CONFIG_WIN32
 LIBS=-ldl
+BCHECK_O=bcheck.o
+endif
 CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
 LIBS_P=
 
@@ -17,11 +20,13 @@
 
 DISAS=objdump -d
 INSTALL=install
-
+PROGS=tcc$(EXESUF) c67-tcc$(EXESUF) arm-tcc$(EXESUF)
 # run local version of tcc with local libraries and includes
 TCC=./tcc -B. -I.
 
-all: tcc libtcc1.a bcheck.o tcc-doc.html tcc.1 libtcc.a libtcc_test
+all: $(PROGS) \
+     libtcc1$(LIBSUF) $(BCHECK_O) tcc-doc.html tcc.1 libtcc$(LIBSUF) \
+     libtcc_test$(EXESUF)
 
 Makefile: config.mak
 
@@ -108,23 +113,23 @@
 
 # Native Tiny C Compiler
 
-tcc_g: tcc.c i386-gen.c tccelf.c tccasm.c i386-asm.c tcctok.h libtcc.h i386-asm.h Makefile
+tcc_g$(EXESUF): tcc.c i386-gen.c tccelf.c tccasm.c i386-asm.c tcctok.h libtcc.h i386-asm.h Makefile
 	$(CC) $(CFLAGS) -o $@ $< $(LIBS)
 
-tcc: tcc_g Makefile
-	strip -s -R .comment -R .note -o $@ $<
+tcc$(EXESUF): tcc_g$(EXESUF) Makefile
+	$(STRIP) -o $@ $<
 
-c67-tcc: tcc.c c67-gen.c tccelf.c tccasm.c tcctok.h libtcc.h tcccoff.c Makefile
+c67-tcc$(EXESUF): tcc.c c67-gen.c tccelf.c tccasm.c tcctok.h libtcc.h tcccoff.c Makefile
 	$(CC) $(CFLAGS) -DTCC_TARGET_C67 -o $@ $< $(LIBS)
 
-arm-tcc: tcc.c arm-gen.c tccelf.c tccasm.c tcctok.h libtcc.h Makefile
+arm-tcc$(EXESUF): tcc.c arm-gen.c tccelf.c tccasm.c tcctok.h libtcc.h Makefile
 	$(CC) $(CFLAGS) -DTCC_TARGET_ARM -o $@ $< $(LIBS)
 
 # TinyCC runtime libraries
 libtcc1.o: libtcc1.c
 	$(CC) -O2 -Wall -c -o $@ $<
 
-libtcc1.a: libtcc1.o
+libtcc1$(LIBSUF): libtcc1.o
 	$(AR) rcs $@ $^
 
 bcheck.o: bcheck.c
@@ -132,52 +137,49 @@
 
 install: tcc_install libinstall
 
-tcc_install: tcc tcc.1 libtcc1.a bcheck.o
-	mkdir -p $(bindir)
-	$(INSTALL) -m755 tcc $(bindir)
-	mkdir -p $(mandir)/man1
-	$(INSTALL) tcc.1 $(mandir)/man1
-	mkdir -p $(libdir)/tcc
-	mkdir -p $(libdir)/tcc/include
-	$(INSTALL) -m644 libtcc1.a bcheck.o $(libdir)/tcc
+tcc_install: $(PROGS) tcc.1 libtcc1$(LIBSUF) $(BCHECK_O) tcc-doc.html tcc.1
+	mkdir -p "$(bindir)"
+	$(INSTALL) -s -m755 $(PROGS) "$(bindir)"
+ifndef CONFIG_WIN32
+	mkdir -p "$(mandir)/man1"
+	$(INSTALL) tcc.1 "$(mandir)/man1"
+endif
+	mkdir -p "$(libdir)/tcc"
+	mkdir -p "$(libdir)/tcc/include"
+	$(INSTALL) -m644 libtcc1$(LIBSUF) $(BCHECK_O) "$(libdir)/tcc"
 	$(INSTALL) -m644 stdarg.h stddef.h stdbool.h float.h varargs.h \
-                   tcclib.h $(libdir)/tcc/include
+                   tcclib.h "$(libdir)/tcc/include"
+	mkdir -p "$(docdir)"
+	$(INSTALL) -m644 tcc-doc.html "$(docdir)"
 
 clean:
 	rm -f *~ *.o tcc tcc1 tcct tcc_g tcctest.ref *.bin *.i ex2 \
            core gmon.out test.out test.ref a.out tcc_p \
-           *.exe tcc-doc.html tcc.pod tcc.1 libtcc.a libtcc_test \
-           tcctest[1234] test[1234].out
+           *.exe tcc-doc.html tcc.pod tcc.1 libtcc$(LIBSUF) libtcc_test \
+           tcctest[1234] test[1234].out c67-tcc arm-tcc
 
 distclean: clean
 	rm -f config.h config.mak config.texi
 
-# win32 TCC
-tcc_g.exe: tcc.c i386-gen.c bcheck.c Makefile
-	i386-mingw32msvc-gcc $(CFLAGS) -DCONFIG_TCC_STATIC -o $@ $<
-
-tcc.exe: tcc_g.exe
-	i386-mingw32msvc-strip -o $@ $<
-
 # profiling version
 tcc_p: tcc.c Makefile
 	$(CC) $(CFLAGS_P) -o $@ $< $(LIBS_P)
 
 # libtcc generation and example
-libinstall: libtcc.a 
-	mkdir -p $(libdir)
-	$(INSTALL) -m644 libtcc.a $(libdir)
-	mkdir -p $(includedir)
-	$(INSTALL) -m644 libtcc.h $(includedir)
+libinstall: libtcc$(LIBSUF) 
+	mkdir -p "$(libdir)"
+	$(INSTALL) -m644 libtcc$(LIBSUF) "$(libdir)"
+	mkdir -p "$(includedir)"
+	$(INSTALL) -m644 libtcc.h "$(includedir)"
 
-libtcc.o: tcc.c i386-gen.c bcheck.c Makefile
+libtcc.o: tcc.c i386-gen.c Makefile
 	$(CC) $(CFLAGS) -DLIBTCC -c -o $@ $<
 
-libtcc.a: libtcc.o 
+libtcc$(LIBSUF): libtcc.o 
 	$(AR) rcs $@ $^
 
-libtcc_test: libtcc_test.c libtcc.a 
-	$(CC) $(CFLAGS) -I. -o $@ $< -L. -ltcc -ldl
+libtcc_test$(EXESUF): libtcc_test.c libtcc$(LIBSUF)
+	$(CC) $(CFLAGS) -o $@ $< libtcc$(LIBSUF) $(LIBS)
 
 libtest: libtcc_test
 	./libtcc_test
@@ -226,7 +228,9 @@
        README TODO COPYING \
        Changelog tcc-doc.texi tcc-doc.html \
        tcc.1 \
-       tcc.c i386-gen.c tccelf.c tcctok.h tccasm.c  i386-asm.c i386-asm.h\
+       tcc.c tccelf.c tcctok.h tccasm.c i386-asm.c i386-asm.h \
+       tcccoff.c coff.h \
+       i386-gen.c c67-gen.c arm-gen.c \
        bcheck.c libtcc1.c \
        elf.h stab.h stab.def \
        stddef.h stdarg.h stdbool.h float.h varargs.h \
--- a/VERSION	Thu Oct 07 20:15:50 2004 +0000
+++ b/VERSION	Thu Oct 07 21:11:43 2004 +0000
@@ -1,1 +1,1 @@
-0.9.20
\ No newline at end of file
+0.9.21
\ No newline at end of file
--- a/configure	Thu Oct 07 20:15:50 2004 +0000
+++ b/configure	Thu Oct 07 21:11:43 2004 +0000
@@ -18,7 +18,7 @@
 TMPH="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.h"
 
 # default parameters
-prefix="/usr/local"
+prefix=""
 execprefix=""
 bindir=""
 libdir=""
@@ -56,10 +56,16 @@
 esac
 gprof="no"
 bigendian="no"
+mingw32="no"
+LIBSUF=".a"
+EXESUF=""
 
 # OS specific
 targetos=`uname -s`
 case $targetos in
+MINGW32*)
+mingw32="yes"
+;;
 *) ;;
 esac
 
@@ -106,6 +112,8 @@
   ;;
   --enable-gprof) gprof="yes"
   ;;
+  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
+  ;; 
   esac
 done
 
@@ -118,6 +126,11 @@
 ar="${cross_prefix}${ar}"
 strip="${cross_prefix}${strip}"
 
+if test "$mingw32" = "yes" ; then
+    LIBSUF=".lib"
+    EXESUF=".exe"
+fi
+
 if test -z "$cross_prefix" ; then
 
 # ---
@@ -188,26 +201,43 @@
 exit 1
 fi
 
-if test x"$execprefix" = x""; then
-execprefix="${prefix}"
-fi
-if test x"$bindir" = x""; then
-bindir="${execprefix}/bin"
-fi
+if test "$mingw32" = "yes" ; then
+    if test -z "$prefix" ; then
+        prefix="/c/Program Files/tcc"
+    fi
+    execprefix="$prefix"
+    bindir="$prefix"
+    docdir="$prefix/doc"
+else
+    if test -z "$prefix" ; then
+        prefix="/usr/local"
+    fi
+    if test x"$execprefix" = x""; then
+        execprefix="${prefix}"
+    fi
+    if test x"$bindir" = x""; then
+        bindir="${execprefix}/bin"
+    fi
+    if test x"$docdir" = x""; then
+        docdir="$prefix/share/doc/qemu"
+    fi
+fi # mingw32
+
 if test x"$libdir" = x""; then
 libdir="${execprefix}/lib"
 fi
+if test x"$mandir" = x""; then
+mandir="${prefix}/man"
+fi
 if test x"$includedir" = x""; then
 includedir="${prefix}/include"
 fi
-if test x"$mandir" = x""; then
-mandir="${prefix}/man"
-fi
 
 echo "Binary  directory   $bindir"
 echo "Library directory   $libdir"
 echo "Include directory   $includedir"
-echo "Manual  directory   $mandir"
+echo "Manual directory    $mandir"
+echo "Doc directory       $docdir"
 echo "Source path      $source_path"
 echo "C compiler       $cc"
 echo "make             $make"
@@ -225,6 +255,7 @@
 echo "libdir=$libdir" >> config.mak
 echo "includedir=$includedir" >> config.mak
 echo "mandir=$mandir" >> config.mak
+echo "docdir=$docdir" >> config.mak
 echo "#define CONFIG_TCC_LIBDIR \"$libdir\"" >> $TMPH
 echo "MAKE=$make" >> config.mak
 echo "CC=$cc" >> config.mak
@@ -235,6 +266,8 @@
 echo "STRIP=$strip -s -R .comment -R .note" >> config.mak
 echo "CFLAGS=$CFLAGS" >> config.mak
 echo "LDFLAGS=$LDFLAGS" >> config.mak
+echo "LIBSUF=$LIBSUF" >> config.mak
+echo "EXESUF=$EXESUF" >> config.mak
 if test "$cpu" = "x86" ; then
   echo "ARCH=i386" >> config.mak
   echo "#define HOST_I386 1" >> $TMPH
@@ -257,6 +290,10 @@
   echo "Unsupported CPU"
   exit 1
 fi
+if test "$mingw32" = "yes" ; then
+  echo "CONFIG_WIN32=yes" >> config.mak
+  echo "#define CONFIG_WIN32 1" >> $TMPH
+fi
 if test "$bigendian" = "yes" ; then
   echo "WORDS_BIGENDIAN=yes" >> config.mak
   echo "#define WORDS_BIGENDIAN 1" >> $TMPH
--- a/libtcc_test.c	Thu Oct 07 20:15:50 2004 +0000
+++ b/libtcc_test.c	Thu Oct 07 21:11:43 2004 +0000
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include <libtcc.h>
+#include "libtcc.h"
 
 /* this function is called by the generated code */
 int add(int a, int b)
--- a/tcc.c	Thu Oct 07 20:15:50 2004 +0000
+++ b/tcc.c	Thu Oct 07 21:11:43 2004 +0000
@@ -34,6 +34,7 @@
 #include <time.h>
 #ifdef WIN32
 #include <sys/timeb.h>
+#define CONFIG_TCC_STATIC
 #endif
 #ifndef WIN32
 #include <sys/time.h>
@@ -85,13 +86,11 @@
 #define TCC_TARGET_COFF
 #endif
 
-#if !defined(WIN32)
 #define FALSE 0
 #define false 0
 #define TRUE 1
 #define true 1
 typedef int BOOL;
-#endif
 
 /* path to find crt1.o, crti.o and crtn.o. Only needed when generating
    executables or dlls */