random123.mk.in (3974B)
1 # Copyright (C) 2023-2025 |Méso|Star> (contact@meso-star.com) 2 # 3 # This program is free software: you can redistribute it and/or modify 4 # it under the terms of the GNU General Public License as published by 5 # the Free Software Foundation, either version 3 of the License, or 6 # (at your option) any later version. 7 # 8 # This program is distributed in the hope that it will be useful, 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 # GNU General Public License for more details. 12 # 13 # You should have received a copy of the GNU General Public License 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 # Configuration macros 17 RANDOM123_VERSION=@VERSION@ 18 RANDOM123_TAG=@TAG@ 19 RANDOM123_URL_ONLINE=https://github.com/DEShawResearch/random123 20 RANDOM123_URL_OFFLINE=$(MIRROR)/random123 21 RANDOM123_URL = $(RANDOM123_URL_$(NETWORK)) 22 23 # Helper macros 24 RANDOM123_DIR=$(CACHE)/random123/$(RANDOM123_TAG) 25 26 random123: $(RANDOM123_DIR) $(RANDOM123_DIR)/random123.pc.in prefix 27 prefix="$$(cat .prefix)" && \ 28 mkdir -p "$${prefix}/lib/pkgconfig" && \ 29 mkdir -p "$${prefix}/share/doc/Random123" && \ 30 cp -RP "$(RANDOM123_DIR)/include" "$${prefix}" && \ 31 cp -L "$(RANDOM123_DIR)/LICENSE" "$${prefix}/share/doc/Random123" && \ 32 sed "s#@PREFIX@#$${prefix}#" "$(RANDOM123_DIR)/random123.pc.in" \ 33 > "$${prefix}/lib/pkgconfig/random123.pc" 34 35 $(RANDOM123_DIR): 36 @git clone --branch "$(RANDOM123_TAG)" --depth 1 "$(RANDOM123_URL)" $@ 37 38 $(RANDOM123_DIR)/random123.pc.in: $(RANDOM123_DIR) 39 @{ \ 40 printf 'prefix=@PREFIX@\n' ; \ 41 printf 'includedir=$${prefix}/include\n'; \ 42 printf '\n'; \ 43 printf 'Name: Random123\n'; \ 44 printf 'Description: Counter-Based Random Number Generators\n'; \ 45 printf 'Version: %s\n' "$(RANDOM123_VERSION)"; \ 46 printf '\n'; \ 47 printf 'Cflags: -I$${includedir}\n'; \ 48 } > "$@" 49 50 uninstall_random123: prefix 51 prefix="$$(cat .prefix)" && \ 52 rm -f "$${prefix}/include/Random123/aes.h" && \ 53 rm -f "$${prefix}/include/Random123/array.h" && \ 54 rm -f "$${prefix}/include/Random123/ars.h" && \ 55 rm -f "$${prefix}/include/Random123/boxmuller.hpp" && \ 56 rm -f "$${prefix}/include/Random123/conventional/Engine.hpp" && \ 57 rm -f "$${prefix}/include/Random123/conventional/gsl_cbrng.h" && \ 58 rm -f "$${prefix}/include/Random123/features/clangfeatures.h" && \ 59 rm -f "$${prefix}/include/Random123/features/compilerfeatures.h" && \ 60 rm -f "$${prefix}/include/Random123/features/gccfeatures.h" && \ 61 rm -f "$${prefix}/include/Random123/features/iccfeatures.h" && \ 62 rm -f "$${prefix}/include/Random123/features/metalfeatures.h" && \ 63 rm -f "$${prefix}/include/Random123/features/msvcfeatures.h" && \ 64 rm -f "$${prefix}/include/Random123/features/nvccfeatures.h" && \ 65 rm -f "$${prefix}/include/Random123/features/open64features.h" && \ 66 rm -f "$${prefix}/include/Random123/features/openclfeatures.h" && \ 67 rm -f "$${prefix}/include/Random123/features/pgccfeatures.h" && \ 68 rm -f "$${prefix}/include/Random123/features/sse.h" && \ 69 rm -f "$${prefix}/include/Random123/features/sunprofeatures.h" && \ 70 rm -f "$${prefix}/include/Random123/features/xlcfeatures.h" && \ 71 rm -f "$${prefix}/include/Random123/gsl_microrng.h" && \ 72 rm -f "$${prefix}/include/Random123/MicroURNG.hpp" && \ 73 rm -f "$${prefix}/include/Random123/philox.h" && \ 74 rm -f "$${prefix}/include/Random123/ReinterpretCtr.hpp" && \ 75 rm -f "$${prefix}/include/Random123/threefry.h" && \ 76 rm -f "$${prefix}/include/Random123/u01fixedpt.h" && \ 77 rm -f "$${prefix}/include/Random123/uniform.hpp" && \ 78 rm -f "$${prefix}/lib/pkgconfig/random123.pc" && \ 79 rm -f "$${prefix}/share/doc/Random123/LICENSE" 80 81 mirror_random123: 82 repo="$$(echo "$(RANDOM123_URL)" | sed 's/[\/]\{0,\}$$//g')" && \ 83 repo="$(MIRROR)/$${repo##*/}" && \ 84 rm -rf "$${repo}" && \ 85 git clone --bare --branch "$(RANDOM123_TAG)" $(MIRROR_GIT_OPT) \ 86 $(RANDOM123_URL) "$${repo}" 87 88 install_all: random123 89 uninstall_all: uninstall_random123 90 mirror_all: mirror_random123