star-build

Automation tool for project installation
git clone git://git.meso-star.com/star-build.git
Log | Files | Refs | README | LICENSE

random123.mk.in (4005B)


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