summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Makefile53
-rw-r--r--programs/Makefile37
-rw-r--r--tests/Makefile2
3 files changed, 61 insertions, 31 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 2b47fb0..f9fad29 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -42,11 +42,6 @@ LIBVER := $(shell echo $(LIBVER_SCRIPT))
BUILD_STATIC:= yes
-DESTDIR ?=
-PREFIX ?= /usr/local
-LIBDIR ?= $(PREFIX)/lib
-INCLUDEDIR=$(PREFIX)/include
-
CPPFLAGS+= -DXXH_NAMESPACE=LZ4_
CFLAGS ?= -O3
DEBUGFLAGS:=-g -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
@@ -107,10 +102,30 @@ clean:
@echo Cleaning library completed
-#------------------------------------------------------------------------
-#make install is validated only for Linux, OSX, kFreeBSD, Hurd and
-#FreeBSD targets
-ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD))
+#-----------------------------------------------------------------------------
+# make install is validated only for Linux, OSX, BSD, Hurd and Solaris targets
+#-----------------------------------------------------------------------------
+ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS))
+
+ifneq (,$(filter $(shell uname),SunOS))
+PREFIX ?= /usr
+INSTALL ?= ginstall
+else
+PREFIX ?= /usr/local
+INSTALL ?= install
+endif
+DESTDIR ?=
+LIBDIR ?= $(PREFIX)/lib
+INCLUDEDIR=$(PREFIX)/include
+
+ifneq (,$(filter $(shell uname),OpenBSD FreeBSD NetBSD DragonFly))
+PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig
+else
+PKGCONFIGDIR ?= $(LIBDIR)/pkgconfig
+endif
+
+INSTALL_LIB ?= $(INSTALL) -m 755
+INSTALL_DATA ?= $(INSTALL) -m 644
liblz4.pc: liblz4.pc.in Makefile
@echo creating pkgconfig
@@ -121,17 +136,19 @@ liblz4.pc: liblz4.pc.in Makefile
$< >$@
install: lib liblz4.pc
- @install -d -m 755 $(DESTDIR)$(LIBDIR)/pkgconfig/ $(DESTDIR)$(INCLUDEDIR)/
- @install -m 755 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)
- @install -m 644 liblz4.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
+ @$(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/ $(DESTDIR)$(INCLUDEDIR)/
+ @$(INSTALL_DATA) liblz4.pc $(DESTDIR)$(PKGCONFIGDIR)/
+ @echo Installing libraries
ifeq ($(BUILD_STATIC),yes)
- @install -m 644 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
+ @$(INSTALL_LIB) liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
endif
- @install -m 644 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
- @install -m 644 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
- @install -m 644 lz4frame.h $(DESTDIR)$(INCLUDEDIR)/lz4frame.h
+ @$(INSTALL_LIB) 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
+ @$(INSTALL_DATA) -m 644 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
+ @$(INSTALL_DATA) -m 644 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
+ @$(INSTALL_DATA) -m 644 lz4frame.h $(DESTDIR)$(INCLUDEDIR)/lz4frame.h
@echo lz4 static and shared libraries installed
uninstall:
diff --git a/programs/Makefile b/programs/Makefile
index 5f14ad7..f91a326 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -38,10 +38,6 @@ LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
LIBVER := $(shell echo $(LIBVER_SCRIPT))
-DESTDIR ?=
-PREFIX ?= /usr/local
-BINDIR := $(PREFIX)/bin
-MANDIR := $(PREFIX)/share/man/man1
LZ4DIR := ../lib
VOID := /dev/null
@@ -107,10 +103,10 @@ preview-man: clean-man man
man ./lz4.1
-#------------------------------------------------------------------------
-#make install is validated only for Linux, OSX, kFreeBSD, FreeBSD, Hurd and
-#Solaris targets
-ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD SunOS))
+#-----------------------------------------------------------------------------
+# make install is validated only for Linux, OSX, BSD, Hurd and Solaris targets
+#-----------------------------------------------------------------------------
+ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS))
unlz4: lz4
ln -s lz4 unlz4
@@ -118,15 +114,32 @@ unlz4: lz4
lz4cat: lz4
ln -s lz4 lz4cat
+
+ifneq (,$(filter $(shell uname),SunOS))
+PREFIX ?= /usr
+INSTALL ?= ginstall
+else
+PREFIX ?= /usr/local
+INSTALL ?= install
+endif
+DESTDIR ?=
+BINDIR = $(PREFIX)/bin
+MANDIR = $(PREFIX)/share/man/man1
+
+INSTALL_PROGRAM ?= $(INSTALL) -m 755
+INSTALL_SCRIPT ?= $(INSTALL) -m 755
+INSTALL_MAN ?= $(INSTALL) -m 644
+
+
install: lz4$(EXT) lz4c$(EXT)
@echo Installing binaries
- @install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/
- @install -m 755 lz4 $(DESTDIR)$(BINDIR)/lz4
+ @$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/
+ @$(INSTALL_PROGRAM) lz4 $(DESTDIR)$(BINDIR)/lz4
@ln -sf lz4 $(DESTDIR)$(BINDIR)/lz4cat
@ln -sf lz4 $(DESTDIR)$(BINDIR)/unlz4
- @install -m 755 lz4c$(EXT) $(DESTDIR)$(BINDIR)/lz4c
+ @$(INSTALL_PROGRAM) lz4c$(EXT) $(DESTDIR)$(BINDIR)/lz4c
@echo Installing man pages
- @install -m 644 lz4.1 $(DESTDIR)$(MANDIR)/lz4.1
+ @$(INSTALL_MAN) -m 644 lz4.1 $(DESTDIR)$(MANDIR)/lz4.1
@ln -sf lz4.1 $(DESTDIR)$(MANDIR)/lz4c.1
@ln -sf lz4.1 $(DESTDIR)$(MANDIR)/lz4cat.1
@ln -sf lz4.1 $(DESTDIR)$(MANDIR)/unlz4.1
diff --git a/tests/Makefile b/tests/Makefile
index d23ed46..1b92718 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -122,7 +122,7 @@ versionsTest:
#------------------------------------------------------------------------
#make test is validated only for Linux, OSX, kFreeBSD, FreeBSD, Hurd and
#Solaris targets
-ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD SunOS))
+ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS))
MD5:=md5sum
ifneq (,$(filter $(shell uname), Darwin ))