From: Emanuele Rocca <ema@debian.org>
Date: Fri, 15 Feb 2019 14:35:46 -0500
Subject: Include CFLAGS and LDFLAGS in Makefile

This patch modifies the Makefile to build this package with flags set by
dpkg-buildflags.
---
 Makefile | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 8687b61..2a197d8 100644
--- a/Makefile
+++ b/Makefile
@@ -20,19 +20,19 @@ endif
 LIBHEAD		= $(DIST).h
 TARGETS		= $(LIBTARGET)
 
-INSTBASEDIR	= /usr/local
-INSTLIBDIR	= $(INSTBASEDIR)/lib
-INSTINCDIR	= $(INSTBASEDIR)/include
+DESTDIR		?=
+INSTBASEDIR	?= /usr/local
+INSTLIBDIR	= $(DESTDIR)/$(INSTBASEDIR)/lib
+INSTINCDIR	= $(DESTDIR)/$(INSTBASEDIR)/include
 INSTALL		= install -m 644
 INSTALLPROG	= install -m 755
 MKDIRP		= install -d -m 755
 
 CC		= gcc
-OPTIM		= -O2
 
 INCDIR		= -I.
 
-CCOPT		= -s -Wall $(OPTIM) $(INCDIR)
+CCOPT		= -s -Wall $(CFLAGS) $(INCDIR) -D_REENTRANT
 
 # Object files to store in the library
 LIBOBJS		= shhopt.o
@@ -45,7 +45,7 @@ all: $(TARGETS)
 # separately.  This error is harmless.
 $(LIBTARGET): $(LIBOBJS)
 ifeq ($(SHARED),1)
-	$(CC) -shared -Wl,-soname,$(LIBTARGETSOMAJ) -o $(LIBTARGET) $(LIBOBJS)
+	$(CC) -shared -Wl,-soname,$(LIBTARGETSOMAJ) -o $(LIBTARGET) $(LIBOBJS) $(LDFLAGS)
 else
 	ar rc $(LIBTARGET) $(LIBOBJS)
 	ranlib $(LIBTARGET) || true
