2009-12-07 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / Makefile.am
index 214a0f9f07a91bc821837b1f72f01a76ddeedf0a..0dd0022a74858bea7694f3ae50ba49fce4e96299 100644 (file)
@@ -36,10 +36,12 @@ ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
 AM_CFLAGS = \
        -I$(top_srcdir)         \
        $(LIBGC_CFLAGS)         \
-       $(GLIB_CFLAGS)
+       $(GLIB_CFLAGS)          \
        $(PLATFORM_CFLAGS) $(ARCH_CFLAGS)
 
-if PLATFORM_WIN32
+AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS)
+
+if HOST_WIN32
 export HOST_CC
 # The mingw math.h has "extern inline" functions that dont appear in libs, so
 # optimisation is required to actually inline them
@@ -57,7 +59,7 @@ monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
 monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
 endif
 
-if PLATFORM_WIN32
+if HOST_WIN32
 libmono_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
 else
 libmono_la_LDFLAGS=$(monoldflags)
@@ -65,7 +67,7 @@ endif
 
 if JIT_SUPPORTED
 
-if PLATFORM_WIN32
+if HOST_WIN32
 bin_PROGRAMS = mono monow
 else
 bin_PROGRAMS = mono
@@ -80,6 +82,13 @@ endif
 mono_SOURCES = \
        main.c
 
+# We build this after libmono was built so it contains the date when the final
+# link was done
+buildver.h: libmono-static.la
+       @echo "const char *build_date = \"`date`\";" > buildver.h
+
+main.$(OBJEXT): buildver.h
+
 if DTRACE_G_REQUIRED
 LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
 if STATIC_MONO
@@ -103,26 +112,28 @@ endif
 mono_LDADD = \
        $(MONO_LIB)                     \
        $(GLIB_LIBS)            \
+       $(LLVM_LIBS)            \
        -lm     \
-       $(MONO_DTRACE_OBJECT)
+       $(MONO_DTRACE_OBJECT) \
+       $(LLVM_LDFLAGS)
 
 mono_LDFLAGS = \
-       $(static_flags) -export-dynamic $(monobinldflags)
+       $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
 
 if DTRACE_G_REQUIRED
 
 mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
-       DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/dtrace-prelink.sh \
+       DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
        $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime-static.la mini.lo
 
 .libs/mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime.la
-       DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/dtrace-prelink.sh \
+       DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
        --pic $@ $(top_srcdir)/data/mono.d $(monodir)/mono/metadata/libmonoruntime.la mini.lo
 
 endif
 
 # Create monow.exe, linked for the 'windows' subsystem
-if PLATFORM_WIN32
+if HOST_WIN32
 monow_LDADD = $(mono_LDADD)
 monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
 monow_SOURCES = $(mono_SOURCES)
@@ -187,90 +198,117 @@ s390x_sources = \
        tramp-s390x.c
 
 ia64_sources = \
-       mini-ia64.c                     \
-       mini-ia64.h                     \
+       mini-ia64.c             \
+       mini-ia64.h             \
        exceptions-ia64.c       \
        tramp-ia64.c
 
 alpha_sources = \
-       mini-alpha.c    \
-       mini-alpha.h    \
+       mini-alpha.c            \
+       mini-alpha.h            \
        exceptions-alpha.c      \
        tramp-alpha.c
 
 hppa_sources = \
-       mini-hppa.c     \
-       mini-hppa.h     \
+       mini-hppa.c             \
+       mini-hppa.h             \
        exceptions-hppa.c       \
        tramp-hppa.c
 
+darwin_sources = \
+       mini-darwin.c
+
+windows_sources = \
+       mini-windows.c
+
+posix_sources = \
+       mini-posix.c
+
+if ENABLE_LLVM
+llvm_sources = \
+       mini-llvm.c             \
+       mini-llvm-cpp.cpp
+endif
+
 common_sources = \
-       mini.c          \
-       ir-emit.h       \
-       method-to-ir.c  \
-       decompose.c     \
-       mini.h          \
-       version.h       \
+       mini.c                  \
+       ir-emit.h               \
+       method-to-ir.c          \
+       decompose.c             \
+       mini.h                  \
+       version.h               \
        optflags-def.h          \
