From: Loup Vaillant Date: Sun, 5 Mar 2023 10:25:07 +0000 (+0100) Subject: Split installation into 3 sub targets X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=a4abbbb9f7eaaa8f2b57586354a452663398321a;p=Monocypher.git Split installation into 3 sub targets Namely: - `install-lib`: library files and headers. - `install-doc`: man pages. - `install-pc` : pkg-config file. Some users don't want to install everything. Those who pull Monocypher directly from git, despite strong suggestion to use a tarball instead, can be especially annoyed at the mandoc dependency. We could also split the library and includes, but this feels overkill. --- diff --git a/README.md b/README.md index 4792b9a..f0c28df 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,10 @@ program. For instance: $ gcc program.c $(pkg-config monocypher --cflags) -c $ gcc program.o $(pkg-config monocypher --libs) -o program +If for any reason you wish to avoid installing the man pages or the +`pkg-config` file, you can use the following installation sub targets +instead: `install-lib`, `install-doc`, and `install-pc`. + Test suite ---------- diff --git a/makefile b/makefile index c22da5b..350424f 100644 --- a/makefile +++ b/makefile @@ -63,7 +63,7 @@ MANDIR=$(PREFIX)/share/man/man3 SONAME=libmonocypher.so.4 .PHONY: all library static-library dynamic-library \ - install install-doc \ + install install-lib install-pc install-doc \ check test tis-ci ctgrind \ clean uninstall dist @@ -89,15 +89,20 @@ clean: ############# ## Install ## ############# -install: library src/monocypher.h monocypher.pc install-doc +install: install-lib install-pc install-doc + +install-lib: library src/monocypher.h mkdir -p $(DESTDIR)/$(INCLUDEDIR) mkdir -p $(DESTDIR)/$(LIBDIR) - mkdir -p $(DESTDIR)/$(PKGCONFIGDIR) cp -P lib/libmonocypher.a lib/libmonocypher.so* $(DESTDIR)/$(LIBDIR) - cp src/monocypher.h $(DESTDIR)/$(INCLUDEDIR) - cp src/optional/monocypher-ed25519.h $(DESTDIR)/$(INCLUDEDIR) + cp -P src/monocypher.h $(DESTDIR)/$(INCLUDEDIR) + cp -P src/optional/monocypher-ed25519.h $(DESTDIR)/$(INCLUDEDIR) + +install-pc: monocypher.pc + mkdir -p $(DESTDIR)/$(PKGCONFIGDIR) sed "s|PREFIX|$(PREFIX)|" monocypher.pc \ - > $(DESTDIR)/$(PKGCONFIGDIR)/monocypher.pc + > $(DESTDIR)/$(PKGCONFIGDIR)/monocypher.pc + install-doc: doc/man3/intro.3monocypher mkdir -p $(DESTDIR)/$(MANDIR)