tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] VPATH builds


From: Akim Demaille
Subject: Re: [Tinycc-devel] VPATH builds
Date: Sat, 22 Dec 2012 08:26:59 +0100

(Sorry, I just noticed this window now, I really thought I had
already sent this message...)

hi all,

Le 20 déc. 2012 à 23:29, grischka <address@hidden> a écrit :

> Apropos VPATH, our new VPATH/out-of-tree build seems to have some
> problems:
>    ../tinycc/configure && make
> doesn't work.  Problems also with
>    make install

I have installed fixes for these (included below FTR).

> and possibly with
>    configure --enable-cross

I have not tried that yet.

> Akim?
> 
> Apropos problems, I've committed a new "tar" target (including some
> CRLF conversion) and also removed the hard-coded version string from
> build-tcc.bat.  That is two things less to worry about for release.

Well, again, there is an existing practice of "make dist",
I'd suggest using that name.  I find it bizarre that tcc
uses the GNU Build System conventions (configure && make
&& make install), but departs from it for make check and
make dist.


commit 9c9ca2032bc033792d748264e34e810e689598b5
Author: Akim Demaille <address@hidden>
Date:   Fri Dec 21 13:41:43 2012 +0100

    configure: style changes
    
    * configure (case $targetos): Improve readibility.
    (case $cpu): New, to improve readability compare to if + test.

diff --git a/configure b/configure
index b4ac328..b440c5d 100755
--- a/configure
+++ b/configure
@@ -101,16 +101,10 @@ EXESUF=""
 # OS specific
 targetos=`uname -s`
 case $targetos in
-MINGW32*)
-mingw32="yes"
-;;
-DragonFly)
-noldl="yes"
-;;
-OpenBSD)
-noldl="yes"
-;;
-*) ;;
+  MINGW32*)  mingw32=yes;;
+  DragonFly) noldl=yes;;
+  OpenBSD)   noldl=yes;;
+  *) ;;
 esac
 
 # find source path
@@ -231,9 +225,9 @@ fi
 else
 
 # if cross compiling, cannot launch a program, so make a static guess
-if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" ; then
-    bigendian="yes"
-fi
+case $cpu in
+  powerpc|mips|s390)  bigendian=yes;;
+esac
 
 fi
 

commit ba49862de6eb2c50fb6273568f2488c34b7c58f9
Author: Akim Demaille <address@hidden>
Date:   Fri Dec 21 13:47:00 2012 +0100

    configure: prefer here-documents
    
    * configure: use here-documents to improve readability and
    reduce the clutter.

diff --git a/configure b/configure
index b440c5d..6467aaa 100755
--- a/configure
+++ b/configure
@@ -262,47 +262,45 @@ fi
 
 if test x"$show_help" = "xyes" ; then
 cat << EOF
-
 Usage: configure [options]
 Options: [defaults in brackets after descriptions]
 
+Standard options:
+  --help                   print this message
+  --prefix=PREFIX          install in PREFIX [$prefix]
+  --exec-prefix=EPREFIX    install architecture-dependent files in EPREFIX
+                           [same as prefix]
+  --bindir=DIR             user executables in DIR [EPREFIX/bin]
+  --libdir=DIR             object code libraries in DIR [EPREFIX/lib]
+  --tccdir=DIR             installation directory [EPREFIX/lib/tcc]
+  --includedir=DIR         C header files in DIR [PREFIX/include]
+  --sharedir=DIR           documentation root DIR [PREFIX]/share
+  --docdir=DIR             documentation in DIR [SHAREDIR/doc/tcc]
+  --mandir=DIR             man documentation in DIR [SHAREDIR/man]
+  --infodir=DIR            info documentation in DIR [SHAREDIR/info]
+
+Advanced options (experts only):
+  --source-path=PATH       path of source code [$source_path]
+  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
+  --sysroot=PREFIX         prepend PREFIX to library/include paths []
+  --cc=CC                  use C compiler CC [$cc]
+  --disable-static         make libtcc.so instead of libtcc.a
+  --disable-rpath          disable use of -rpath with the above
+  --strip-binaries         strip symbol tables from resulting binaries
+  --with-libgcc            use /lib/libgcc_s.so.1 instead of libtcc.a
+  --enable-mingw32         build windows version on linux with mingw32
+  --enable-cygwin          build windows version on windows with cygwin
+                           [requires cygwin and mingw32-make]
+  --enable-cross           build cross compilers
+  --extra-cflags=          extra compiler flags
+  --extra-ldflags=         extra linker options
+  --with-selinux           use mmap instead of exec mem
+                           [requires write access to /tmp]
+  --sysincludepaths=...    specify system include paths, colon separated
+  --libpaths=...           specify system library paths, colon separated
+  --crtprefix=...          specify locations of crt?.o, colon separated
+  --elfinterp=...          specify elf interpreter
 EOF
