Makefile (2368B)
1 # Copyright (C) 2024, 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 # Default install directories 20 PREFIX = /usr/local 21 BINPREFIX = $(PREFIX)/bin 22 MANPREFIX = $(PREFIX)/share/man 23 APPPREFIX = $(PREFIX)/share 24 25 # Nothing to do 26 default: 27 28 install: 29 install() { mode="$$1"; prefix="$$2"; shift 2; \ 30 mkdir -p "$${prefix}"; \ 31 cp "$$@" "$${prefix}"; \ 32 chmod "$${mode}" "$$@"; \ 33 }; \ 34 install 755 "$(DESTDIR)$(BINPREFIX)" git-repo; \ 35 install 644 "$(DESTDIR)$(MANPREFIX)/man1" git-repo.1; \ 36 install 644 "$(DESTDIR)$(MANPREFIX)/man1" git-publish.1; \ 37 install 644 "$(DESTDIR)$(APPPREFIX)/git-repo" logo.png; \ 38 install 644 "$(DESTDIR)$(APPPREFIX)/git-repo" post-receive.in; \ 39 install 644 "$(DESTDIR)$(APPPREFIX)/git-repo" style.css; \ 40 install 644 "$(DESTDIR)$(PREFIX)/share/doc/git-repo" COPYING; \ 41 install 644 "$(DESTDIR)$(PREFIX)/share/doc/git-repo" README.md 42 sed 's#@RESOURCES_PATH@#$(DESTDIR)$(APPPREFIX)/git-repo#g' \ 43 git-publish > "$(DESTDIR)$(BINPREFIX)/git-publish" 44 chmod 755 "$(DESTDIR)$(BINPREFIX)/git-publish" 45 46 uninstall: 47 rm -f "$(DESTDIR)$(BINPREFIX)/git-publish" 48 rm -f "$(DESTDIR)$(BINPREFIX)/git-repo" 49 rm -f "$(DESTDIR)$(MANPREFIX)/man1/git-repo.1" 50 rm -f "$(DESTDIR)$(MANPREFIX)/man1/git-publish.1" 51 rm -f "$(DESTDIR)$(APPPREFIX)/git-repo/logo.png" 52 rm -f "$(DESTDIR)$(APPPREFIX)/git-repo/post-receive.in" 53 rm -f "$(DESTDIR)$(APPPREFIX)/git-repo/style.css" 54 rm -f "$(DESTDIR)$(PREFIX)/share/doc/git-repo/README.md" 55 rm -f "$(DESTDIR)$(PREFIX)/share/doc/git-repo/COPYING" 56 57 lint: 58 shellcheck -o all git-publish 59 shellcheck -o all git-repo 60 shellcheck -o all post-receive.in 61 mandoc -Wbase -Tlint git-publish.1 || [ $$? -le 1 ]; 62 mandoc -Wbase -Tlint git-repo.1