diff options
Diffstat (limited to 'programs/Makefile')
-rw-r--r-- | programs/Makefile | 69 |
1 files changed, 40 insertions, 29 deletions
diff --git a/programs/Makefile b/programs/Makefile index c1053f6..ace0d03 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -1,6 +1,6 @@ # ########################################################################## # LZ4 programs - Makefile -# Copyright (C) Yann Collet 2011-2017 +# Copyright (C) Yann Collet 2011-2020 # # This Makefile is validated for Linux, macOS, *BSD, Hurd, Solaris, MSYS2 targets # @@ -28,13 +28,14 @@ # lz4c : CLU, supporting also legacy lz4demo arguments # lz4c32: Same as lz4c, but forced to compile in 32-bits mode # ########################################################################## +SED = sed # Version numbers LZ4DIR := ../lib LIBVER_SRC := $(LZ4DIR)/lz4.h -LIBVER_MAJOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` -LIBVER_MINOR_SCRIPT:=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` -LIBVER_PATCH_SCRIPT:=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` +LIBVER_MAJOR_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` +LIBVER_MINOR_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` +LIBVER_PATCH_SCRIPT:=`$(SED) -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT) LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT)) LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) @@ -51,16 +52,26 @@ DEBUGFLAGS= -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow \ -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes \ -Wpointer-arith -Wstrict-aliasing=1 CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) + +include ../Makefile.inc + +OS_VERSION ?= $(UNAME) -r +ifeq ($(TARGET_OS)$(shell $(OS_VERSION)),SunOS5.10) +LDFLAGS += -lrt +endif + FLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) LZ4_VERSION=$(LIBVER) MD2ROFF = ronn MD2ROFF_FLAGS = --roff --warnings --manual="User Commands" --organization="lz4 $(LZ4_VERSION)" -include ../Makefile.inc default: lz4-release +# silent mode by default; verbose can be triggered by V=1 or VERBOSE=1 +$(V)$(VERBOSE).SILENT: + all: lz4 lz4c all32: CFLAGS+=-m32 @@ -69,7 +80,7 @@ all32: all ifeq ($(WINBASED),yes) lz4-exe.rc: lz4-exe.rc.in @echo creating executable resource - $(Q)sed -e 's|@PROGNAME@|lz4|' \ + $(SED) -e 's|@PROGNAME@|lz4|' \ -e 's|@LIBVER_MAJOR@|$(LIBVER_MAJOR)|g' \ -e 's|@LIBVER_MINOR@|$(LIBVER_MINOR)|g' \ -e 's|@LIBVER_PATCH@|$(LIBVER_PATCH)|g' \ @@ -110,7 +121,7 @@ lz4c32 : $(SRCFILES) $(CC) $(FLAGS) $^ -o $@$(EXT) lz4.1: lz4.1.md $(LIBVER_SRC) - cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | sed -n '/^\.\\\".*/!p' > $@ + cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | $(SED) -n '/^\.\\\".*/!p' > $@ man: lz4.1 @@ -122,10 +133,10 @@ preview-man: clean-man man clean: ifeq ($(WINBASED),yes) - $(Q)$(RM) *.rc + $(RM) *.rc endif - @$(MAKE) -C $(LZ4DIR) $@ > $(VOID) - @$(RM) core *.o *.test tmp* \ + $(MAKE) -C $(LZ4DIR) $@ > $(VOID) + $(RM) core *.o *.test tmp* \ lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) lz4-wlib$(EXT) \ unlz4$(EXT) lz4cat$(EXT) @echo Cleaning completed @@ -160,28 +171,28 @@ MAN1DIR ?= $(mandir)/man1 man1dir ?= $(MAN1DIR) install: lz4 - @echo Installing binaries - @$(INSTALL_DIR) $(DESTDIR)$(bindir)/ $(DESTDIR)$(man1dir)/ - @$(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT) - @$(LN_S) lz4$(EXT) $(DESTDIR)$(bindir)/lz4c$(EXT) - @$(LN_S) lz4$(EXT) $(DESTDIR)$(bindir)/lz4cat$(EXT) - @$(LN_S) lz4$(EXT) $(DESTDIR)$(bindir)/unlz4$(EXT) - @echo Installing man pages - @$(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1 - @$(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4c.1 - @$(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4cat.1 - @$(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/unlz4.1 + @echo Installing binaries in $(DESTDIR)$(bindir) + $(INSTALL_DIR) $(DESTDIR)$(bindir)/ $(DESTDIR)$(man1dir)/ + $(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT) + $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4c$(EXT) + $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4cat$(EXT) + $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/unlz4$(EXT) + @echo Installing man pages in $(DESTDIR)$(man1dir) + $(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1 + $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4c.1 + $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4cat.1 + $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/unlz4.1 @echo lz4 installation completed uninstall: - @$(RM) $(DESTDIR)$(bindir)/lz4cat$(EXT) - @$(RM) $(DESTDIR)$(bindir)/unlz4$(EXT) - @$(RM) $(DESTDIR)$(bindir)/lz4$(EXT) - @$(RM) $(DESTDIR)$(bindir)/lz4c$(EXT) - @$(RM) $(DESTDIR)$(man1dir)/lz4.1 - @$(RM) $(DESTDIR)$(man1dir)/lz4c.1 - @$(RM) $(DESTDIR)$(man1dir)/lz4cat.1 - @$(RM) $(DESTDIR)$(man1dir)/unlz4.1 + $(RM) $(DESTDIR)$(bindir)/lz4cat$(EXT) + $(RM) $(DESTDIR)$(bindir)/unlz4$(EXT) + $(RM) $(DESTDIR)$(bindir)/lz4$(EXT) + $(RM) $(DESTDIR)$(bindir)/lz4c$(EXT) + $(RM) $(DESTDIR)$(man1dir)/lz4.1 + $(RM) $(DESTDIR)$(man1dir)/lz4c.1 + $(RM) $(DESTDIR)$(man1dir)/lz4cat.1 + $(RM) $(DESTDIR)$(man1dir)/unlz4.1 @echo lz4 programs successfully uninstalled endif |