Makefile (1959B)
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 .POSIX: 17 .SUFFIXES: # Clean up default inference rules 18 19 include config.mk 20 21 MK = $(BUILD).mk 22 23 install: makefile prefix 24 @prefix=$$(cat .prefix) && \ 25 LD_LIBRARY_PATH="$${prefix}/lib:$${LD_LIBRARY_PATH}" \ 26 PATH="$${prefix}/bin:$${PATH}" \ 27 PKG_CONFIG_PATH="$${prefix}/lib/pkgconfig:$${PKG_CONFIG_PATH}" \ 28 TEXINPUTS="$${prefix}/share/tex:$${TEXINPUTS}" \ 29 $(MAKE) -f Makefile -f $(MK) install_all 30 31 clean: makefile 32 @$(MAKE) -f Makefile -f $(MK) clean_all 33 rm -rf .prefix $(MK) 34 35 purge: 36 rm -rf "$(CACHE)" .prefix 37 find src -name "*.sh.mk" -exec rm {} +; 38 39 uninstall: makefile 40 @$(MAKE) -f Makefile -f $(MK) uninstall_all 41 42 mirror: makefile 43 mkdir -p "$(MIRROR)" 44 @$(MAKE) -f Makefile -f $(MK) mirror_all 45 46 # Generate the Makefile of the build 47 makefile: cache 48 @echo "Setup $(MK)" 49 @rm -f $(MK) 50 @{ \ 51 build="$${PWD}/$(BUILD)"; \ 52 cd src; \ 53 PATH=$${PATH} \ 54 SIMD_WIDTH=$(SIMD_WIDTH) \ 55 MAKE=$(MAKE) \ 56 $(SHELL) "$${build}"; \ 57 } > "$(MK)" 58 59 prefix: 60 @# store in .prefix the absolute prefix path 61 @(p=$$(echo $(PREFIX)) && mkdir -p -- "$${p}" && cd -- "$${p}" && pwd) \ 62 > .prefix 63 64 cache: 65 mkdir -p "$(CACHE)" 66 67 lint: 68 @find src -name "*.sh" | sort | xargs -I {} sh -c \ 69 "printf 'check %s\n' \"\$$1\"; \ 70 shellcheck -o all -x -P src \"\$$1\"" -- {}