-echo "Standard options:"
-echo "  --help                   print this message"
-echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
-echo "  --exec-prefix=EPREFIX    install architecture-dependent files in 
EPREFIX"
-echo "                           [same as prefix]"
-echo "  --bindir=DIR             user executables in DIR [EPREFIX/bin]"
-echo "  --libdir=DIR             object code libraries in DIR [EPREFIX/lib]"
-echo "  --tccdir=DIR             installation directory [EPREFIX/lib/tcc]"
-echo "  --includedir=DIR         C header files in DIR [PREFIX/include]"
-echo "  --sharedir=DIR           documentation root DIR [PREFIX]/share"
-echo "  --docdir=DIR             documentation in DIR [SHAREDIR/doc/tcc]"
-echo "  --mandir=DIR             man documentation in DIR [SHAREDIR/man]"
-echo "  --infodir=DIR            info documentation in DIR [SHAREDIR/info]"
-echo ""
-echo "Advanced options (experts only):"
-echo "  --source-path=PATH       path of source code [$source_path]"
-echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
-echo "  --sysroot=PREFIX         prepend PREFIX to library/include paths []"
-echo "  --cc=CC                  use C compiler CC [$cc]"
-echo "  --disable-static         make libtcc.so instead of libtcc.a"
-echo "  --disable-rpath          disable use of -rpath with the above"
-echo "  --strip-binaries         strip symbol tables from resulting binaries"
-echo "  --with-libgcc            use /lib/libgcc_s.so.1 instead of libtcc.a"
-echo "  --enable-mingw32         build windows version on linux with mingw32"
-echo "  --enable-cygwin          build windows version on windows with cygwin"
-echo "                           [requires cygwin and mingw32-make]"
-echo "  --enable-cross           build cross compilers"
-echo "  --extra-cflags=          extra compiler flags"
-echo "  --extra-ldflags=         extra linker options"
-echo "  --with-selinux           use mmap instead of exec mem"
-echo "                           [requires write access to /tmp]"
-echo "  --sysincludepaths=...    specify system include paths, colon separated"
-echo "  --libpaths=...           specify system library paths, colon separated"
-echo "  --crtprefix=...          specify locations of crt?.o, colon separated"
-echo "  --elfinterp=...          specify elf interpreter"
-echo ""
 #echo "NOTE: The object files are build at the place where configure is 
launched"
 exit 1
 fi
@@ -359,22 +357,24 @@ if test x"$includedir" = x""; then
 includedir="${prefix}/include"
 fi
 
