1# ################################################################ 2# xxHash Makefile 3# Copyright (C) 2012-2020 Yann Collet 4# 5# GPL v2 License 6# 7# This program is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 2 of the License, or 10# (at your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License along 18# with this program; if not, write to the Free Software Foundation, Inc., 19# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20# 21# You can contact the author at: 22# - xxHash homepage: https://www.xxhash.com 23# - xxHash source repository: https://github.com/Cyan4973/xxHash 24# ################################################################ 25# xxhsum: provides 32/64 bits hash of one or multiple files, or stdin 26# ################################################################ 27Q = $(if $(filter 1,$(V) $(VERBOSE)),,@) 28 29# Version numbers 30SED ?= sed 31SED_ERE_OPT ?= -E 32LIBVER_MAJOR_SCRIPT:=`$(SED) -n '/define XXH_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < xxhash.h` 33LIBVER_MINOR_SCRIPT:=`$(SED) -n '/define XXH_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < xxhash.h` 34LIBVER_PATCH_SCRIPT:=`$(SED) -n '/define XXH_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < xxhash.h` 35LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT)) 36LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) 37LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) 38LIBVER := $(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH) 39 40CFLAGS ?= -O3 41DEBUGFLAGS+=-Wall -Wextra -Wconversion -Wcast-qual -Wcast-align -Wshadow \ 42 -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ 43 -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \ 44 -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ 45 -Wredundant-decls -Wstrict-overflow=2 46CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) 47FLAGS = $(CFLAGS) $(CPPFLAGS) 48XXHSUM_VERSION = $(LIBVER) 49UNAME := $(shell uname) 50 51# Define *.exe as extension for Windows systems 52ifneq (,$(filter Windows%,$(OS))) 53EXT =.exe 54else 55EXT = 56endif 57 58# OS X linker doesn't support -soname, and use different extension 59# see: https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html 60ifeq ($(UNAME), Darwin) 61 SHARED_EXT = dylib 62 SHARED_EXT_MAJOR = $(LIBVER_MAJOR).$(SHARED_EXT) 63 SHARED_EXT_VER = $(LIBVER).$(SHARED_EXT) 64 SONAME_FLAGS = -install_name $(LIBDIR)/libxxhash.$(SHARED_EXT_MAJOR) -compatibility_version $(LIBVER_MAJOR) -current_version $(LIBVER) 65else 66 SONAME_FLAGS = -Wl,-soname=libxxhash.$(SHARED_EXT).$(LIBVER_MAJOR) 67 SHARED_EXT = so 68 SHARED_EXT_MAJOR = $(SHARED_EXT).$(LIBVER_MAJOR) 69 SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER) 70endif 71 72LIBXXH = libxxhash.$(SHARED_EXT_VER) 73 74XXHSUM_SRC_DIR = cli 75XXHSUM_SPLIT_SRCS = $(XXHSUM_SRC_DIR)/xsum_os_specific.c \ 76 $(XXHSUM_SRC_DIR)/xsum_output.c \ 77 $(XXHSUM_SRC_DIR)/xsum_sanity_check.c 78XXHSUM_SPLIT_OBJS = $(XXHSUM_SPLIT_SRCS:.c=.o) 79XXHSUM_HEADERS = $(XXHSUM_SRC_DIR)/xsum_config.h \ 80 $(XXHSUM_SRC_DIR)/xsum_arch.h \ 81 $(XXHSUM_SRC_DIR)/xsum_os_specific.h \ 82 $(XXHSUM_SRC_DIR)/xsum_output.h \ 83 $(XXHSUM_SRC_DIR)/xsum_sanity_check.h 84 85## generate CLI and libraries in release mode (default for `make`) 86.PHONY: default 87default: DEBUGFLAGS= 88default: lib xxhsum_and_links 89 90.PHONY: all 91all: lib xxhsum xxhsum_inlinedXXH 92 93## xxhsum is the command line interface (CLI) 94ifeq ($(DISPATCH),1) 95xxhsum: CPPFLAGS += -DXXHSUM_DISPATCH=1 96xxhsum: xxh_x86dispatch.o 97endif 98xxhsum: xxhash.o xxhsum.o $(XXHSUM_SPLIT_OBJS) 99 $(CC) $(FLAGS) $^ $(LDFLAGS) -o $@$(EXT) 100 101xxhsum32: CFLAGS += -m32 ## generate CLI in 32-bits mode 102xxhsum32: xxhash.c xxhsum.c $(XXHSUM_SPLIT_SRCS) ## do not generate object (avoid mixing different ABI) 103 $(CC) $(FLAGS) $^ $(LDFLAGS) -o $@$(EXT) 104 105## dispatch only works for x86/x64 systems 106dispatch: CPPFLAGS += -DXXHSUM_DISPATCH=1 107dispatch: xxhash.o xxh_x86dispatch.o xxhsum.c $(XXHSUM_SPLIT_SRCS) 108 $(CC) $(FLAGS) $^ $(LDFLAGS) -o $@$(EXT) 109 110xxhash.o: xxhash.c xxhash.h 111xxhsum.o: xxhsum.c $(XXHSUM_HEADERS) \ 112 xxhash.h xxh_x86dispatch.h 113xxh_x86dispatch.o: xxh_x86dispatch.c xxh_x86dispatch.h xxhash.h 114 115.PHONY: xxhsum_and_links 116xxhsum_and_links: xxhsum xxh32sum xxh64sum xxh128sum 117 118xxh32sum xxh64sum xxh128sum: xxhsum 119 ln -sf $<$(EXT) $@$(EXT) 120 121xxhsum_inlinedXXH: CPPFLAGS += -DXXH_INLINE_ALL 122xxhsum_inlinedXXH: xxhsum.c $(XXHSUM_SPLIT_SRCS) 123 $(CC) $(FLAGS) $< -o $@$(EXT) 124 125 126# library 127 128libxxhash.a: ARFLAGS = rcs 129libxxhash.a: xxhash.o 130 $(AR) $(ARFLAGS) $@ $^ 131 132$(LIBXXH): LDFLAGS += -shared 133ifeq (,$(filter Windows%,$(OS))) 134$(LIBXXH): CFLAGS += -fPIC 135endif 136ifeq ($(DISPATCH),1) 137$(LIBXXH): xxh_x86dispatch.c 138endif 139$(LIBXXH): xxhash.c 140 $(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@ 141 ln -sf $@ libxxhash.$(SHARED_EXT_MAJOR) 142 ln -sf $@ libxxhash.$(SHARED_EXT) 143 144.PHONY: libxxhash 145libxxhash: ## generate dynamic xxhash library 146libxxhash: $(LIBXXH) 147 148.PHONY: lib 149lib: ## generate static and dynamic xxhash libraries 150lib: libxxhash.a libxxhash 151 152# helper targets 153 154AWK = awk 155GREP = grep 156SORT = sort 157 158.PHONY: list 159list: ## list all Makefile targets 160 $(Q)$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | $(AWK) -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | $(SORT) | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs 161 162.PHONY: help 163help: ## list documented targets 164 $(Q)$(GREP) -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ 165 $(SORT) | \ 166 $(AWK) 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' 167 168.PHONY: clean 169clean: ## remove all build artifacts 170 $(Q)$(RM) -r *.dSYM # Mac OS-X specific 171 $(Q)$(RM) core *.o *.obj *.$(SHARED_EXT) *.$(SHARED_EXT).* *.a libxxhash.pc 172 $(Q)$(RM) xxhsum$(EXT) xxhsum32$(EXT) xxhsum_inlinedXXH$(EXT) dispatch$(EXT) 173 $(Q)$(RM) xxh32sum$(EXT) xxh64sum$(EXT) xxh128sum$(EXT) 174 $(Q)$(RM) $(XXHSUM_SRC_DIR)/*.o $(XXHSUM_SRC_DIR)/*.obj 175 @echo cleaning completed 176 177 178# ================================================= 179# tests 180# ================================================= 181 182# make check can be run with cross-compiled binaries on emulated environments (qemu user mode) 183# by setting $(RUN_ENV) to the target emulation environment 184.PHONY: check 185check: xxhsum ## basic tests for xxhsum CLI, set RUN_ENV for emulated environments 186 # stdin 187 $(RUN_ENV) ./xxhsum$(EXT) < xxhash.c 188 # multiple files 189 $(RUN_ENV) ./xxhsum$(EXT) xxhash.* xxhsum.* 190 # internal bench 191 $(RUN_ENV) ./xxhsum$(EXT) -bi0 192 # long bench command 193 $(RUN_ENV) ./xxhsum$(EXT) --benchmark-all -i0 194 # bench multiple variants 195 $(RUN_ENV) ./xxhsum$(EXT) -b1,2,3 -i0 196 # file bench 197 $(RUN_ENV) ./xxhsum$(EXT) -bi0 xxhash.c 198 # 32-bit 199 $(RUN_ENV) ./xxhsum$(EXT) -H0 xxhash.c 200 # 128-bit 201 $(RUN_ENV) ./xxhsum$(EXT) -H2 xxhash.c 202 # request incorrect variant 203 $(RUN_ENV) ./xxhsum$(EXT) -H9 xxhash.c ; test $$? -eq 1 204 @printf "\n ....... checks completed successfully ....... \n" 205 206.PHONY: test-unicode 207test-unicode: 208 $(MAKE) -C tests test_unicode 209 210.PHONY: test-mem 211VALGRIND = valgrind --leak-check=yes --error-exitcode=1 212test-mem: RUN_ENV = $(VALGRIND) 213test-mem: xxhsum check 214 215.PHONY: test32 216test32: clean xxhsum32 217 @echo ---- test 32-bit ---- 218 ./xxhsum32 -bi1 xxhash.c 219 220.PHONY: test-xxhsum-c 221test-xxhsum-c: xxhsum 222 # xxhsum to/from pipe 223 ./xxhsum xxh* | ./xxhsum -c - 224 ./xxhsum -H0 xxh* | ./xxhsum -c - 225 # xxhsum -q does not display "Loading" message into stderr (#251) 226 ! ./xxhsum -q xxh* 2>&1 | grep Loading 227 # xxhsum does not display "Loading" message into stderr either 228 ! ./xxhsum xxh* 2>&1 | grep Loading 229 # Check that xxhsum do display filename that it failed to open. 230 LC_ALL=C ./xxhsum nonexistent 2>&1 | grep "Error: Could not open 'nonexistent'" 231 # xxhsum to/from file, shell redirection 232 ./xxhsum xxh* > .test.xxh64 233 ./xxhsum --tag xxh* > .test.xxh64_tag 234 ./xxhsum --little-endian xxh* > .test.le_xxh64 235 ./xxhsum --tag --little-endian xxh* > .test.le_xxh64_tag 236 ./xxhsum -H0 xxh* > .test.xxh32 237 ./xxhsum -H0 --tag xxh* > .test.xxh32_tag 238 ./xxhsum -H0 --little-endian xxh* > .test.le_xxh32 239 ./xxhsum -H0 --tag --little-endian xxh* > .test.le_xxh32_tag 240 ./xxhsum -H2 xxh* > .test.xxh128 241 ./xxhsum -H2 --tag xxh* > .test.xxh128_tag 242 ./xxhsum -H2 --little-endian xxh* > .test.le_xxh128 243 ./xxhsum -H2 --tag --little-endian xxh* > .test.le_xxh128_tag 244 ./xxhsum -c .test.xxh* 245 ./xxhsum -c --little-endian .test.le_xxh* 246 ./xxhsum -c .test.*_tag 247 # read list of files from stdin 248 ./xxhsum -c < .test.xxh64 249 ./xxhsum -c < .test.xxh32 250 cat .test.xxh* | ./xxhsum -c - 251 # check variant with '*' marker as second separator 252 $(SED) 's/ / \*/' .test.xxh32 | ./xxhsum -c 253 # bsd-style output 254 ./xxhsum --tag xxhsum* | $(GREP) XXH64 255 ./xxhsum --tag -H0 xxhsum* | $(GREP) XXH32 256 ./xxhsum --tag -H1 xxhsum* | $(GREP) XXH64 257 ./xxhsum --tag -H2 xxhsum* | $(GREP) XXH128 258 ./xxhsum --tag -H32 xxhsum* | $(GREP) XXH32 259 ./xxhsum --tag -H64 xxhsum* | $(GREP) XXH64 260 ./xxhsum --tag -H128 xxhsum* | $(GREP) XXH128 261 ./xxhsum --tag -H0 --little-endian xxhsum* | $(GREP) XXH32_LE 262 ./xxhsum --tag -H1 --little-endian xxhsum* | $(GREP) XXH64_LE 263 ./xxhsum --tag -H2 --little-endian xxhsum* | $(GREP) XXH128_LE 264 ./xxhsum --tag -H32 --little-endian xxhsum* | $(GREP) XXH32_LE 265 ./xxhsum --tag -H64 --little-endian xxhsum* | $(GREP) XXH64_LE 266 ./xxhsum --tag -H128 --little-endian xxhsum* | $(GREP) XXH128_LE 267 # check bsd-style 268 ./xxhsum --tag xxhsum* | ./xxhsum -c 269 ./xxhsum --tag -H32 --little-endian xxhsum* | ./xxhsum -c 270 # xxhsum -c warns improperly format lines. 271 echo '12345678 ' >>.test.xxh32 272 ./xxhsum -c .test.xxh32 | $(GREP) improperly 273 echo '123456789 file' >>.test.xxh64 274 ./xxhsum -c .test.xxh64 | $(GREP) improperly 275 # Expects "FAILED" 276 echo "0000000000000000 LICENSE" | ./xxhsum -c -; test $$? -eq 1 277 echo "00000000 LICENSE" | ./xxhsum -c -; test $$? -eq 1 278 # Expects "FAILED open or read" 279 echo "0000000000000000 test-expects-file-not-found" | ./xxhsum -c -; test $$? -eq 1 280 echo "00000000 test-expects-file-not-found" | ./xxhsum -c -; test $$? -eq 1 281 @$(RM) .test.* 282 283.PHONY: armtest 284armtest: clean 285 @echo ---- test ARM compilation ---- 286 CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror -static" $(MAKE) xxhsum 287 288.PHONY: clangtest 289clangtest: clean 290 @echo ---- test clang compilation ---- 291 CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion" $(MAKE) all 292 293.PHONY: cxxtest 294cxxtest: clean 295 @echo ---- test C++ compilation ---- 296 CC="$(CXX) -Wno-deprecated" $(MAKE) all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror -fPIC" 297 298.PHONY: c90test 299ifeq ($(NO_C90_TEST),true) 300c90test: 301 @echo no c90 compatibility test 302else 303c90test: CPPFLAGS += -DXXH_NO_LONG_LONG 304c90test: CFLAGS += -std=c90 -Werror -pedantic 305c90test: xxhash.c 306 @echo ---- test strict C90 compilation [xxh32 only] ---- 307 $(RM) xxhash.o 308 $(CC) $(FLAGS) $^ $(LDFLAGS) -c 309 $(RM) xxhash.o 310endif 311 312.PHONY: usan 313usan: CC=clang 314usan: CXX=clang++ 315usan: ## check CLI runtime for undefined behavior, using clang's sanitizer 316 @echo ---- check undefined behavior - sanitize ---- 317 $(MAKE) clean 318 $(MAKE) test CC=$(CC) CXX=$(CXX) MOREFLAGS="-g -fsanitize=undefined -fno-sanitize-recover=all" 319 320.PHONY: staticAnalyze 321SCANBUILD ?= scan-build 322staticAnalyze: clean ## check C source files using $(SCANBUILD) static analyzer 323 @echo ---- static analyzer - $(SCANBUILD) ---- 324 CFLAGS="-g -Werror" $(SCANBUILD) --status-bugs -v $(MAKE) all 325 326CPPCHECK ?= cppcheck 327.PHONY: cppcheck 328cppcheck: ## check C source files using $(CPPCHECK) static analyzer 329 @echo ---- static analyzer - $(CPPCHECK) ---- 330 $(CPPCHECK) . --force --enable=warning,portability,performance,style --error-exitcode=1 > /dev/null 331 332.PHONY: namespaceTest 333namespaceTest: ## ensure XXH_NAMESPACE redefines all public symbols 334 $(CC) -c xxhash.c 335 $(CC) -DXXH_NAMESPACE=TEST_ -c xxhash.c -o xxhash2.o 336 $(CC) xxhash.o xxhash2.o xxhsum.c $(XXHSUM_SPLIT_SRCS) -o xxhsum2 # will fail if one namespace missing (symbol collision) 337 $(RM) *.o xxhsum2 # clean 338 339MD2ROFF ?= ronn 340MD2ROFF_FLAGS ?= --roff --warnings --manual="User Commands" --organization="xxhsum $(XXHSUM_VERSION)" 341xxhsum.1: xxhsum.1.md xxhash.h 342 cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | $(SED) -n '/^\.\\\".*/!p' > $@ 343 344.PHONY: man 345man: xxhsum.1 ## generate man page from markdown source 346 347.PHONY: clean-man 348clean-man: 349 $(RM) xxhsum.1 350 351.PHONY: preview-man 352preview-man: man 353 man ./xxhsum.1 354 355.PHONY: test 356test: DEBUGFLAGS += -DXXH_DEBUGLEVEL=1 357test: all namespaceTest check test-xxhsum-c c90test test-tools 358 359.PHONY: test-inline 360test-inline: 361 $(MAKE) -C tests test_multiInclude 362 363.PHONY: test-all 364test-all: CFLAGS += -Werror 365test-all: test test32 clangtest cxxtest usan test-inline listL120 trailingWhitespace test-unicode 366 367.PHONY: test-tools 368test-tools: 369 CFLAGS=-Werror $(MAKE) -C tests/bench 370 CFLAGS=-Werror $(MAKE) -C tests/collisions 371 372.PHONY: listL120 373listL120: # extract lines >= 120 characters in *.{c,h}, by Takayuki Matsuoka (note: $$, for Makefile compatibility) 374 find . -type f -name '*.c' -o -name '*.h' | while read -r filename; do awk 'length > 120 {print FILENAME "(" FNR "): " $$0}' $$filename; done 375 376.PHONY: trailingWhitespace 377trailingWhitespace: 378 ! $(GREP) -E "`printf '[ \\t]$$'`" xxhsum.1 *.c *.h LICENSE Makefile cmake_unofficial/CMakeLists.txt 379 380 381# ========================================================= 382# make install is validated only for the following targets 383# ========================================================= 384ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU Haiku OpenBSD FreeBSD NetBSD DragonFly SunOS CYGWIN% , $(UNAME))) 385 386DESTDIR ?= 387# directory variables: GNU conventions prefer lowercase 388# see https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html 389# support both lower and uppercase (BSD), use uppercase in script 390prefix ?= /usr/local 391PREFIX ?= $(prefix) 392exec_prefix ?= $(PREFIX) 393EXEC_PREFIX ?= $(exec_prefix) 394libdir ?= $(EXEC_PREFIX)/lib 395LIBDIR ?= $(libdir) 396includedir ?= $(PREFIX)/include 397INCLUDEDIR ?= $(includedir) 398bindir ?= $(EXEC_PREFIX)/bin 399BINDIR ?= $(bindir) 400datarootdir ?= $(PREFIX)/share 401mandir ?= $(datarootdir)/man 402man1dir ?= $(mandir)/man1 403 404ifneq (,$(filter $(UNAME),FreeBSD NetBSD DragonFly)) 405PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig 406else 407PKGCONFIGDIR ?= $(LIBDIR)/pkgconfig 408endif 409 410ifneq (,$(filter $(UNAME),OpenBSD FreeBSD NetBSD DragonFly SunOS)) 411MANDIR ?= $(PREFIX)/man/man1 412else 413MANDIR ?= $(man1dir) 414endif 415 416ifneq (,$(filter $(UNAME),SunOS)) 417INSTALL ?= ginstall 418else 419INSTALL ?= install 420endif 421 422INSTALL_PROGRAM ?= $(INSTALL) 423INSTALL_DATA ?= $(INSTALL) -m 644 424 425 426PCLIBDIR ?= $(shell echo "$(LIBDIR)" | $(SED) -n $(SED_ERE_OPT) -e "s@^$(EXEC_PREFIX)(/|$$)@@p") 427PCINCDIR ?= $(shell echo "$(INCLUDEDIR)" | $(SED) -n $(SED_ERE_OPT) -e "s@^$(PREFIX)(/|$$)@@p") 428PCEXECDIR?= $(if $(filter $(PREFIX),$(EXEC_PREFIX)),$$\{prefix\},$(EXEC_PREFIX)) 429 430ifeq (,$(PCLIBDIR)) 431# Additional prefix check is required, since the empty string is technically a 432# valid PCLIBDIR 433ifeq (,$(shell echo "$(LIBDIR)" | $(SED) -n $(SED_ERE_OPT) -e "\\@^$(EXEC_PREFIX)(/|$$)@ p")) 434$(error configured libdir ($(LIBDIR)) is outside of exec_prefix ($(EXEC_PREFIX)), can't generate pkg-config file) 435endif 436endif 437 438ifeq (,$(PCINCDIR)) 439# Additional prefix check is required, since the empty string is technically a 440# valid PCINCDIR 441ifeq (,$(shell echo "$(INCLUDEDIR)" | $(SED) -n $(SED_ERE_OPT) -e "\\@^$(PREFIX)(/|$$)@ p")) 442$(error configured includedir ($(INCLUDEDIR)) is outside of prefix ($(PREFIX)), can't generate pkg-config file) 443endif 444endif 445 446libxxhash.pc: libxxhash.pc.in 447 @echo creating pkgconfig 448 $(Q)$(SED) $(SED_ERE_OPT) -e 's|@PREFIX@|$(PREFIX)|' \ 449 -e 's|@EXECPREFIX@|$(PCEXECDIR)|' \ 450 -e 's|@LIBDIR@|$(PCLIBDIR)|' \ 451 -e 's|@INCLUDEDIR@|$(PCINCDIR)|' \ 452 -e 's|@VERSION@|$(LIBVER)|' \ 453 $< > $@ 454 455 456.PHONY: install 457install: lib libxxhash.pc xxhsum ## install libraries, CLI, links and man page 458 @echo Installing libxxhash 459 $(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR) 460 $(Q)$(INSTALL_DATA) libxxhash.a $(DESTDIR)$(LIBDIR) 461 $(Q)$(INSTALL_PROGRAM) $(LIBXXH) $(DESTDIR)$(LIBDIR) 462 $(Q)ln -sf $(LIBXXH) $(DESTDIR)$(LIBDIR)/libxxhash.$(SHARED_EXT_MAJOR) 463 $(Q)ln -sf $(LIBXXH) $(DESTDIR)$(LIBDIR)/libxxhash.$(SHARED_EXT) 464 $(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR) # includes 465 $(Q)$(INSTALL_DATA) xxhash.h $(DESTDIR)$(INCLUDEDIR) 466 $(Q)$(INSTALL_DATA) xxh3.h $(DESTDIR)$(INCLUDEDIR) # for compatibility, will be removed in v0.9.0 467ifeq ($(DISPATCH),1) 468 $(Q)$(INSTALL_DATA) xxh_x86dispatch.h $(DESTDIR)$(INCLUDEDIR) 469endif 470 @echo Installing pkgconfig 471 $(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/ 472 $(Q)$(INSTALL_DATA) libxxhash.pc $(DESTDIR)$(PKGCONFIGDIR)/ 473 @echo Installing xxhsum 474 $(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/ 475 $(Q)$(INSTALL_PROGRAM) xxhsum $(DESTDIR)$(BINDIR)/xxhsum 476 $(Q)ln -sf xxhsum $(DESTDIR)$(BINDIR)/xxh32sum 477 $(Q)ln -sf xxhsum $(DESTDIR)$(BINDIR)/xxh64sum 478 $(Q)ln -sf xxhsum $(DESTDIR)$(BINDIR)/xxh128sum 479 @echo Installing man pages 480 $(Q)$(INSTALL_DATA) xxhsum.1 $(DESTDIR)$(MANDIR)/xxhsum.1 481 $(Q)ln -sf xxhsum.1 $(DESTDIR)$(MANDIR)/xxh32sum.1 482 $(Q)ln -sf xxhsum.1 $(DESTDIR)$(MANDIR)/xxh64sum.1 483 $(Q)ln -sf xxhsum.1 $(DESTDIR)$(MANDIR)/xxh128sum.1 484 @echo xxhash installation completed 485 486.PHONY: uninstall 487uninstall: ## uninstall libraries, CLI, links and man page 488 $(Q)$(RM) $(DESTDIR)$(LIBDIR)/libxxhash.a 489 $(Q)$(RM) $(DESTDIR)$(LIBDIR)/libxxhash.$(SHARED_EXT) 490 $(Q)$(RM) $(DESTDIR)$(LIBDIR)/libxxhash.$(SHARED_EXT_MAJOR) 491 $(Q)$(RM) $(DESTDIR)$(LIBDIR)/$(LIBXXH) 492 $(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/xxhash.h 493 $(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/xxh3.h 494 $(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/xxh_x86dispatch.h 495 $(Q)$(RM) $(DESTDIR)$(PKGCONFIGDIR)/libxxhash.pc 496 $(Q)$(RM) $(DESTDIR)$(BINDIR)/xxh32sum 497 $(Q)$(RM) $(DESTDIR)$(BINDIR)/xxh64sum 498 $(Q)$(RM) $(DESTDIR)$(BINDIR)/xxh128sum 499 $(Q)$(RM) $(DESTDIR)$(BINDIR)/xxhsum 500 $(Q)$(RM) $(DESTDIR)$(MANDIR)/xxh32sum.1 501 $(Q)$(RM) $(DESTDIR)$(MANDIR)/xxh64sum.1 502 $(Q)$(RM) $(DESTDIR)$(MANDIR)/xxh128sum.1 503 $(Q)$(RM) $(DESTDIR)$(MANDIR)/xxhsum.1 504 @echo xxhsum successfully uninstalled 505 506endif 507