-       jit-icalls.h \
-       jit-icalls.c \
-       trace.c         \
-       trace.h         \
-       patch-info.h    \
-       mini-ops.h      \
-       mini-arch.h     \
-       dominators.c    \
-       cfold.c         \
-       regalloc.c      \
-       regalloc.h      \
-       helpers.c       \
-       liveness.c      \
-       ssa.c           \
-       abcremoval.c    \
-       abcremoval.h    \
-       ssapre.c        \
-       ssapre.h        \
-       aliasing.c      \
-       aliasing.h      \
+       jit-icalls.h            \
+       jit-icalls.c            \
+       trace.c                 \
+       trace.h                 \
+       patch-info.h            \
+       mini-ops.h              \
+       mini-arch.h             \
+       dominators.c            \
+       cfold.c                 \
+       regalloc.c              \
+       regalloc.h              \
+       helpers.c               \
+       liveness.c              \
+       ssa.c                   \
+       abcremoval.c            \
+       abcremoval.h            \
+       ssapre.c                \
+       ssapre.h                \
        local-propagation.c     \
-       simple-cee-ops.h \
-       simple-mini-ops.h \
-       driver.c        \
-       debug-mini.c    \
-       debug-mini.h    \
-       linear-scan.c   \
+       driver.c                \
+       debug-mini.c            \
+       debug-mini.h            \
+       linear-scan.c           \
        aot-compiler.c          \
        aot-runtime.c           \
-       graph.c         \
-       mini-exceptions.c       \
+       graph.c                 \
        mini-codegen.c          \
-       mini-trampolines.c  \
-       declsec.c       \
-       declsec.h       \
-       wapihandles.c   \
-       branch-opts.c   \
-       generic-sharing.c       \
-       ssa2.c  \
-       abcremoval2.c   \
-       regalloc2.c
-
-test_sources =                 \
-       basic-calls.cs  \
-       basic-long.cs   \
+       mini-exceptions.c       \
+       mini-trampolines.c      \
+       declsec.c               \
+       declsec.h               \
+       wapihandles.c           \
+       branch-opts.c           \
+       mini-generic-sharing.c  \
+       regalloc2.c             \
+       simd-methods.h          \
+       tasklets.c              \
+       tasklets.h              \
+       simd-intrinsics.c       \
+       unwind.h                \
+       unwind.c                \
+       image-writer.h  \
+       image-writer.c  \
+       dwarfwriter.h   \
+       dwarfwriter.c   \
+       mini-gc.h               \
+       mini-gc.c               \
+       debugger-agent.h \
+       debugger-agent.c
+
+test_sources =                         \
+       basic-calls.cs          \
+       basic-long.cs           \
        bench.cs                \
        objects.cs              \
        arrays.cs               \
-       basic-float.cs  \
-       basic-math.cs   \
+       basic-float.cs          \
+       basic-math.cs           \
        basic.cs                \
-       exceptions.cs   \
+       exceptions.cs           \
        devirtualization.cs     \
        iltests.il.in           \
        test.cs                 \
-       generics.cs     \
-       generics-variant-types.il
+       generics.cs             \
+       generics-variant-types.il\
+       basic-simd.cs
 
 if MONO_DEBUGGER_SUPPORTED
+if PLATFORM_DARWIN
+mono_debugger_arch_sources = mdb-debug-info32-darwin.s
+else
 if AMD64
 mono_debugger_arch_sources = mdb-debug-info64.s
 else
@@ -278,39 +316,40 @@ if X86
 mono_debugger_arch_sources = mdb-debug-info32.s
 endif
 endif
+endif
 mono_debugger_sources = debug-debugger.c debug-debugger.h $(mono_debugger_arch_sources)
 else
 mono_debugger_sources =
 endif
 
-regtests=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe
-
-common_BURGSRC= $(srcdir)/inssel.brg $(srcdir)/inssel-float.brg
+regtests=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe
 
 if X86
 arch_sources = $(x86_sources) $(mono_debugger_sources)
-arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-x86.brg
 arch_built=cpu-x86.h
 arch_define=__i386__
 endif
 
 if AMD64
 arch_sources = $(amd64_sources) $(mono_debugger_sources)
-arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-amd64.brg
 arch_built=cpu-amd64.h
 arch_define=__x86_64__
 endif
 
 if POWERPC
 arch_sources = $(ppc_sources)
-arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-ppc.brg
 arch_built=cpu-ppc.h
 arch_define=__ppc__
 endif
 
+if POWERPC64
+arch_sources = $(ppc_sources)
+arch_built=cpu-ppc64.h
+arch_define=__ppc64__
+endif
+
 if MIPS
 arch_sources = $(mips_sources)
-arch_BURGSRC= $(srcdir)/inssel-long32-mips.brg $(srcdir)/inssel-mips.brg
 arch_built=cpu-mips.h
 arch_define=__mips__
 endif
@@ -319,49 +358,42 @@ if ARM
 # pick up arm_dpimacros.h and arm_fpamacros.h
 ARCH_CFLAGS = -I../arch/arm
 arch_sources = $(arm_sources)
-arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-arm.brg $(srcdir)/inssel-softfloat.brg
 arch_built=cpu-arm.h
 arch_define=__arm__
 endif
 
 if SPARC
 arch_sources = $(sparc_sources)
-arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-sparc.brg
 arch_built=cpu-sparc.h
 arch_define=__sparc__
 endif
 
 if SPARC64
 arch_sources = $(sparc_sources)
-arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-sparc.brg
 arch_built=cpu-sparc.h
 arch_define=__sparc__
 endif
 
 if S390
 arch_sources = $(s390_sources)
-arch_BURGSRC= $(srcdir)/inssel-long32.brg $(srcdir)/inssel-s390.brg
 arch_built=cpu-s390.h
 arch_define=__s390__
 endif
 
 if S390x
 arch_sources = $(s390x_sources)
-arch_BURGSRC= $(srcdir)/inssel-long.brg $(srcdir)/inssel-s390x.brg
 arch_built=cpu-s390x.h
 arch_define=__s390__
 endif
 
 if IA64
 arch_sources = $(ia64_sources)
-arch_BURGSRC = $(srcdir)/inssel-long.brg $(srcdir)/inssel-ia64.brg
 arch_built = cpu-ia64.h
 arch_define=__ia64__
 endif
 
 if ALPHA
 arch_sources = $(alpha_sources) $(mono_debugger_sources)
-arch_BURGSRC = $(srcdir)/inssel-long.brg $(srcdir)/inssel-alpha.brg
 arch_built = cpu-alpha.h
 arch_define=__alpha__
 endif
@@ -369,14 +401,26 @@ endif
 if HPPA
 # Only support 32-bit targets for now
 arch_sources = $(hppa_sources)
-arch_BURGSRC = $(srcdir)/inssel-long32.brg $(srcdir)/inssel-hppa.brg
 arch_built = cpu-hppa.h
 arch_define=__hppa__
 endif
 
-libmono_la_SOURCES = $(common_sources) $(arch_sources)
+if HOST_WIN32
+os_sources = $(windows_sources)
+monobin_platform_ldflags=
+endif
+
+if PLATFORM_SIGPOSIX
+os_sources = $(posix_sources)
+monobin_platform_ldflags=
+endif
+
+if PLATFORM_DARWIN
+os_sources = $(darwin_sources) $(posix_sources)
+monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist
+endif
 
-nodist_libmono_la_SOURCES = inssel.c inssel.h
+libmono_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
 
 libmono_static_la_SOURCES = $(libmono_la_SOURCES)
 nodist_libmono_static_la_SOURCES = $(nodist_libmono_la_SOURCES)
@@ -392,6 +436,9 @@ libmonoinclude_HEADERS = jit.h
 libmono_la_LIBADD = \
        $(libs) $(LIBMONO_DTRACE_OBJECT)
 
+basic-simd.exe: basic-simd.cs
+       $(MCS) -out:$@ $< -r:TestDriver.dll -r:Mono.Simd.dll
+
 generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
        $(MCS) -out:$@ $< -r:TestDriver.dll -r:generics-variant-types.dll
 
@@ -416,46 +463,46 @@ generics-variant-types.dll: generics-variant-types.il
 # $(arch_define) is the preprocessor symbol that enables all the opcodes
 # for the specific platform in mini-ops.h
 if CROSS_COMPILING
-GENMDESC_PRG=perl genmdesc.pl $(arch_define) $(srcdir)
+GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir)
 else !CROSS_COMPILING
 GENMDESC_PRG=./genmdesc
 endif !CROSS_COMPILING
 
 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-x86.md cpu-x86.h x86_desc
