summaryrefslogtreecommitdiffstats
path: root/programs/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'programs/Makefile')
-rw-r--r--programs/Makefile38
1 files changed, 20 insertions, 18 deletions
diff --git a/programs/Makefile b/programs/Makefile
index c7ef6d1..ed1a779 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -1,6 +1,6 @@
# ##########################################################################
# LZ4 programs - Makefile
-# Copyright (C) Yann Collet 2011-2016
+# Copyright (C) Yann Collet 2011-2017
#
# This Makefile is validated for Linux, macOS, *BSD, Hurd, Solaris, MSYS2 targets
#
@@ -41,14 +41,14 @@ LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
LIBVER := $(shell echo $(LIBVER_SCRIPT))
-SRCFILES := $(wildcard $(LZ4DIR)/*.c) $(wildcard *.c)
-OBJFILES := $(patsubst %.c,%.o,$(SRCFILES))
+SRCFILES := $(sort $(wildcard $(LZ4DIR)/*.c) $(wildcard *.c))
+OBJFILES := $(SRCFILES:.c=.o)
CPPFLAGS += -I$(LZ4DIR) -DXXH_NAMESPACE=LZ4_
CFLAGS ?= -O3
DEBUGFLAGS:=-Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow \
- -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes \
- -Wpointer-arith -Wstrict-aliasing=1
+ -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes \
+ -Wpointer-arith -Wstrict-aliasing=1
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
FLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
@@ -81,13 +81,13 @@ lz4: $(OBJFILES)
lz4-release: DEBUGFLAGS=
lz4-release: lz4
+lz4c: lz4
+ ln -s lz4 lz4c
+
lz4c32: CFLAGS += -m32
lz4c32 : $(SRCFILES)
$(CC) $(FLAGS) $^ -o $@$(EXT)
-lz4c: lz4
- ln -s lz4 lz4c
-
lz4.1: lz4.1.md
cat $^ | $(MD2ROFF) $(MD2ROFF_FLAGS) | sed -n '/^\.\\\".*/!p' > $@
@@ -117,14 +117,9 @@ unlz4: lz4
lz4cat: lz4
ln -s lz4 lz4cat
-ifneq (,$(filter $(shell uname),SunOS))
-INSTALL ?= ginstall
-else
-INSTALL ?= install
-endif
-
DESTDIR ?=
-# directory variables : GNU convention prefers lowercase
+# directory variables : GNU conventions prefer lowercase
+# see https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
# support both lower and uppercase (BSD), use uppercase in script
prefix ?= /usr/local
PREFIX ?= $(prefix)
@@ -133,24 +128,31 @@ bindir ?= $(exec_prefix)/bin
BINDIR ?= $(bindir)
datarootdir ?= $(PREFIX)/share
mandir ?= $(datarootdir)/man
+man1dir ?= $(mandir)/man1
ifneq (,$(filter $(shell uname),OpenBSD FreeBSD NetBSD DragonFly SunOS))
MANDIR ?= $(PREFIX)/man/man1
else
-MANDIR ?= $(mandir)
+MANDIR ?= $(man1dir)
+endif
+
+ifneq (,$(filter $(shell uname),SunOS))
+INSTALL ?= ginstall
+else
+INSTALL ?= install
endif
INSTALL_PROGRAM ?= $(INSTALL) -m 755
INSTALL_DATA ?= $(INSTALL) -m 644
-install: lz4$(EXT) lz4c$(EXT)
+install: lz4
@echo Installing binaries
@$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/
@$(INSTALL_PROGRAM) lz4 $(DESTDIR)$(BINDIR)/lz4
+ @ln -sf lz4 $(DESTDIR)$(BINDIR)/lz4c
@ln -sf lz4 $(DESTDIR)$(BINDIR)/lz4cat
@ln -sf lz4 $(DESTDIR)$(BINDIR)/unlz4
- @$(INSTALL_PROGRAM) lz4c$(EXT) $(DESTDIR)$(BINDIR)/lz4c
@echo Installing man pages
@$(INSTALL_DATA) lz4.1 $(DESTDIR)$(MANDIR)/lz4.1
@ln -sf lz4.1 $(DESTDIR)$(MANDIR)/lz4c.1