commit 4bc130e7d673001459a716bcd639ef4e02f043c0 parent 3fff1980723514fcfea153ea3a98d042566b05d5 Author: Vincent Forest <vincent.forest@meso-star.com> Date: Wed, 5 Mar 2025 14:47:02 +0100 Write the "install/unistall" Makefile targets Add macros to define installation subdirectories: different systems may use different locations, particularly for man pages or libraries. Diffstat:
| M | Makefile | | | 17 | ++++++++++++++++- |
| M | config.mk | | | 9 | +++++++-- |
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile @@ -93,9 +93,24 @@ sphin-local.pc: sphin.pc.in -e 's#@SSTL_VERSION@#$(SSTL_VERSION)#g'\ sphin.pc.in > $@ -install: +install: library pkg + install() { mode="$$1"; prefix="$$2"; shift 2; \ + mkdir -p "$${prefix}"; \ + cp "$$@" "$${prefix}"; \ + chmod "$${mode}" "$$@"; \ + }; \ + install 755 "$(DESTDIR)$(LIBPREFIX)" $(LIBNAME); \ + install 644 "$(DESTDIR)$(LIBPREFIX)/pkgconfig" sphin.pc; \ + install 644 "$(DESTDIR)$(INCPREFIX)/star" src/sphin.h; \ + install 644 "$(DESTDIR)$(PREFIX)/share/doc/star-phor-input" COPYING; \ + install 644 "$(DESTDIR)$(PREFIX)/share/doc/star-phor-input" README.md uninstall: + rm -f "$(DESTDIR)$(LIBPREFIX)/$(LIBNAME)" + rm -f "$(DESTDIR)$(LIBPREFIX)/pkgconfig/sphin.pc" + rm -f "$(DESTDIR)$(INCPREFIX)/star/sphin.h" + rm -f "$(DESTDIR)$(PREFIX)/share/doc/star-phor-input/COPYING" + rm -f "$(DESTDIR)$(PREFIX)/share/doc/star-phor-input/README.md" clean: clean_test rm -f $(DEP) $(OBJ) $(LIBNAME) diff --git a/config.mk b/config.mk @@ -1,8 +1,13 @@ VERSION = 0.0 PREFIX = /usr/local -#BUILD_TYPE = RELEASE -BUILD_TYPE = DEBUG +BUILD_TYPE = RELEASE +#BUILD_TYPE = DEBUG + +BINPREFIX = $(PREFIX)/bin +LIBPREFIX = $(PREFIX)/lib +INCPREFIX = $(PREFIX)/include +MANPREFIX = $(PREFIX)/share/man ################################################################################ # Tools