diff options
author | Yann Collet <cyan@fb.com> | 2017-08-14 22:13:23 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2017-08-14 22:13:23 (GMT) |
commit | aea7d521aed2506270a14d8e901ea657d6a1faf4 (patch) | |
tree | d1a8b349374df28713f574862adc8b6182557c0e /lib | |
parent | 228e26ee63818c22ea9c4aff0eb47d82306d44e5 (diff) | |
download | lz4-aea7d521aed2506270a14d8e901ea657d6a1faf4.zip lz4-aea7d521aed2506270a14d8e901ea657d6a1faf4.tar.gz lz4-aea7d521aed2506270a14d8e901ea657d6a1faf4.tar.bz2 |
better respect GNU standard Makefile conventions
supports lowercase directory variables
add an "Installation" section in README.md
added an INSTALL file
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/lib/Makefile b/lib/Makefile index de5c4ff..9abb699 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -60,7 +60,7 @@ ifeq ($(shell uname), Darwin) SHARED_EXT = dylib SHARED_EXT_MAJOR = $(LIBVER_MAJOR).$(SHARED_EXT) SHARED_EXT_VER = $(LIBVER).$(SHARED_EXT) - SONAME_FLAGS = -install_name $(PREFIX)/lib/liblz4.$(SHARED_EXT_MAJOR) -compatibility_version $(LIBVER_MAJOR) -current_version $(LIBVER) + SONAME_FLAGS = -install_name $(LIBDIR)/liblz4.$(SHARED_EXT_MAJOR) -compatibility_version $(LIBVER_MAJOR) -current_version $(LIBVER) else SONAME_FLAGS = -Wl,-soname=liblz4.$(SHARED_EXT).$(LIBVER_MAJOR) SHARED_EXT = so @@ -115,16 +115,16 @@ clean: #----------------------------------------------------------------------------- ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS)) -ifneq (,$(filter $(shell uname),SunOS)) -INSTALL ?= ginstall -else -INSTALL ?= install -endif - -PREFIX ?= /usr/local -DESTDIR ?= -LIBDIR ?= $(PREFIX)/lib -INCLUDEDIR ?= $(PREFIX)/include +DESTDIR ?= +# directory variables : GNU convention prefers lowercase +# support both lower and uppercase (BSD), use uppercase in script +prefix ?= /usr/local +PREFIX ?= $(prefix) +exec_prefix ?= $(PREFIX) +libdir ?= $(exec_prefix)/lib +LIBDIR ?= $(libdir) +includedir ?= $(PREFIX)/include +INCLUDEDIR ?= $(includedir) ifneq (,$(filter $(shell uname),OpenBSD FreeBSD NetBSD DragonFly)) PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig @@ -132,8 +132,14 @@ else PKGCONFIGDIR ?= $(LIBDIR)/pkgconfig endif -INSTALL_LIB ?= $(INSTALL) -m 755 -INSTALL_DATA ?= $(INSTALL) -m 644 +ifneq (,$(filter $(shell uname),SunOS)) +INSTALL ?= ginstall +else +INSTALL ?= install +endif + +INSTALL_PROGRAM ?= $(INSTALL) +INSTALL_DATA ?= $(INSTALL) -m 644 liblz4.pc: liblz4.pc.in Makefile @echo creating pkgconfig @@ -148,17 +154,17 @@ install: lib liblz4.pc @$(INSTALL_DATA) liblz4.pc $(DESTDIR)$(PKGCONFIGDIR)/ @echo Installing libraries ifeq ($(BUILD_STATIC),yes) - @$(INSTALL_LIB) liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a + @$(INSTALL_DATA) liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a @$(INSTALL_DATA) lz4frame_static.h $(DESTDIR)$(INCLUDEDIR)/lz4frame_static.h endif - @$(INSTALL_LIB) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR) + @$(INSTALL_PROGRAM) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR) @ln -sf liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT_MAJOR) @ln -sf liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT) - @echo Installing includes + @echo Installing headers in $(INCLUDEDIR) @$(INSTALL_DATA) lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h @$(INSTALL_DATA) lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h @$(INSTALL_DATA) lz4frame.h $(DESTDIR)$(INCLUDEDIR)/lz4frame.h - @echo lz4 static and shared libraries installed + @echo lz4 libraries installed uninstall: @$(RM) $(DESTDIR)$(LIBDIR)/pkgconfig/liblz4.pc |