Skip to content

Instantly share code, notes, and snippets.

@adsr
Created February 26, 2018 00:51
Show Gist options
  • Select an option

  • Save adsr/7b49777f07e131dfd868629d087fabf9 to your computer and use it in GitHub Desktop.

Select an option

Save adsr/7b49777f07e131dfd868629d087fabf9 to your computer and use it in GitHub Desktop.
diff --git a/Makefile b/Makefile
index 28c6009..38954d7 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,11 @@ PCRE_LDLIBS ?= -lpcre
LDLIBS ?=
LDLIBS += $(PCRE_LDLIBS)
+SONAME := -soname
+ifeq ($(shell uname -s),Darwin)
+ SONAME := -install_name
+endif
+
libname := libmlbuf
lib_ver_cur := 1
lib_ver_rev := 0
@@ -23,7 +28,7 @@ objs := $(srcs:.c=.o)
all: $(libname).so $(libname).a
$(libname).so: $(objs)
- $(CCLD) $(LDFLAGS) -Wl,-soname,$(libname).so.$(lib_ver_cur) -o $(libname).so.$(lib_ver) $(objs) $(LDLIBS)
+ $(CCLD) $(LDFLAGS) -Wl,$(SONAME),$(libname).so.$(lib_ver_cur) -o $(libname).so.$(lib_ver) $(objs) $(LDLIBS)
$(LN) -s $(libname).so.$(lib_ver) $(libname).so.$(lib_ver_cur).$(lib_ver_rev)
$(LN) -s $(libname).so.$(lib_ver) $(libname).so.$(lib_ver_cur)
$(LN) -s $(libname).so.$(lib_ver) $(libname).so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment