$OpenBSD: patch-Makefile_gnu,v 1.3 2018/11/19 18:46:16 naddy Exp $
Index: Makefile.gnu
--- Makefile.gnu.orig
+++ Makefile.gnu
@@ -5,13 +5,13 @@ include Makefile.srcs
 
 # General configuration variables:
 DESTDIR ?= /
-INCDIR ?= $(DESTDIR)/usr/include
-INSTALLDIR ?= $(DESTDIR)/usr/lib
+INCDIR ?= $(PREFIX)/include
+INSTALLDIR ?= $(PREFIX)/lib
 
 # Converts cr/lf to just lf
 DOS2UNIX = dos2unix
 
-LIBRARIES = -lstdc++
+LIBRARIES = 
 
 MODULES = $(SRCS:.c=.o)
 MODULES := $(MODULES:.cpp=.o)
@@ -20,16 +20,13 @@ CFLAGS += $(INCLUDE)
 CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
 CXXFLAGS += $(INCLUDE)
 
-ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
-	CFLAGS += -fPIC
-	CXXFLAGS += -fPIC
-endif
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
 
 TARGET  = freeimage
 STATICLIB = lib$(TARGET).a
-SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
+SHAREDLIB = lib$(TARGET).so.$(LIBfreeimage_VERSION)
 LIBNAME	= lib$(TARGET).so
-VERLIBNAME = $(LIBNAME).$(VER_MAJOR)
 HEADER = Source/FreeImage.h
 
 
@@ -40,7 +37,7 @@ all: dist
 
 dist: FreeImage
 	cp *.a Dist
-	cp *.so Dist
+	cp *.so.* Dist
 	cp Source/FreeImage.h Dist
 
 dos2unix:
@@ -58,16 +55,13 @@ $(STATICLIB): $(MODULES)
 	$(AR) r $@ $(MODULES)
 
 $(SHAREDLIB): $(MODULES)
-	$(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+	$(CXX) $(CXXFLAGS) -shared $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
 
 install:
 	install -d $(INCDIR) $(INSTALLDIR)
-	install -m 644 -o root -g root $(HEADER) $(INCDIR)
-	install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
-	install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
-	ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
-	ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)	
-	ldconfig
+	install -m 644 -o root -g bin $(HEADER) $(INCDIR)
+	install -m 644 -o root -g bin $(STATICLIB) $(INSTALLDIR)
+	install -m 755 -o root -g bin $(SHAREDLIB) $(INSTALLDIR)
 
 clean:
 	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
