diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 39 |
1 files changed, 25 insertions, 14 deletions
@@ -30,7 +30,7 @@ # - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c # ################################################################ -export RELEASE=r114 +export RELEASE=r115 LIBVER_MAJOR=1 LIBVER_MINOR=0 LIBVER_PATCH=0 @@ -54,6 +54,16 @@ else EXT = endif +# OS X linker doesn't support -soname, and use different extension +# see : https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html +ifeq ($(shell uname), Darwin) + SONAME_FLAGS = + SHARED_EXT = dylib +else + SONAME_FLAGS = -Wl,-soname=liblz4.$(SHARED_EXT).$(LIBVER_MAJOR) + SHARED_EXT = so +endif + TEXT = lz4.c lz4.h lz4hc.c lz4hc.h \ lz4_format_description.txt Makefile NEWS LICENSE \ cmake_unofficial/CMakeLists.txt \ @@ -71,7 +81,7 @@ default: liblz4 all: liblz4 lz4programs -liblz4: liblz4.a liblz4.so +liblz4: liblz4.a liblz4.$(SHARED_EXT) lz4programs: lz4.c lz4hc.c @cd $(PRGDIR); $(MAKE) -e all @@ -80,14 +90,14 @@ liblz4.a: lz4.c lz4hc.c $(CC) $(CFLAGS) -c $^ ar rcs liblz4.a lz4.o lz4hc.o -liblz4.so: lz4.c lz4hc.c - $(CC) $(CFLAGS) -shared $^ -fPIC -Wl,-soname=liblz4.so.$(LIBVER_MAJOR) -o $@.$(LIBVER) +liblz4.$(SHARED_EXT): lz4.c lz4hc.c + $(CC) $(CFLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(LIBVER) @ln -s $@.$(LIBVER) $@.$(LIBVER_MAJOR) @ln -s $@.$(LIBVER) $@ clean: - @rm -f core *.o *.a *.so *.so.* $(DISTRIBNAME) - @cd $(PRGDIR); make clean + @rm -f core *.o *.a *.$(SHARED_EXT) *.$(SHARED_EXT).* $(DISTRIBNAME) *.sha1 + @cd $(PRGDIR); $(MAKE) clean @echo Cleaning completed @@ -97,23 +107,23 @@ ifneq (,$(filter $(shell uname),Linux Darwin)) install: liblz4 @install -d -m 755 $(DESTDIR)$(LIBDIR)/ $(DESTDIR)$(INCLUDEDIR)/ @install -m 755 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a - @install -m 755 liblz4.so.$(LIBVER) $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER) - @install -m 755 liblz4.so.$(LIBVER_MAJOR) $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER_MAJOR) - @install -m 755 liblz4.so $(DESTDIR)$(LIBDIR)/liblz4.so + @install -m 755 liblz4.$(SHARED_EXT).$(LIBVER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT).$(LIBVER) + @cp -a liblz4.$(SHARED_EXT).$(LIBVER_MAJOR) $(DESTDIR)$(LIBDIR) + @cp -a liblz4.$(SHARED_EXT) $(DESTDIR)$(LIBDIR) @install -m 755 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h @install -m 755 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h @echo lz4 static and shared library installed - @cd $(PRGDIR); make install + @cd $(PRGDIR); $(MAKE) -e install uninstall: [ -x $(DESTDIR)$(LIBDIR)/liblz4.a ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.a - [ -x $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER) ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER) - [ -x $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER_MAJOR) ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER_MAJOR) - [ -x $(DESTDIR)$(LIBDIR)/liblz4.so ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so + rm -f $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT) + rm -f $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT).$(LIBVER_MAJOR) + [ -x $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT).$(LIBVER) ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT).$(LIBVER) [ -f $(DESTDIR)$(INCLUDEDIR)/lz4.h ] && rm -f $(DESTDIR)$(INCLUDEDIR)/lz4.h [ -f $(DESTDIR)$(INCLUDEDIR)/lz4hc.h ] && rm -f $(DESTDIR)$(INCLUDEDIR)/lz4hc.h @echo lz4 libraries successfully uninstalled - @cd $(PRGDIR); make uninstall + @cd $(PRGDIR); $(MAKE) uninstall dist: clean @install -dD -m 700 lz4-$(RELEASE)/programs/ @@ -128,6 +138,7 @@ dist: clean done @tar -czf $(DISTRIBNAME) lz4-$(RELEASE)/ @rm -rf lz4-$(RELEASE) + @sha1sum $(DISTRIBNAME) > $(DISTRIBNAME).sha1 @echo Distribution $(DISTRIBNAME) built endif |