$OpenBSD: patch-Makefile,v 1.5 2017/04/12 08:07:22 ajacoutot Exp $
--- Makefile.orig	Thu Mar  9 19:17:23 2017
+++ Makefile	Sun Apr  9 14:28:28 2017
@@ -17,8 +17,8 @@ CONFIG_LOCALVERSION =
 
 CPPFLAGS = -I libfdt -I .
 WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
-	-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow
-CFLAGS = -g -Os -fPIC -Werror $(WARNINGS)
+	-Wstrict-prototypes -Wmissing-prototypes -Wshadow
+CFLAGS += -fPIC $(WARNINGS)
 
 BISON = bison
 LEX = flex
@@ -38,7 +38,7 @@ SHAREDLIB_EXT=dylib
 SHAREDLIB_LINK_OPTIONS=-dynamiclib -Wl,-install_name -Wl,
 else
 SHAREDLIB_EXT=so
-SHAREDLIB_LINK_OPTIONS=-shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
+SHAREDLIB_LINK_OPTIONS=-shared -Wl,--version-script=$(LIBFDT_version)
 endif
 
 #
@@ -134,7 +134,7 @@ endif
 LIBFDT_objdir = libfdt
 LIBFDT_srcdir = libfdt
 LIBFDT_archive = $(LIBFDT_objdir)/libfdt.a
-LIBFDT_lib = $(LIBFDT_objdir)/libfdt-$(DTC_VERSION).$(SHAREDLIB_EXT)
+LIBFDT_lib = $(LIBFDT_objdir)/libfdt.$(SHAREDLIB_EXT).${libfdt_ltversion}
 LIBFDT_include = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_INCLUDES))
 LIBFDT_version = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_VERSION))
 
@@ -169,8 +169,6 @@ install-lib: all
 	@$(VECHO) INSTALL-LIB
 	$(INSTALL) -d $(DESTDIR)$(LIBDIR)
 	$(INSTALL) $(LIBFDT_lib) $(DESTDIR)$(LIBDIR)
-	ln -sf $(notdir $(LIBFDT_lib)) $(DESTDIR)$(LIBDIR)/$(LIBFDT_soname)
-	ln -sf $(LIBFDT_soname) $(DESTDIR)$(LIBDIR)/libfdt.$(SHAREDLIB_EXT)
 	$(INSTALL) -m 644 $(LIBFDT_archive) $(DESTDIR)$(LIBDIR)
 
 install-includes:
@@ -254,12 +252,12 @@ clean: libfdt_clean tests_clean
 # Generic compile rules
 #
 %: %.o
-	@$(VECHO) LD $@
+	@$(VECHO) LD $(LDFLAGS) $@
 	$(LINK.c) -o $@ $^
 
 %.o: %.c
 	@$(VECHO) CC $@
-	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+	$(CC) $(CPPFLAGS) $(LDFLAGS) $(CFLAGS) -o $@ -c $<
 
 %.o: %.S
 	@$(VECHO) AS $@
@@ -287,7 +285,7 @@ clean: libfdt_clean tests_clean
 
 $(LIBFDT_lib):
 	@$(VECHO) LD $@
-	$(CC) $(LDFLAGS) -fPIC $(SHAREDLIB_LINK_OPTIONS)$(LIBFDT_soname) -o $(LIBFDT_lib) $^
+	$(CC) $(LDFLAGS) -fPIC $(SHAREDLIB_LINK_OPTIONS) -o $(LIBFDT_lib) $^
 
 %.lex.c: %.l
 	@$(VECHO) LEX $@
