$OpenBSD: patch-gtk_makefile,v 1.7 2008/03/22 11:44:42 steven Exp $
--- gtk/makefile.orig	Fri Jan 18 23:18:13 2008
+++ gtk/makefile	Sat Mar 22 12:30:08 2008
@@ -7,7 +7,7 @@
 # To force GTK+ 2 build, define GTK2 on the make command line.
 # To force GTK+ 1 build, define GTK1 on the make command line.
 
-.SUFFIXES: .cxx .c .o .h .a
+.SUFFIXES: .cxx .c .o .h .a .so
 CC = g++
 CCOMP = gcc
 AR = ar
@@ -17,13 +17,16 @@ ifeq ($(shell uname),Darwin)
 RANLIB = ranlib
 endif
 
-COMPLIB=../bin/scintilla.a
+COMPLIB=../bin/libscintilla.a
+LEXERLIB=../bin/libscintilla_lexers.a
+SHAREDLIB=../bin/libscintilla.so.${LIBscintilla_VERSION}
+SHAREDLEXER=../bin/libscintilla_lexers.so.${LIBscintilla_lexers_VERSION}
 
 vpath %.h ../src ../include
 vpath %.cxx ../src
 
-INCLUDEDIRS=-I ../include -I ../src
-CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -pedantic -Os -DGTK -DSCI_LEXER $(INCLUDEDIRS)
+INCLUDEDIRS=-I ../include -I ../src -I /usr/local/include
+CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -pedantic -DGTK -DSCI_LEXER -Dunix $(INCLUDEDIRS)
 
 ifdef NOTHREADS
 THREADFLAGS=-DG_THREADS_IMPL_NONE
@@ -34,7 +37,7 @@ endif
 ifdef DEBUG
 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
@@ -56,9 +59,13 @@ endif
 endif
 
 .cxx.o:
-	$(CC) $(CONFIGFLAGS) $(CXXFLAGS) -c $<
+	$(CXX) $(CONFIGFLAGS) $(CXXFLAGS) -c $<
+.cxx.so:
+	$(CXX) -fPIC $(CONFIGFLAGS) $(CXXFLAGS) -o $@ -c $<
 .c.o:
 	$(CCOMP) $(CONFIGFLAGS) $(CXXFLAGS) -w -c $<
+.c.so:
+	$(CCOMP) -fPIC $(CONFIGFLAGS) $(CXXFLAGS) -w -o $@ -c $<
 
 #++Autogenerated -- run src/LexGen.py to regenerate
 #**LEXOBJS=\\\n\(\*.o \)
@@ -75,22 +82,52 @@ LexRuby.o LexScriptol.o LexSmalltalk.o LexSpecman.o Le
 LexTADS3.o LexTCL.o LexTeX.o LexVB.o LexVerilog.o LexVHDL.o LexYAML.o
 #--Autogenerated -- end of automatically generated section
 
-all: $(COMPLIB)
+ifeq (${NO_SHARED_LIBS},"yes")
+all: static
+else
+all: static shared
+endif
 
+static: $(COMPLIB) $(LEXERLIB)
+shared: $(SHAREDLIB) $(SHAREDLEXER)
+
+install: install-shared
+	mkdir -p ${PREFIX}/include/scintilla
+	install -m 444 ../include/*.h ${PREFIX}/include/scintilla
+	install -m 444 ${COMPLIB} ${LEXERLIB} ${PREFIX}/lib
+
+ifeq (${NO_SHARED_LIBS},"yes")
+install-shared:
+else
+install-shared:
+	install -m 444 ${SHAREDLIB} ${SHAREDLEXER} ${PREFIX}/lib
+endif
+
 clean:
 	rm -f *.o $(COMPLIB)
 
 deps:
-	$(CC) -MM $(CONFIGFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak
+	$(CXX) -MM $(CONFIGFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak
 
-$(COMPLIB): DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o \
+LIBOBJS = DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o \
 	CharClassify.o Decoration.o Document.o CallTip.o \
 	ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSet.o PlatGTK.o \
 	KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o ViewStyle.o \
 	RESearch.o RunStyles.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
 	$(MARSHALLER) $(LEXOBJS)
+
+$(COMPLIB): $(LIBOBJS)
 	$(AR) rc $@ $^
 	$(RANLIB) $@
+
+$(LEXERLIB): $(LEXOBJS)
+	$(AR) rc $@ $^
+	$(RANLIB) $@
+
+$(SHAREDLIB): $(addsuffix .so,$(basename $(LIBOBJS)))
+	$(CXX) -shared -fPIC -o $@ -Wl,-soname,$(notdir $(SHAREDLIB)) $^
+$(SHAREDLEXER): $(addsuffix .so,$(basename $(LEXOBJS)))
+	$(CXX) -shared -fPIC -o $@ -Wl,-soname,$(notdir $(SHAREDLEXER)) $^
 
 # Automatically generate header dependencies with "make deps"
 include deps.mak
