]> git.codecow.com Git - Monocypher.git/commitdiff
Split installation into 3 sub targets
authorLoup Vaillant <loup@loup-vaillant.fr>
Sun, 5 Mar 2023 10:25:07 +0000 (11:25 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Sun, 5 Mar 2023 10:25:07 +0000 (11:25 +0100)
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.

README.md
makefile

index 4792b9a3281578c007c116cf60b12da28eb362ad..f0c28dfd88da964ab5d4928e0703acab7526ebb5 100644 (file)
--- 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
 ----------
index c22da5b2007b6aa964d84fee26c4a1b3499c6ee0..350424fc5118c4bbd465e796c292121f8d1df041 100644 (file)
--- 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)