--- makefile.orig	Sun Sep 21 11:19:30 2003
+++ makefile	Tue Oct  7 10:52:28 2003
@@ -8,8 +8,8 @@
 # To force GTK+ 1 build, define GTK1 on the make command line.
 
 .SUFFIXES: .cxx .o .h .a
-CC = g++
-AR = ar
+CC ?= g++
+AR = $(CC) -shared
 RANLIB = touch
 
 ifeq ($(OSTYPE),darwin)
@@ -18,7 +18,8 @@
 RANLIB = ranlib
 endif
 
-COMPLIB=../bin/scintilla.a
+COMPLIB=../bin/libscintilla.so.1
+LEXRLIB=../bin/libscintilla_lexers.so.1
 
 vpath %.h ../src ../include
 vpath %.cxx ../src
@@ -33,29 +34,29 @@
 endif
 
 ifdef DEBUG
-CXXFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS)
+CXXFLAGS+=-DDEBUG $(CXXBASEFLAGS) $(THREADFLAGS)
 else
-CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
+CXXFLAGS+=-DNDEBUG $(CXXBASEFLAGS) $(THREADFLAGS)
 endif
 
 # If explicit setting of GTK1 or GTK2 then use that else look for
 # pkg-config which is an OK indication that GTK2 is available
 ifdef GTK2
-CONFIGFLAGS=pkg-config --cflags gtk+-2.0
+CONFIGFLAGS=pkg-config --cflags gtk+-2.0 gthread-2.0
 else
 ifdef GTK1
-CONFIGFLAGS=gtk-config --cflags
+CONFIGFLAGS=pkg-config --cflags gtk+ gthread
 else
 ifneq (,$(findstring /,$(shell whereis -b pkg-config)))
-CONFIGFLAGS=pkg-config --cflags gtk+-2.0
+CONFIGFLAGS=pkg-config --cflags gtk+-2.0 gthread-2.0
 else
-CONFIGFLAGS=gtk-config --cflags
+CONFIGFLAGS=gtk-config --cflags gthread
 endif
 endif
 endif
 
 .cxx.o:
-	$(CC) `$(CONFIGFLAGS)` $(CXXFLAGS) -c $<
+	$(CC) -DPIC -fpic `$(CONFIGFLAGS)` $(CXXFLAGS) -c $<
 
 #++Autogenerated -- run src/LexGen.py to regenerate
 #**LEXOBJS=\\\n\(\*.o \)
@@ -69,7 +70,7 @@
 
 # The LEXOBJS have to be treated specially as the functions in them are not called from external code
 
-all: $(COMPLIB) $(LEXOBJS)
+all: $(COMPLIB) $(LEXRLIB)
 
 clean:
 	rm -f *.o $(COMPLIB)
@@ -81,8 +82,10 @@
 	ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSet.o PlatGTK.o \
 	KeyMap.o LineMarker.o ScintillaGTK.o CellBuffer.o ViewStyle.o \
 	RESearch.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o
-	$(AR) rc $@ $^
-	$(RANLIB) $@
+	$(AR) `$(CONFIGFLAGS:cflags=libs)` -o $@ $^
+
+ $(LEXRLIB): $(LEXOBJS)
+	$(AR) `$(CONFIGFLAGS:cflags=libs)` -o $@ $^
 
 # Automatically generate header dependencies with "make deps"
 include deps.mak
