The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/zstd/programs/Makefile

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 # ################################################################
    2 # Copyright (c) Yann Collet, Facebook, Inc.
    3 # All rights reserved.
    4 #
    5 # This source code is licensed under both the BSD-style license (found in the
    6 # LICENSE file in the root directory of this source tree) and the GPLv2 (found
    7 # in the COPYING file in the root directory of this source tree).
    8 # You may select, at your option, one of the above-listed licenses.
    9 # ##########################################################################
   10 # zstd : Command Line Utility, supporting gzip-like arguments
   11 # zstd32 : Same as zstd, but forced to compile in 32-bits mode
   12 # zstd-nolegacy : zstd without support of decompression of legacy versions
   13 # zstd-small : minimal zstd without dictionary builder and benchmark
   14 # zstd-compress : compressor-only version of zstd
   15 # zstd-decompress : decompressor-only version of zstd
   16 # ##########################################################################
   17 
   18 .PHONY: default
   19 default: zstd-release
   20 
   21 LIBZSTD := ../lib
   22 
   23 include $(LIBZSTD)/libzstd.mk
   24 
   25 ifeq ($(shell $(CC) -v 2>&1 | $(GREP) -c "gcc version "), 1)
   26   ALIGN_LOOP = -falign-loops=32
   27 else
   28   ALIGN_LOOP =
   29 endif
   30 
   31 ZSTDLIB_COMMON_SRC := $(sort $(ZSTD_COMMON_FILES))
   32 ZSTDLIB_COMPRESS_SRC := $(sort $(ZSTD_COMPRESS_FILES))
   33 ZSTDLIB_DECOMPRESS_SRC := $(sort $(ZSTD_DECOMPRESS_FILES))
   34 ZSTDLIB_CORE_SRC := $(sort $(ZSTD_DECOMPRESS_FILES) $(ZSTD_COMMON_FILES) $(ZSTD_COMPRESS_FILES))
   35 ZDICT_SRC := $(sort $(ZSTD_DICTBUILDER_FILES))
   36 ZSTDLEGACY_SRC := $(sort $(ZSTD_LEGACY_FILES))
   37 
   38 # Sort files in alphabetical order for reproducible builds
   39 ZSTDLIB_FULL_SRC = $(sort $(ZSTDLIB_CORE_SRC) $(ZSTDLEGACY_SRC) $(ZDICT_SRC))
   40 ZSTDLIB_LOCAL_SRC = $(notdir $(ZSTDLIB_FULL_SRC))
   41 ZSTDLIB_LOCAL_OBJ0 := $(ZSTDLIB_LOCAL_SRC:.c=.o)
   42 ZSTDLIB_LOCAL_OBJ := $(ZSTDLIB_LOCAL_OBJ0:.S=.o)
   43 
   44 ZSTD_CLI_SRC := $(sort $(wildcard *.c))
   45 ZSTD_CLI_OBJ := $(ZSTD_CLI_SRC:.c=.o)
   46 
   47 ZSTD_ALL_SRC = $(ZSTDLIB_LOCAL_SRC) $(ZSTD_CLI_SRC)
   48 ZSTD_ALL_OBJ0 := $(ZSTD_ALL_SRC:.c=.o)
   49 ZSTD_ALL_OBJ := $(ZSTD_ALL_OBJ0:.S=.o)
   50 
   51 # Define *.exe as extension for Windows systems
   52 ifneq (,$(filter Windows%,$(OS)))
   53   EXT =.exe
   54   RES64_FILE = windres/zstd64.res
   55   RES32_FILE = windres/zstd32.res
   56 ifneq (,$(filter x86_64%,$(shell $(CC) -dumpmachine)))
   57     RES_FILE = $(RES64_FILE)
   58 else
   59     RES_FILE = $(RES32_FILE)
   60 endif
   61 else
   62   EXT =
   63 endif
   64 
   65 # thread detection
   66 NO_THREAD_MSG := ==> no threads, building without multithreading support
   67 HAVE_PTHREAD := $(shell printf '$(NUM_SYMBOL)include <pthread.h>\nint main(void) { return 0; }' > have_pthread.c && $(CC) $(FLAGS) -o have_pthread$(EXT) have_pthread.c -pthread 2> $(VOID) && rm have_pthread$(EXT) && echo 1 || echo 0; rm have_pthread.c)
   68 HAVE_THREAD := $(shell [ "$(HAVE_PTHREAD)" -eq "1" -o -n "$(filter Windows%,$(OS))" ] && echo 1 || echo 0)
   69 ifeq ($(HAVE_THREAD), 1)
   70   THREAD_MSG := ==> building with threading support
   71   THREAD_CPP := -DZSTD_MULTITHREAD
   72   THREAD_LD := -pthread
   73 else
   74   THREAD_MSG := $(NO_THREAD_MSG)
   75 endif
   76 
   77 # zlib detection
   78 NO_ZLIB_MSG := ==> no zlib, building zstd without .gz support
   79 HAVE_ZLIB ?= $(shell printf '$(NUM_SYMBOL)include <zlib.h>\nint main(void) { return 0; }' > have_zlib.c && $(CC) $(FLAGS) -o have_zlib$(EXT) have_zlib.c -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0; rm have_zlib.c)
   80 ifeq ($(HAVE_ZLIB), 1)
   81   ZLIB_MSG := ==> building zstd with .gz compression support
   82   ZLIBCPP = -DZSTD_GZCOMPRESS -DZSTD_GZDECOMPRESS
   83   ZLIBLD = -lz
   84 else
   85   ZLIB_MSG := $(NO_ZLIB_MSG)
   86 endif
   87 
   88 # lzma detection
   89 NO_LZMA_MSG := ==> no liblzma, building zstd without .xz/.lzma support
   90 HAVE_LZMA ?= $(shell printf '$(NUM_SYMBOL)include <lzma.h>\nint main(void) { return 0; }' > have_lzma.c && $(CC) $(FLAGS) -o have_lzma$(EXT) have_lzma.c -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0; rm have_lzma.c)
   91 ifeq ($(HAVE_LZMA), 1)
   92   LZMA_MSG := ==> building zstd with .xz/.lzma compression support
   93   LZMACPP = -DZSTD_LZMACOMPRESS -DZSTD_LZMADECOMPRESS
   94   LZMALD = -llzma
   95 else
   96   LZMA_MSG := $(NO_LZMA_MSG)
   97 endif
   98 
   99 # lz4 detection
  100 NO_LZ4_MSG := ==> no liblz4, building zstd without .lz4 support
  101 HAVE_LZ4 ?= $(shell printf '$(NUM_SYMBOL)include <lz4frame.h>\n$(NUM_SYMBOL)include <lz4.h>\nint main(void) { return 0; }' > have_lz4.c && $(CC) $(FLAGS) -o have_lz4$(EXT) have_lz4.c -llz4 2> $(VOID) && rm have_lz4$(EXT) && echo 1 || echo 0; rm have_lz4.c)
  102 ifeq ($(HAVE_LZ4), 1)
  103   LZ4_MSG := ==> building zstd with .lz4 compression support
  104   LZ4CPP = -DZSTD_LZ4COMPRESS -DZSTD_LZ4DECOMPRESS
  105   LZ4LD = -llz4
  106 else
  107   LZ4_MSG := $(NO_LZ4_MSG)
  108 endif
  109 
  110 # explicit backtrace enable/disable for Linux & Darwin
  111 ifeq ($(BACKTRACE), 0)
  112   DEBUGFLAGS += -DBACKTRACE_ENABLE=0
  113 endif
  114 ifeq (,$(filter Windows%, $(OS)))
  115 ifeq ($(BACKTRACE), 1)
  116   DEBUGFLAGS += -DBACKTRACE_ENABLE=1
  117   DEBUGFLAGS_LD += -rdynamic
  118 endif
  119 endif
  120 
  121 SET_CACHE_DIRECTORY = \
  122    +$(MAKE) --no-print-directory $@ \
  123     BUILD_DIR=obj/$(HASH_DIR) \
  124     CPPFLAGS="$(CPPFLAGS)" \
  125     CFLAGS="$(CFLAGS)" \
  126     LDFLAGS="$(LDFLAGS)" \
  127     LDLIBS="$(LDLIBS)" \
  128     ZSTD_ALL_SRC="$(ZSTD_ALL_SRC)"
  129 
  130 
  131 .PHONY: all
  132 all: zstd
  133 
  134 .PHONY: allVariants
  135 allVariants: zstd zstd-compress zstd-decompress zstd-small zstd-frugal zstd-nolegacy zstd-dictBuilder
  136 
  137 .PHONY: zstd  # must always be run
  138 zstd : CPPFLAGS += $(THREAD_CPP) $(ZLIBCPP) $(LZMACPP) $(LZ4CPP)
  139 zstd : LDFLAGS += $(THREAD_LD) $(DEBUGFLAGS_LD)
  140 zstd : LDLIBS += $(ZLIBLD) $(LZMALD) $(LZ4LD)
  141 zstd : CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT)
  142 ifneq (,$(filter Windows%,$(OS)))
  143 zstd : $(RES_FILE)
  144 endif
  145 
  146 ifndef BUILD_DIR
  147 # generate BUILD_DIR from flags
  148 
  149 zstd:
  150         $(SET_CACHE_DIRECTORY)
  151 
  152 else
  153 # BUILD_DIR is defined
  154 
  155 ZSTD_OBJ := $(addprefix $(BUILD_DIR)/, $(ZSTD_ALL_OBJ))
  156 $(BUILD_DIR)/zstd : $(ZSTD_OBJ)
  157         @echo "$(THREAD_MSG)"
  158         @echo "$(ZLIB_MSG)"
  159         @echo "$(LZMA_MSG)"
  160         @echo "$(LZ4_MSG)"
  161         @echo LINK $@
  162         $(CC) $(FLAGS) $^ $(LDLIBS) -o $@$(EXT)
  163 
  164 ifeq ($(HAVE_HASH),1)
  165 SRCBIN_HASH = $(shell cat $(BUILD_DIR)/zstd$(EXT) 2> $(VOID) | $(HASH) | cut -f 1 -d " ")
  166 DSTBIN_HASH = $(shell cat zstd$(EXT) 2> $(VOID) | $(HASH) | cut -f 1 -d " ")
  167 BIN_ISDIFFERENT = $(if $(filter $(SRCBIN_HASH),$(DSTBIN_HASH)),0,1)
  168 else
  169 BIN_ISDIFFERENT = 1
  170 endif
  171 
  172 zstd : $(BUILD_DIR)/zstd
  173         if [ $(BIN_ISDIFFERENT) -eq 1 ]; then \
  174                 cp -f $<$(EXT) $@$(EXT); \
  175                 echo zstd build completed; \
  176         else \
  177                 echo zstd already built; \
  178         fi
  179 
  180 endif  # BUILD_DIR
  181 
  182 
  183 .PHONY: zstd-release
  184 zstd-release: DEBUGFLAGS := -DBACKTRACE_ENABLE=0
  185 zstd-release: DEBUGFLAGS_LD :=
  186 zstd-release: zstd
  187 
  188 zstd32 : CPPFLAGS += $(THREAD_CPP)
  189 zstd32 : LDFLAGS  += $(THREAD_LD)
  190 zstd32 : CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT)
  191 ifneq (,$(filter Windows%,$(OS)))
  192 zstd32 : $(RES32_FILE)
  193 endif
  194 zstd32 : $(ZSTDLIB_FULL_SRC) $(ZSTD_CLI_SRC)
  195         $(CC) -m32 $(FLAGS) $^ -o $@$(EXT)
  196 
  197 ## zstd-nolegacy: same scope as zstd, with just support of legacy formats removed
  198 zstd-nolegacy : LDFLAGS += $(THREAD_LD) $(ZLIBLD) $(LZMALD) $(LZ4LD) $(DEBUGFLAGS_LD)
  199 zstd-nolegacy : CPPFLAGS += -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0
  200 zstd-nolegacy : $(ZSTDLIB_CORE_SRC) $(ZDICT_SRC) $(ZSTD_CLI_OBJ)
  201         $(CC) $(FLAGS) $^ -o $@$(EXT) $(LDFLAGS)
  202 
  203 .PHONY: zstd-nomt
  204 zstd-nomt : THREAD_CPP :=
  205 zstd-nomt : THREAD_LD  :=
  206 zstd-nomt : THREAD_MSG := - multi-threading disabled
  207 zstd-nomt : zstd
  208 
  209 .PHONY: zstd-nogz
  210 zstd-nogz : ZLIBCPP :=
  211 zstd-nogz : ZLIBLD  :=
  212 zstd-nogz : ZLIB_MSG := - gzip support is disabled
  213 zstd-nogz : zstd
  214 
  215 .PHONY: zstd-noxz
  216 zstd-noxz : LZMACPP :=
  217 zstd-noxz : LZMALD  :=
  218 zstd-noxz : LZMA_MSG := - xz/lzma support is disabled
  219 zstd-noxz : zstd
  220 
  221 ## zstd-dll: zstd executable linked to dynamic library libzstd (must have same version)
  222 .PHONY: zstd-dll
  223 zstd-dll : LDFLAGS+= -L$(LIBZSTD)
  224 zstd-dll : LDLIBS += -lzstd
  225 zstd-dll : ZSTDLIB_LOCAL_SRC = xxhash.c
  226 zstd-dll : zstd
  227 
  228 
  229 ## zstd-pgo: zstd executable optimized with PGO.
  230 .PHONY: zstd-pgo
  231 zstd-pgo :
  232         $(MAKE) clean
  233         $(MAKE) zstd MOREFLAGS=-fprofile-generate
  234         ./zstd -b19i1 $(PROFILE_WITH)
  235         ./zstd -b16i1 $(PROFILE_WITH)
  236         ./zstd -b9i2 $(PROFILE_WITH)
  237         ./zstd -b $(PROFILE_WITH)
  238         ./zstd -b7i2 $(PROFILE_WITH)
  239         ./zstd -b5 $(PROFILE_WITH)
  240         $(RM) zstd *.o
  241         case $(CC) in *clang*) if ! [ -e default.profdata ]; then llvm-profdata merge -output=default.profdata default*.profraw; fi ;; esac
  242         $(MAKE) zstd MOREFLAGS=-fprofile-use
  243 
  244 ## zstd-small: minimal target, supporting only zstd compression and decompression. no bench. no legacy. no other format.
  245 zstd-small: CFLAGS = -Os -s
  246 zstd-frugal zstd-small: $(ZSTDLIB_CORE_SRC) zstdcli.c util.c timefn.c fileio.c
  247         $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOTRACE -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT)
  248 
  249 zstd-decompress: $(ZSTDLIB_COMMON_SRC) $(ZSTDLIB_DECOMPRESS_SRC) zstdcli.c util.c timefn.c fileio.c
  250         $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOCOMPRESS -DZSTD_NOTRACE -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT)
  251 
  252 zstd-compress: $(ZSTDLIB_COMMON_SRC) $(ZSTDLIB_COMPRESS_SRC) zstdcli.c util.c timefn.c fileio.c
  253         $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NODECOMPRESS -DZSTD_NOTRACE -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT)
  254 
  255 ## zstd-dictBuilder: executable supporting dictionary creation and compression (only)
  256 zstd-dictBuilder: $(ZSTDLIB_COMMON_SRC) $(ZSTDLIB_COMPRESS_SRC) $(ZDICT_SRC) zstdcli.c util.c timefn.c fileio.c dibio.c
  257         $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODECOMPRESS -DZSTD_NOTRACE $^ -o $@$(EXT)
  258 
  259 zstdmt: zstd
  260         ln -sf zstd zstdmt
  261 
  262 .PHONY: generate_res
  263 generate_res: $(RES64_FILE) $(RES32_FILE)
  264 
  265 ifneq (,$(filter Windows%,$(OS)))
  266 RC ?= windres
  267 # http://stackoverflow.com/questions/708238/how-do-i-add-an-icon-to-a-mingw-gcc-compiled-executable
  268 $(RES64_FILE): windres/zstd.rc
  269         $(RC) -o $@ -I ../lib -I windres -i $< -O coff -F pe-x86-64
  270 $(RES32_FILE): windres/zstd.rc
  271         $(RC) -o $@ -I ../lib -I windres -i $< -O coff -F pe-i386
  272 endif
  273 
  274 .PHONY: clean
  275 clean:
  276         $(RM) core *.o tmp* result* *.gcda dictionary *.zst \
  277         zstd$(EXT) zstd32$(EXT) zstd-dll$(EXT) \
  278         zstd-compress$(EXT) zstd-decompress$(EXT) \
  279         zstd-small$(EXT) zstd-frugal$(EXT) zstd-nolegacy$(EXT) zstd4$(EXT) \
  280         zstd-dictBuilder$(EXT) \
  281         *.gcda default*.profraw default.profdata have_zlib$(EXT)
  282         $(RM) -r obj/*
  283         @echo Cleaning completed
  284 
  285 MD2ROFF = ronn
  286 MD2ROFF_FLAGS = --roff --warnings --manual="User Commands" --organization="zstd $(ZSTD_VERSION)"
  287 
  288 zstd.1: zstd.1.md ../lib/zstd.h
  289         cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | sed -n '/^\.\\\".*/!p' > $@
  290 
  291 zstdgrep.1: zstdgrep.1.md ../lib/zstd.h
  292         cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | sed -n '/^\.\\\".*/!p' > $@
  293 
  294 zstdless.1: zstdless.1.md ../lib/zstd.h
  295         cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | sed -n '/^\.\\\".*/!p' > $@
  296 
  297 .PHONY: man
  298 man: zstd.1 zstdgrep.1 zstdless.1
  299 
  300 .PHONY: clean-man
  301 clean-man:
  302         $(RM) zstd.1
  303         $(RM) zstdgrep.1
  304         $(RM) zstdless.1
  305 
  306 .PHONY: preview-man
  307 preview-man: clean-man man
  308         man ./zstd.1
  309         man ./zstdgrep.1
  310         man ./zstdless.1
  311 
  312 
  313 # Generate .h dependencies automatically
  314 
  315 DEPFLAGS = -MT $@ -MMD -MP -MF
  316 
  317 $(BUILD_DIR)/%.o : %.c $(BUILD_DIR)/%.d | $(BUILD_DIR)
  318         @echo CC $@
  319         $(COMPILE.c) $(DEPFLAGS) $(BUILD_DIR)/$*.d $(OUTPUT_OPTION) $<
  320 
  321 $(BUILD_DIR)/%.o : %.S | $(BUILD_DIR)
  322         @echo AS $@
  323         $(COMPILE.S) $(OUTPUT_OPTION) $<
  324 
  325 MKDIR ?= mkdir
  326 $(BUILD_DIR): ; $(MKDIR) -p $@
  327 
  328 DEPFILES := $(ZSTD_OBJ:.o=.d)
  329 $(DEPFILES):
  330 
  331 include $(wildcard $(DEPFILES))
  332 
  333 
  334 
  335 #-----------------------------------------------------------------------------
  336 # make install is validated only for Linux, macOS, BSD, Hurd and Solaris targets
  337 #-----------------------------------------------------------------------------
  338 ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX))
  339 
  340 HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
  341 EGREP_OPTIONS ?=
  342 ifeq ($HAVE_COLORNEVER, 1)
  343   EGREP_OPTIONS += --color=never
  344 endif
  345 EGREP = egrep $(EGREP_OPTIONS)
  346 AWK = awk
  347 
  348 # Print a two column output of targets and their description. To add a target description, put a
  349 # comment in the Makefile with the format "## <TARGET>: <DESCRIPTION>".  For example:
  350 #
  351 ## list: Print all targets and their descriptions (if provided)
  352 .PHONY: list
  353 list:
  354         TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \
  355                 | $(AWK) -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
  356                 | $(EGREP) -v  -e '^[^[:alnum:]]' | sort); \
  357         { \
  358             printf "Target Name\tDescription\n"; \
  359             printf "%0.s-" {1..16}; printf "\t"; printf "%0.s-" {1..40}; printf "\n"; \
  360             for target in $$TARGETS; do \
  361                 line=$$($(EGREP) "^##[[:space:]]+$$target:" $(lastword $(MAKEFILE_LIST))); \
  362                 description=$$(echo $$line | $(AWK) '{i=index($$0,":"); print substr($$0,i+1)}' | xargs); \
  363                 printf "$$target\t$$description\n"; \
  364             done \
  365         } | column -t -s $$'\t'
  366 
  367 
  368 DESTDIR     ?=
  369 # directory variables : GNU conventions prefer lowercase
  370 # see https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
  371 # support both lower and uppercase (BSD), use uppercase in script
  372 prefix      ?= /usr/local
  373 PREFIX      ?= $(prefix)
  374 exec_prefix ?= $(PREFIX)
  375 bindir      ?= $(exec_prefix)/bin
  376 BINDIR      ?= $(bindir)
  377 datarootdir ?= $(PREFIX)/share
  378 mandir      ?= $(datarootdir)/man
  379 man1dir     ?= $(mandir)/man1
  380 
  381 ifneq (,$(filter $(UNAME),OpenBSD FreeBSD NetBSD DragonFly SunOS))
  382   MANDIR  ?= $(PREFIX)/man
  383   MAN1DIR ?= $(MANDIR)/man1
  384 else
  385   MAN1DIR ?= $(man1dir)
  386 endif
  387 
  388 ifneq (,$(filter $(UNAME),SunOS))
  389   INSTALL ?= ginstall
  390 else
  391   INSTALL ?= install
  392 endif
  393 
  394 INSTALL_PROGRAM ?= $(INSTALL)
  395 INSTALL_SCRIPT  ?= $(INSTALL_PROGRAM)
  396 INSTALL_DATA    ?= $(INSTALL) -m 644
  397 INSTALL_MAN     ?= $(INSTALL_DATA)
  398 
  399 .PHONY: install
  400 install:
  401         # generate zstd only if not already present
  402         [ -e zstd ] || $(MAKE) zstd-release
  403         [ -e $(DESTDIR)$(BINDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)/
  404         [ -e $(DESTDIR)$(MAN1DIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(MAN1DIR)/
  405         @echo Installing binaries
  406         $(INSTALL_PROGRAM) zstd$(EXT) $(DESTDIR)$(BINDIR)/zstd$(EXT)
  407         ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/zstdcat$(EXT)
  408         ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/unzstd$(EXT)
  409         ln -sf zstd$(EXT) $(DESTDIR)$(BINDIR)/zstdmt$(EXT)
  410         $(INSTALL_SCRIPT) zstdless $(DESTDIR)$(BINDIR)/zstdless
  411         $(INSTALL_SCRIPT) zstdgrep $(DESTDIR)$(BINDIR)/zstdgrep
  412         @echo Installing man pages
  413         $(INSTALL_MAN) zstd.1 $(DESTDIR)$(MAN1DIR)/zstd.1
  414         ln -sf zstd.1 $(DESTDIR)$(MAN1DIR)/zstdcat.1
  415         ln -sf zstd.1 $(DESTDIR)$(MAN1DIR)/unzstd.1
  416         $(INSTALL_MAN) zstdgrep.1 $(DESTDIR)$(MAN1DIR)/zstdgrep.1
  417         $(INSTALL_MAN) zstdless.1 $(DESTDIR)$(MAN1DIR)/zstdless.1
  418         @echo zstd installation completed
  419 
  420 .PHONY: uninstall
  421 uninstall:
  422         $(RM) $(DESTDIR)$(BINDIR)/zstdgrep
  423         $(RM) $(DESTDIR)$(BINDIR)/zstdless
  424         $(RM) $(DESTDIR)$(BINDIR)/zstdcat
  425         $(RM) $(DESTDIR)$(BINDIR)/unzstd
  426         $(RM) $(DESTDIR)$(BINDIR)/zstdmt
  427         $(RM) $(DESTDIR)$(BINDIR)/zstd
  428         $(RM) $(DESTDIR)$(MAN1DIR)/zstdless.1
  429         $(RM) $(DESTDIR)$(MAN1DIR)/zstdgrep.1
  430         $(RM) $(DESTDIR)$(MAN1DIR)/zstdcat.1
  431         $(RM) $(DESTDIR)$(MAN1DIR)/unzstd.1
  432         $(RM) $(DESTDIR)$(MAN1DIR)/zstd.1
  433         @echo zstd programs successfully uninstalled
  434 
  435 endif

Cache object: ddd88785ddf4d78ab53742b3faa8baff


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.