--- Makefile.orig	2008-10-10 10:59:55.000000000 +0200
+++ Makefile	2009-01-26 12:27:47.000000000 +0100
@@ -9,16 +9,16 @@
 
 # BINDIR: where the Scid programs are copied for "make install".
 #
-BINDIR = /usr/local/bin
+BINDIR = ${PREFIX}/bin
 
 # SHAREDIR: where scid.eco is copied for "make install".
 #
-SHAREDIR = /usr/local/share/scid
+SHAREDIR = ${PREFIX}/share/scid
 
 ### TCL_VERSION: Set this according to the version of Tcl/Tk you have
 #   installed that you want Scid to use: 8.0, 8.1, 8.2, 8.3, etc.
 #
-TCL_VERSION = 8.5
+TCL_VERSION = ${TCL_VER}
 
 # TCL_INCLUDE, TCL_LIBRARY, TK_LIBRARY: these are the compiler options
 #    needed for linking Scid with Tcl/Tk.  The program "./configure"
@@ -27,9 +27,9 @@
 #
 # The settings determined by "./configure" are:
 #
-TCL_INCLUDE = -I/usr/local/ActiveTcl8.5/include
-TCL_LIBRARY = -L/usr/local/ActiveTcl8.5/lib -ltcl$(TCL_VERSION) -ldl
-TK_LIBRARY  = $(TCL_LIBRARY) -ltk$(TCL_VERSION) -L/usr/lib -lX11
+#TCL_INCLUDE = -I/usr/local/ActiveTcl8.5/include
+#TCL_LIBRARY = -L/usr/local/ActiveTcl8.5/lib -ltcl$(TCL_VERSION) -ldl
+#TK_LIBRARY  = $(TCL_LIBRARY) -ltk$(TCL_VERSION) -L/usr/lib -lX11
 
 ### Here are other commonly used settings for the Tcl/Tk compiler options:
 
@@ -54,6 +54,9 @@
 # TCL_INCLUDE = -I /usr/local/include/tcl8.0 -I /usr/local/include/tk8.0
 # TCL_LIBRARY = -L /usr/local/lib -ltcl80 -ldl
 # TK_LIBRARY  = $(TCL_LIBRARY) -ltk80 -L /usr/X11/lib -lX11
+TCL_INCLUDE = -I${TCL_INCLUDEDIR} -I${TK_INCLUDEDIR} -I${LOCALBASE}/include
+TCL_LIBRARY = -L${LOCALBASE}/lib -ltcl${TCL_LIBVER}${TCL_THREADS_SUFFIX} ${PTHREAD_LIBS}
+TK_LIBRARY  = $(TCL_LIBRARY) -ltk${TCL_LIBVER}${TCL_THREADS_SUFFIX} -L${LOCALBASE}/lib -lX11 ${PTHREAD_LIBS}
 
 
 ########################################
@@ -71,7 +74,7 @@
 #      to include the code in the src/zlib directory.
 #      The default is to use the system zlib library.
 #
-SCIDFLAGS =  -DZLIB
+#SCIDFLAGS =  -DZLIB
 
 ### OPTIMIZE: Optimization options for C++ compiler.
 #      -O4 is the most optimization for g++. I have found -O2 to do
@@ -80,7 +83,7 @@
 #      On some systems, adding "-fno-rtti" and "-fno-exceptions" produces
 #      smaller, faster programs since Scid does not use those C++ features.
 #
-OPTIMIZE = -O4 -fno-rtti -fno-exceptions
+OPTIMIZE = ${CXXFLAGS} -fno-rtti -fno-exceptions
 
 ### DEBUG: Defining the macro ASSERTIONS will turn on assertions, which
 #       helps to track bugs after modifications, but the programs will run 
@@ -91,7 +94,7 @@
 ### WARNINGS: I always compile with all warnings on (-Wall), and all the
 #       files should compile warning-free using g++.
 #
-WARNINGS = -Wall
+WARNINGS =
 
 ### PROFILE: Set this to "-pg" for profiling in g++ and gcc.
 #
@@ -143,15 +146,15 @@
 
 ### ZLIBOBJS: object files in the zlib compression library.
 #
-ZLIBOBJS= src/zlib/adler32.o src/zlib/compress.o src/zlib/crc32.o \
-      src/zlib/gzio.o src/zlib/uncompr.o src/zlib/deflate.o src/zlib/trees.o \
-      src/zlib/zutil.o src/zlib/inflate.o src/zlib/infblock.o \
-      src/zlib/inftrees.o src/zlib/infcodes.o src/zlib/infutil.o \
-      src/zlib/inffast.o
+#ZLIBOBJS= src/zlib/adler32.o src/zlib/compress.o src/zlib/crc32.o \
+#      src/zlib/gzio.o src/zlib/uncompr.o src/zlib/deflate.o src/zlib/trees.o \
+#      src/zlib/zutil.o src/zlib/inflate.o src/zlib/infblock.o \
+#      src/zlib/inftrees.o src/zlib/infcodes.o src/zlib/infutil.o \
+#      src/zlib/inffast.o
        
 ### ZLIB: Should be "-lz" if your system has zlib, "" otherwise.
 #
-ZLIB = 
+ZLIB = -lz
 
 ### OBJS: Will be "$(SCIDOBJS)", "$(POLYGLOTOBJS)", and also "$(ZLIBOBJS)" if they are
 #      needed on your system.