+       $(GENMDESC_PRG) cpu-x86.h x86_desc $(srcdir)/cpu-x86.md
 
 cpu-amd64.h: cpu-amd64.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-amd64.md cpu-amd64.h amd64_desc
+       $(GENMDESC_PRG) cpu-amd64.h amd64_desc $(srcdir)/cpu-amd64.md
 
 cpu-ppc.h: cpu-ppc.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-ppc.md cpu-ppc.h ppcg4
+       $(GENMDESC_PRG) cpu-ppc.h ppcg4 $(srcdir)/cpu-ppc.md
+
+cpu-ppc64.h: cpu-ppc64.md genmdesc$(EXEEXT)
+       $(GENMDESC_PRG) cpu-ppc64.h ppc64_cpu_desc $(srcdir)/cpu-ppc64.md
 
 cpu-arm.h: cpu-arm.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-arm.md cpu-arm.h arm_cpu_desc
+       $(GENMDESC_PRG) cpu-arm.h arm_cpu_desc $(srcdir)/cpu-arm.md
 
 cpu-sparc.h: cpu-sparc.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-sparc.md cpu-sparc.h sparc_desc
+       $(GENMDESC_PRG) cpu-sparc.h sparc_desc $(srcdir)/cpu-sparc.md
 
 cpu-s390.h: cpu-s390.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-s390.md cpu-s390.h s390_cpu_desc
+       $(GENMDESC_PRG) cpu-s390.h s390_cpu_desc $(srcdir)/cpu-s390.md
 
 cpu-s390x.h: cpu-s390x.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-s390x.md cpu-s390x.h s390x_cpu_desc
+       $(GENMDESC_PRG) cpu-s390x.h s390x_cpu_desc $(srcdir)/cpu-s390x.md
 
 cpu-ia64.h: cpu-ia64.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-ia64.md cpu-ia64.h ia64_desc
+       $(GENMDESC_PRG) cpu-ia64.h ia64_desc $(srcdir)/cpu-ia64.md
 
 cpu-alpha.h: cpu-alpha.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-alpha.md cpu-alpha.h alpha_desc
+       $(GENMDESC_PRG) cpu-alpha.h alpha_desc $(srcdir)/cpu-alpha.md
 
 cpu-hppa.h: cpu-hppa.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-hppa.md cpu-hppa.h hppa_desc
+       $(GENMDESC_PRG) cpu-hppa.h hppa_desc $(srcdir)/cpu-hppa.md
 
 cpu-mips.h: cpu-mips.md genmdesc$(EXEEXT)
-       $(GENMDESC_PRG) $(srcdir)/cpu-mips.md cpu-mips.h mips_desc
-
-inssel.c inssel.h: $(BURGSRC)
-       $(monodir)/mono/monoburg/monoburg -c 1 -p -e $(BURGSRC) -d inssel.h -s inssel.c
+       $(GENMDESC_PRG) cpu-mips.h mips_desc $(srcdir)/cpu-mips.md
 
 testi: mono test.exe
        $(RUNTIME) -v -v --ncompile 1 --compile Test:$(mtest) test.exe
@@ -468,10 +515,20 @@ rcheck: mono $(regtests)
        $(RUNTIME) --regression $(regtests)
 
 aotcheck: mono $(regtests)
-       for i in $(regtests); do $(RUNTIME) --aot $$i || exit 1; done
+       rm -f *.exe.so
+       $(RUNTIME) --aot $(regtests) || exit 1
        for i in $(regtests); do $(RUNTIME_AOTCHECK) --regression $$i || exit 1; done
        rm -f *.exe.so
 