-echo "Binary  directory   $bindir"
-echo "TinyCC directory    $tccdir"
-echo "Library directory   $libdir"
-echo "Include directory   $includedir"
-echo "Manual directory    $mandir"
-echo "Info directory      $infodir"
-echo "Doc directory       $docdir"
-echo "Target root prefix  $sysroot"
-echo "Source path      $source_path"
-echo "C compiler       $cc"
-echo "Target OS        $targetos"
-echo "CPU              $cpu"
-echo "Big Endian       $bigendian"
-echo "gprof enabled    $gprof"
-echo "cross compilers  $build_cross"
-echo "use libgcc       $use_libgcc"
+cat <<EOF
+Binary  directory   $bindir
+TinyCC directory    $tccdir
+Library directory   $libdir
+Include directory   $includedir
+Manual directory    $mandir
+Info directory      $infodir
+Doc directory       $docdir
+Target root prefix  $sysroot
+Source path      $source_path
+C compiler       $cc
+Target OS        $targetos
+CPU              $cpu
+Big Endian       $bigendian
+gprof enabled    $gprof
+cross compilers  $build_cross
+use libgcc       $use_libgcc
+EOF
 
 echo "Creating config.mak and config.h"
 

commit d7264e02186d302cb55ac7b7f06bf9efb92bc46d
Author: Akim Demaille <address@hidden>
Date:   Fri Dec 21 13:49:15 2012 +0100

    configure: style changes
    
    * configure: use more here-documents.

diff --git a/configure b/configure
index 6467aaa..1c1497a 100755
--- a/configure
+++ b/configure
@@ -378,18 +378,20 @@ EOF
 
 echo "Creating config.mak and config.h"
 
-echo "# Automatically generated by configure - do not modify" > config.mak
-echo "/* Automatically generated by configure - do not modify */" > $TMPH
+cat >config.mak <<EOF
+# Automatically generated by configure - do not modify
+prefix=$prefix
+bindir=\$(DESTDIR)$bindir
+tccdir=\$(DESTDIR)$tccdir
+libdir=\$(DESTDIR)$libdir
+ln_libdir=$libdir
+includedir=\$(DESTDIR)$includedir
+mandir=\$(DESTDIR)$mandir
+infodir=\$(DESTDIR)$infodir
+docdir=\$(DESTDIR)$docdir
+EOF
 
