From 910bbc2cb6cc1cfa6deed9d170da02a639902c7c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 19 Mar 2017 16:14:54 -0700
Subject: [PATCH 1/2] makefile: Fix build on linux

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending

 Makefile | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

Index: libexecinfo-1.1/Makefile
===================================================================
--- libexecinfo-1.1.orig/Makefile
+++ libexecinfo-1.1/Makefile
@@ -23,24 +23,25 @@
 # SUCH DAMAGE.
 #
 # $Id: Makefile,v 1.3 2004/07/19 05:19:55 sobomax Exp $
+#
+# Linux Makefile by Matt Smith <mcs@darkregion.net>, 2011/01/04
 
-LIB=	execinfo
-
-SRCS=	stacktraverse.c stacktraverse.h execinfo.c execinfo.h
-
-INCS=	execinfo.h
-
-SHLIB_MAJOR=	1
-SHLIB_MINOR=	0
-
-NOPROFILE=	yes
-
-DPADD=		${LIBM}
-LDADD=		-lm
-
-#WARNS?=	4
-
-#stacktraverse.c: gen.py
-#	./gen.py > stacktraverse.c
+CC?=cc
+AR?=ar
+EXECINFO_CFLAGS=$(CFLAGS) -O2 -pipe -fno-strict-aliasing -std=gnu99 -fstack-protector -c
+EXECINFO_LDFLAGS=$(LDFLAGS)
+
+all: static dynamic
+
+static:
+	$(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c
+	$(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c
+	$(AR) rcs libexecinfo.a stacktraverse.o execinfo.o
+
+dynamic:
+	$(CC) -fpic -DPIC $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c -o stacktraverse.So
+	$(CC) -fpic -DPIC $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c -o execinfo.So
+	$(CC) -shared -Wl,-soname,libexecinfo.so.1 -o libexecinfo.so.1 $(EXECINFO_LDFLAGS) stacktraverse.So execinfo.So
 
-.include <bsd.lib.mk>
+clean:
+	rm -rf *.o *.So *.a *.so
