$OpenBSD: patch-Makerules,v 1.5 2012/04/25 13:55:12 sthen Exp $
--- Makerules.orig	Tue Apr 24 17:41:33 2012
+++ Makerules	Wed Apr 25 14:21:09 2012
@@ -5,6 +5,7 @@ OS := $(OS:MINGW%=MINGW)
 
 CFLAGS += -Wall
 
+ifneq "$(OS)" "OpenBSD" # don't override C optimizer flags for ports builds
 ifeq "$(build)" "debug"
 CFLAGS += -pipe -g -DDEBUG
 else ifeq "$(build)" "profile"
@@ -19,6 +20,7 @@ CFLAGS += -pipe -g -DMEMENTO -DDEBUG
 else
 $(error unknown build setting: '$(build)')
 endif
+endif
 
 ifeq "$(OS)" "Linux"
 SYS_FREETYPE_INC := `pkg-config --cflags freetype2`
@@ -29,6 +31,13 @@ ifeq "$(OS)" "FreeBSD"
 SYS_FREETYPE_INC := `pkg-config --cflags freetype2`
 LDFLAGS += -L/usr/local/lib
 X11_LIBS := -lX11 -lXext
+endif
+
+ifeq "$(OS)" "OpenBSD"
+SYS_FREETYPE_INC := `pkg-config --cflags freetype2`
+CFLAGS += -I${LOCALBASE}/include
+LDFLAGS += `pkg-config --libs freetype2` -L${LOCALBASE}/lib
+X11_LIBS = -lX11 -lXext
 endif
 
 # Mac OS X build depends on some thirdparty libs