-echo "prefix=$prefix" >> config.mak
-echo "bindir=\$(DESTDIR)$bindir" >> config.mak
-echo "tccdir=\$(DESTDIR)$tccdir" >> config.mak
-echo "libdir=\$(DESTDIR)$libdir" >> config.mak
-echo "ln_libdir=$libdir" >> config.mak
-echo "includedir=\$(DESTDIR)$includedir" >> config.mak
-echo "mandir=\$(DESTDIR)$mandir" >> config.mak
-echo "infodir=\$(DESTDIR)$infodir" >> config.mak
-echo "docdir=\$(DESTDIR)$docdir" >> config.mak
+echo "/* Automatically generated by configure - do not modify */" > $TMPH
 print_var1()
 {
   echo "#ifndef $1" >> $TMPH

commit 017bbbfee11b6b9ed615bb0e176f29e38b696f6f
Author: Akim Demaille <address@hidden>
Date:   Fri Dec 21 13:55:26 2012 +0100

    configure: support absolete out-of-tree builds
    
    configure: handle the case of absolute paths.
    Reported by grishka.

diff --git a/README b/README
index eedc71c..43e6c3b 100644
--- a/README
+++ b/README
@@ -35,8 +35,8 @@ Documentation:
    make test
    make install
 
-Alternatively, VPATH builds are supported: you may use different
-directories to old build objects, kept separate from your source tree:
+Alternatively, out-of-tree builds are supported: you may use different
+directories to hold build objects, kept separate from your source tree:
 
    mkdir _build
    cd _build
diff --git a/configure b/configure
index 1c1497a..e4321b7 100755
--- a/configure
+++ b/configure
@@ -502,9 +502,14 @@ if test "$source_path_used" = "yes" ; then
     for f in $FILES ; do
         dir=`fn_dirname "$f"`
         test -d "$dir" || mkdir -p "$dir"
-        back=`echo "$source_path/$dir/" | sed 's,/\./,/,g;s,[^/]*/,../,g'`
-        back=$back$f
-        ln -sf $back $f
+        # Build a symlink $f that points to $dest, its $source_path
+        # counterpart.
+        case $source_path in
+          /*) dest=$source_path/$f;;
+           *) dest=`echo "$source_path/$dir/" | sed 
's,/\./,/,g;s,[^/]*/,../,g'`
+              dest=$dest$f;;
+        esac
+        ln -sf $dest $f
     done
 fi
 cat >>config.mak <<EOF

commit 8adfb4a419266ecd7b1eb739bf61a83e0514040c
Author: Akim Demaille <address@hidden>
Date:   Fri Dec 21 14:17:16 2012 +0100

    build: simplify the makefiles
    
    * Makefile: use "else if" to improve readability.

diff --git a/Makefile b/Makefile
index 3f8375e..6a49dff 100644
--- a/Makefile
+++ b/Makefile
@@ -57,15 +57,13 @@ NATIVE_DEFINES+=$(if $(wildcard 
/lib/i386-linux-gnu),-DCONFIG_MULTIARCHDIR=\"i38
 NATIVE_DEFINES+=$(if $(wildcard 
/lib/i386-kfreebsd-gnu),-DCONFIG_MULTIARCHDIR=\"i386-kfreebsd-gnu\")
 NATIVE_DEFINES+=$(if $(wildcard 
/lib/i386-gnu),-DCONFIG_MULTIARCHDIR=\"i386-gnu\")
 CFLAGS+=-m32
-else
-ifeq ($(ARCH),x86-64)
+else ifeq ($(ARCH),x86-64)
 NATIVE_DEFINES=-DTCC_TARGET_X86_64
 CFLAGS+=-m64
 NATIVE_DEFINES+=$(if $(wildcard /usr/lib64),-DCONFIG_LDDIR=\"lib64\")
 NATIVE_DEFINES+=$(if $(wildcard 
/lib/x86_64-linux-gnu),-DCONFIG_MULTIARCHDIR=\"x86_64-linux-gnu\")
 NATIVE_DEFINES+=$(if $(wildcard 
/lib/x86_64-kfreebsd-gnu),-DCONFIG_MULTIARCHDIR=\"x86_64-kfreebsd-gnu\")
 endif
-endif
 
 ifeq ($(ARCH),arm)
 NATIVE_DEFINES=-DTCC_TARGET_ARM
@@ -73,12 +71,10 @@ NATIVE_DEFINES+=-DWITHOUT_LIBTCC
 ifneq (,$(wildcard /lib/ld-linux.so.3))
 NATIVE_DEFINES+=-DTCC_ARM_EABI
 NATIVE_DEFINES+=$(if $(wildcard /lib/arm-linux-gnueabi), 
-DCONFIG_MULTIARCHDIR=\"arm-linux-gnueabi\")
-else
-ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 
/lib/arm-linux-gnueabihf/ld-linux.so.3))
+else ifneq (,$(wildcard /lib/ld-linux-armhf.so.3 
/lib/arm-linux-gnueabihf/ld-linux.so.3))
 NATIVE_DEFINES+=-DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
 NATIVE_DEFINES+=$(if $(wildcard 
/lib/arm-linux-gnueabihf),-DCONFIG_MULTIARCHDIR=\"arm-linux-gnueabihf\")
 endif
-endif
 NATIVE_DEFINES+=$(if $(shell grep -l "^Features.* \(vfp\|iwmmxt\) " 
/proc/cpuinfo),-DTCC_ARM_VFP)
 endif
 
@@ -134,35 +130,27 @@ NATIVE_FILES=$(WIN64_FILES)
 PROGS_CROSS=$(WIN32_CROSS) $(I386_CROSS) $(X64_CROSS) $(ARM_CROSS) $(C67_CROSS)
 LIBTCC1_CROSS=lib/i386-win32/libtcc1.a
 LIBTCC1=libtcc1.a
-else
-ifdef CONFIG_WIN32
+else ifdef CONFIG_WIN32
 PROGS+=tiny_impdef$(EXESUF) tiny_libmaker$(EXESUF)
 NATIVE_FILES=$(WIN32_FILES)
 PROGS_CROSS=$(WIN64_CROSS) $(I386_CROSS) $(X64_CROSS) $(ARM_CROSS) $(C67_CROSS)
 LIBTCC1_CROSS=lib/x86_64-win32/libtcc1.a
 LIBTCC1=libtcc1.a
-else
-ifeq ($(ARCH),i386)
+else ifeq ($(ARCH),i386)
 NATIVE_FILES=$(I386_FILES)
 PROGS_CROSS=$(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) 
$(C67_CROSS)
 LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a
 LIBTCC1=libtcc1.a
 BCHECK_O=bcheck.o
-else
-ifeq ($(ARCH),x86-64)
+else ifeq ($(ARCH),x86-64)
 NATIVE_FILES=$(X86_64_FILES)
 PROGS_CROSS=$(I386_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) 
$(C67_CROSS)
 LIBTCC1_CROSS=lib/i386-win32/libtcc1.a lib/x86_64-win32/libtcc1.a 
lib/i386/libtcc1.a
 LIBTCC1=libtcc1.a
-else
-ifeq ($(ARCH),arm)
+else ifeq ($(ARCH),arm)
 NATIVE_FILES=$(ARM_FILES)
 PROGS_CROSS=$(I386_CROSS) $(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) 
$(C67_CROSS)
 endif
-endif
-endif
-endif
-endif
 
 ifdef CONFIG_UCLIBC
 BCHECK_O=

commit 7667a8887a4449b65af3138db39e9f018dd3a92b
Author: Akim Demaille <address@hidden>
Date:   Fri Dec 21 14:17:23 2012 +0100

    build: fix out-of-tree build
    
    * Makefile (TCC-VERSION): Use top_srcdir.

diff --git a/Makefile b/Makefile
index 6a49dff..a227452 100644
--- a/Makefile
+++ b/Makefile
@@ -375,7 +375,7 @@ config.mak:
 
 # create release tarball from *current* git branch (including tcc-doc.html
 # and converting two files to CRLF)
-TCC-VERSION := tcc-$(shell cat VERSION)
+TCC-VERSION := tcc-$(shell cat $(top_srcdir)/VERSION)
 tar:    tcc-doc.html
        mkdir $(TCC-VERSION)
        ( cd $(TCC-VERSION) && git --git-dir ../.git checkout -f )

commit e79281f58ec302e8cc9dfc7d00e06f426fcd2acd
Author: Akim Demaille <address@hidden>
Date:   Fri Dec 21 14:23:28 2012 +0100

    build: fix out-of-tree install
    
    Makefile (install): Fix installation of headers.
    Do not try to install twice libtcc.h, once should be enough.

diff --git a/Makefile b/Makefile
index a227452..f35bdff 100644
--- a/Makefile
+++ b/Makefile
@@ -275,15 +275,13 @@ endif
 ifneq ($(BCHECK_O),)
        $(INSTALL) -m644 $(BCHECK_O) "$(tccdir)"
 endif
-       $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) 
"$(tccdir)/include"
+       $(INSTALL) -m644 $(addprefix $(top_srcdir)/include/,$(TCC_INCLUDES)) 
"$(tccdir)/include"
        mkdir -p "$(libdir)"
        $(INSTALL) -m755 $(LIBTCC) "$(libdir)"
 ifdef DISABLE_STATIC
        ln -sf "$(ln_libdir)/libtcc.so.1.0" "$(libdir)/libtcc.so.1"
        ln -sf "$(ln_libdir)/libtcc.so.1.0" "$(libdir)/libtcc.so"
 endif
-       mkdir -p "$(includedir)"
-       $(INSTALL) -m644 libtcc.h "$(includedir)"
        mkdir -p "$(docdir)"
        -$(INSTALL) -m644 tcc-doc.html "$(docdir)"
 ifdef CONFIG_CROSS




reply via email to

[Prev in Thread] Current Thread [Next in Thread]