--- makefile.orig	Wed Dec 24 08:45:12 2003
+++ makefile	Sun Jan 11 19:50:44 2004
@@ -8,15 +8,16 @@
 # 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 ($(shell uname),Darwin)
 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
@@ -31,29 +32,29 @@
 endif
 
 ifdef DEBUG
-CXXFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS)
+CXXFLAGS+=-DDEBUG -g $(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 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 gtk+ 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 \)
@@ -66,7 +67,7 @@
 LexYAML.o
 #--Autogenerated -- end of automatically generated section
 
-all: $(COMPLIB)
+all: $(COMPLIB) $(LEXRLIB)
 
 clean:
 	rm -f *.o $(COMPLIB)
@@ -77,10 +78,11 @@
 $(COMPLIB): DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o Document.o CallTip.o \
 	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 \
-	$(LEXOBJS)
-	$(AR) rc $@ $^
-	$(RANLIB) $@
+	RESearch.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o
+	$(AR) `$(CONFIGFLAGS:cflags=libs)` -o $@ $^
+
+$(LEXRLIB): $(LEXOBJS)
+	$(AR) `$(CONFIGFLAGS:cflags=libs)` -o $@ $^
 
 # Automatically generate header dependencies with "make deps"
 include deps.mak
