Makefile (5476B)
1 # Copyright (C) 2017-2026 |Méso|Star> (contact@meso-star.com) 2 # 3 # This file is part Star-Typesetting. 4 # 5 # Star-Typesetting 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-Typesetting 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-Typesetting. If not, see <http://www.gnu.org/licenses/>. 17 18 .POSIX: 19 20 # Default install directories 21 PREFIX = /usr/local 22 APPPREFIX = $(PREFIX)/share 23 BINPREFIX = $(PREFIX)/bin 24 MANPREFIX = $(PREFIX)/share/man 25 26 # Compilation/Linker flags used to compile build system tools 27 CFLAGS=-std=c99 -Wall -Wextra -Os 28 LDFLAGS= 29 30 default: sty-genhead 31 32 .c.o: 33 $(CC) $(CFLAGS) -c $< -o $@ 34 35 sty-genhead: src/sty-genhead.o 36 $(CC) $(CFLAGS) -o $@ src/sty-genhead.o $(LDFLAGS) 37 38 install: sty-genhead 39 install() { mode="$$1"; prefix="$$2"; shift 2; \ 40 mkdir -p "$${prefix}"; \ 41 cp "$$@" "$${prefix}"; \ 42 chmod "$${mode}" "$${prefix}/$${@##*/}"; \ 43 }; \ 44 install 755 "$(DESTDIR)$(BINPREFIX)" sty-genhead; \ 45 install 755 "$(DESTDIR)$(BINPREFIX)" src/sty.sh; \ 46 install 755 "$(DESTDIR)$(BINPREFIX)" src/sty-hooks; \ 47 install 755 "$(DESTDIR)$(BINPREFIX)" src/sty-index; \ 48 install 755 "$(DESTDIR)$(BINPREFIX)" src/sty-list; \ 49 install 644 "$(DESTDIR)$(MANPREFIX)/man1" doc/sty-genhead.1; \ 50 install 644 "$(DESTDIR)$(MANPREFIX)/man1" doc/sty-hooks.1; \ 51 install 644 "$(DESTDIR)$(MANPREFIX)/man1" doc/sty-index.1; \ 52 install 644 "$(DESTDIR)$(MANPREFIX)/man1" doc/sty-list.1; \ 53 install 644 "$(DESTDIR)$(MANPREFIX)/man7" doc/star-typesetting.7; \ 54 install 644 "$(DESTDIR)$(PREFIX)/share/doc/star-ty" README.md; \ 55 install 644 "$(DESTDIR)$(PREFIX)/share/doc/star-ty" COPYING; \ 56 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty" example/Makefile; \ 57 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty" example/config.mk; \ 58 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty" example/sty.css; \ 59 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty" example/menu.tsv; \ 60 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home" example/home/documentation.sh; \ 61 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home" example/home/index.tsv; \ 62 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home" example/home/overview.md; \ 63 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks" example/home/hooks/00-find-man-pages.sh; \ 64 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks" example/home/hooks/01-convert-man-pages.sh; \ 65 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks" example/home/hooks/man-pages.sh; \ 66 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/examples" example/examples/index.tsv; \ 67 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/examples" example/examples/lorem-ipsum-fr.md; \ 68 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/examples" example/examples/lorem-ipsum-la.md; \ 69 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/examples/images" example/examples/images/prompt.png; \ 70 install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/templates" example/templates/footer.html 71 sed 's#@README@#$(DESTDIR)$(PREFIX)/share/doc/star-ty/README.md#g' \ 72 example/home/about.sh.in > "$(DESTDIR)$(APPPREFIX)/star-ty/home/about.sh" 73 chmod 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home/about.sh" 74 75 uninstall: 76 rm -f "$(DESTDIR)$(BINPREFIX)/sty-genhead" 77 rm -f "$(DESTDIR)$(BINPREFIX)/sty.sh" 78 rm -f "$(DESTDIR)$(BINPREFIX)/sty-hooks" 79 rm -f "$(DESTDIR)$(BINPREFIX)/sty-index" 80 rm -f "$(DESTDIR)$(BINPREFIX)/sty-list" 81 rm -f "$(DESTDIR)$(MANPREFIX)/man1/sty-genhead.1" 82 rm -f "$(DESTDIR)$(MANPREFIX)/man1/sty-hooks.1" 83 rm -f "$(DESTDIR)$(MANPREFIX)/man1/sty-index.1" 84 rm -f "$(DESTDIR)$(MANPREFIX)/man1/sty-list.1" 85 rm -f "$(DESTDIR)$(MANPREFIX)/man7/star-typesetting.7" 86 rm -f "$(DESTDIR)$(PREFIX)/share/doc/star-ty/README.md" 87 rm -f "$(DESTDIR)$(PREFIX)/share/doc/star-ty/COPYING" 88 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/Makefile" 89 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/config.mk" 90 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/sty.css" 91 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/menu.tsv" 92 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/index.tsv" 93 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/about.sh" 94 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/documentation.sh" 95 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/overview.md" 96 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks/00-find-man-pages.sh" 97 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks/01-convert-man-pages.sh" 98 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks/man-pages.sh" 99 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/examples/index.tsv" 100 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/examples/lorem-ipsum-fr.md" 101 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/examples/lorem-ipsum-la.md" 102 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/examples/images/prompt.png" 103 rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/templates/footer.html" 104 105 clean: 106 rm -f src/sty-genhead.o sty-genhead 107 108 lint: 109 shellcheck -o all -P src -x src/sty.sh 110 shellcheck -o all -P src -x src/sty-hooks 111 shellcheck -o all -P src -x src/sty-index 112 shellcheck -o all -P src -x src/sty-list 113 mandoc -Tlint -Wwarning doc/sty-genhead.1 114 mandoc -Tlint -Wwarning doc/sty-hooks.1 115 mandoc -Tlint -Wwarning doc/sty-index.1 116 mandoc -Tlint -Wwarning doc/sty-list.1 117 mandoc -Tlint -Wwarning doc/star-typesetting.7