+# This currently only works on amd64/arm
+fullaotcheck: mono $(regtests)
+       rm -rf fullaot-tmp
+       mkdir fullaot-tmp
+       cp $(CLASS)/mscorlib.dll $(CLASS)/System.Core.dll $(CLASS)/System.dll $(CLASS)/Mono.Posix.dll $(CLASS)/System.Configuration.dll $(CLASS)/System.Security.dll $(CLASS)/System.Xml.dll $(CLASS)/Mono.Security.dll $(CLASS)/Mono.Simd.dll $(regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
+       cp $(regtests) fullaot-tmp/
+       MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --aot=full fullaot-tmp/* || exit 1
+       for i in $(regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i --exclude '!FULLAOT' || exit 1; done
+
 bench: mono test.exe
        time env $(RUNTIME) --ncompile $(count) --compile Test:$(mtest) test.exe
 
@@ -496,44 +553,53 @@ docu: mini.sgm
 check-local: rcheck
 
 clean-local:
-       rm -f mono a.out gmon.out *.o test.exe
+       rm -f mono a.out gmon.out *.o buildver.h test.exe
 
 pkgconfigdir = $(libdir)/pkgconfig
 
 if JIT_SUPPORTED
-BUILT_SOURCES = version.h inssel.c inssel.h $(arch_built)
+BUILT_SOURCES = version.h $(arch_built)
 else
 BUILT_SOURCES = version.h
 endif
 
 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
-EXTRA_DIST = $(common_BURGSRC) cprop.c TestDriver.cs ldscript ldscript.mono \
+EXTRA_DIST = $(common_BURGSRC) TestDriver.cs ldscript ldscript.mono \
        genmdesc.pl     \
        $(test_sources) \
-       inssel-long.brg inssel-long32.brg \
-       inssel-softfloat.brg    \
-       $(x86_sources) inssel-x86.brg cpu-x86.md \
-       $(amd64_sources) inssel-amd64.brg cpu-amd64.md \
-       $(ppc_sources) inssel-ppc.brg cpu-ppc.md \
-       $(arm_sources) inssel-arm.brg cpu-arm.md \
-       $(mips_sources) inssel-mips.brg inssel-long32-mips.brg cpu-mips.md \
-       $(sparc_sources) inssel-sparc.brg cpu-sparc.md \
-       $(s390_sources) inssel-s390.brg cpu-s390.md \
-       $(s390x_sources) inssel-s390x.brg cpu-s390x.md \
-       $(ia64_sources) inssel-ia64.brg cpu-ia64.md \
-       $(alpha_sources) inssel-alpha.brg cpu-alpha.md \
-       $(hppa_sources) inssel-hppa.brg cpu-hppa.md
+       $(x86_sources) cpu-x86.md \
+       $(amd64_sources) cpu-amd64.md \
+       $(ppc_sources) cpu-ppc.md cpu-ppc64.md \
+       $(arm_sources) cpu-arm.md \
+       $(mips_sources) cpu-mips.md \
+       $(sparc_sources) cpu-sparc.md \
+       $(s390_sources) cpu-s390.md \
+       $(s390x_sources) cpu-s390x.md \
+       $(ia64_sources) cpu-ia64.md \
+       $(alpha_sources) cpu-alpha.md \
+       $(hppa_sources) cpu-hppa.md     \
+       $(windows_sources)              \
+       $(darwin_sources) Info.plist    \
+       $(posix_sources)
 
 version.h: Makefile
-       if test -d $(top_srcdir)/.git/svn; then svn_info='git svn info'; fi; \
+       if test -d $(top_srcdir)/.git/svn; then svn_info="git log --no-color --first-parent -n1 --grep=git-svn-id: --pretty=format:%b | sed -n -e 's,git-svn-id: \(.*\)@\(.*\) .*,URL: \1 Revision: \2,p'"; fi; \
        if test -d $(srcdir)/.svn; then svn_info='svn info'; fi; \
        if test -n "$$svn_info"; then \
                (cd $(top_srcdir); \
                        LANG=C; export LANG; \
-                       branch=`$$svn_info | grep URL | sed -e 's/.*source//' -e 's,mono/?$$,,'`; \
-                       version=`$$svn_info | grep Revision | sed 's/.*: //'`; \
+                       branch=`eval $$svn_info | sed -n -e '/URL/ s,.*source/\(.*\)/mono.*,/\1/mono,p'`; \
+                       version=`eval $$svn_info | sed -n -e '/Revision/ s/.*: //p'`; \
                        echo "#define FULL_VERSION \"$$branch r$$version\""; \
                ); \
        else \
                echo "#define FULL_VERSION \"tarball\""; \
        fi > version.h
+
+# Utility target for patching libtool to speed up linking
+patch-libtool:
+       sed -e 's,if (for obj in $$oldobjs,if (for obj in "",g' < ../../libtool > 2; mv 2 ../../libtool
+       chmod a+x ../../libtool
+
+tags:
+       etags -o TAGS `find .. -name "*.h" -o -name "*.c"`