mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-27 06:10:06 +08:00
win32 configure
This commit is contained in:
parent
c50af8399d
commit
13affef3f1
@ -6,6 +6,7 @@ version 0.9.21:
|
||||
- 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:
|
||||
|
||||
|
76
Makefile
76
Makefile
@ -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 @@ endif
|
||||
|
||||
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 @@ ex3: ex3.c
|
||||
|
||||
# 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 @@ bcheck.o: bcheck.c
|
||||
|
||||
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 @@ FILES= Makefile Makefile.uClibc configure VERSION \
|
||||
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 \
|
||||
|
59
configure
vendored
59
configure
vendored
@ -18,7 +18,7 @@ TMPS="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.S"
|
||||
TMPH="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.h"
|
||||
|
||||
# default parameters
|
||||
prefix="/usr/local"
|
||||
prefix=""
|
||||
execprefix=""
|
||||
bindir=""
|
||||
libdir=""
|
||||
@ -56,10 +56,16 @@ case "$cpu" in
|
||||
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 @@ for opt do
|
||||
;;
|
||||
--enable-gprof) gprof="yes"
|
||||
;;
|
||||
--enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
@ -118,6 +126,11 @@ cc="${cross_prefix}${cc}"
|
||||
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 @@ echo ""
|
||||
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"$includedir" = x""; then
|
||||
includedir="${prefix}/include"
|
||||
fi
|
||||
if test x"$mandir" = x""; then
|
||||
mandir="${prefix}/man"
|
||||
fi
|
||||
if test x"$includedir" = x""; then
|
||||
includedir="${prefix}/include"
|
||||
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 "bindir=$bindir" >> config.mak
|
||||
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 "AR=$ar" >> config.mak
|
||||
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 @@ else
|
||||
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
|
||||
|
@ -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)
|
||||
|
3
tcc.c
3
tcc.c
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user