Makefile (2141B)
1 # Copyright (C) 2017, 2018, 2025 |Méso|Star> 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 18 include config.mk 19 20 PROG =\ 21 solmaps \ 22 solpp \ 23 solppraw \ 24 solpaths 25 26 MAN = \ 27 doc/solmaps.1 \ 28 doc/solpp.1 \ 29 doc/solpaths.1 \ 30 doc/solppraw.1 31 32 PROJECTS = themis cyl 33 34 default: $(PROG) 35 36 install: $(PROG) $(MAN) 37 install() { mode="$$1"; prefix="$$2"; shift 2; \ 38 mkdir -p "$${prefix}"; \ 39 cp "$$@" "$${prefix}"; \ 40 chmod "$${mode}" "$${prefix}/$${@##*/}"; \ 41 }; \ 42 install 644 "$(DESTDIR)$(PREFIX)/share/doc/solstice-pp" COPYING; \ 43 install 644 "$(DESTDIR)$(PREFIX)/share/doc/solstice-pp" README.md; \ 44 for i in $(PROG); \ 45 do install 755 "$(DESTDIR)$(PREFIX)/bin" $${i}; done; \ 46 for i in $(MAN); \ 47 do install 644 "$(DESTDIR)$(PREFIX)/share/man/man1" $${i}; done; 48 49 uninstall: 50 rm -f "$(DESTDIR)$(PREFIX)/share/doc/solstice-pp/COPYING" 51 rm -f "$(DESTDIR)$(PREFIX)/share/doc/solstice-pp/README.md" 52 for i in $(PROG); do rm -f "$(DESTDIR)$(PREFIX)/bin/$${i}"; done 53 for i in $(MAN); do rm -f "$(DESTDIR)$(PREFIX)/share/man/man1/$${i##*/}"; done 54 55 .PHONY: clean 56 clean: 57 rm -rf $(PROG) 58 for i in $(PROJECTS); do $(MAKE) -C "$${i}" clean; done 59 60 solmaps: src/solmaps.c 61 62 solpp: src/solpp.c 63 64 solppraw: src/solppraw.c 65 66 solpaths: src/solpaths.c 67 68 $(PROG): src/solpp.h config.mk 69 $(CC) -o $@ $(CFLAGS) src/$@.c 70 71 run: $(PROJECTS) 72 73 $(PROJECTS): $(PROG) 74 @echo "----------------------------------------------------------------------" 75 @echo -e " Run $@" 76 @echo "----------------------------------------------------------------------" 77 @$(MAKE) -C $@