All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <jes.sorensen@gmail.com>
To: linux-fscrypt@vger.kernel.org
Cc: ebiggers@google.com, kernel-team@fb.com, jsorensen@fb.com
Subject: [PATCH 13/20] Update Makefile to install libfsverity and fsverity.h
Date: Fri, 24 Apr 2020 16:54:57 -0400	[thread overview]
Message-ID: <20200424205504.2586682-14-Jes.Sorensen@gmail.com> (raw)
In-Reply-To: <20200424205504.2586682-1-Jes.Sorensen@gmail.com>

From: Jes Sorensen <jsorensen@fb.com>

In addition this adds a 'static' build target, which links in libfsverity
statically rather than relying on the shared library.

This also honors PREFIX for installation location.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
 Makefile | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 966afa0..5bbcd87 100644
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,52 @@
 EXE := fsverity
+STATIC := fsverity-static
 LIB := libfsverity.so
+INC := libfsverity.h
 CFLAGS := -O2 -Wall
 CPPFLAGS := -D_FILE_OFFSET_BITS=64
 LDLIBS := -lcrypto
-DESTDIR := /usr/local
-LIBDIR := /usr/lib64
+PREFIX = /usr
+BINDIR := $(PREFIX)/bin
+LIBDIR := $(PREFIX)/lib64
+INCDIR := $(PREFIX)/include
 SRC := $(wildcard *.c)
 OBJ := fsverity.o cmd_enable.o cmd_measure.o cmd_sign.o util.o
 SSRC := libverity.c hash_algs.c
-SOBJ := libverity.so hash_algs.so
+SHOBJ := libverity.so hash_algs.so
+STOBJ := libverity.o hash_algs.o
 HDRS := $(wildcard *.h)
 
 all:$(EXE)
 
+static:$(STATIC)
+
 $(EXE):$(OBJ) $(LIB)
 	$(CC) -o $@ $(OBJ) $(LDLIBS) -L . -l fsverity
 
+$(STATIC):$(OBJ) $(STOBJ)
+	$(CC) -o $@ $(OBJ) $(STOBJ) $(LDLIBS)
+
 $(OBJ): %.o: %.c $(HDRS)
 	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
 
-$(SOBJ): %.so: %.c $(HDRS)
+$(STOBJ): %.o: %.c $(HDRS)
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
+
+$(SHOBJ): %.so: %.c $(HDRS)
 	$(CC) -c -fPIC $(CFLAGS) $(CPPFLAGS) $< -o $@
 
-libfsverity.so: $(SOBJ)
-	$(CC) $(LDLIBS) -shared -o libfsverity.so $(SOBJ)
+libfsverity.so: $(SHOBJ)
+	$(CC) $(LDLIBS) -shared -o $@ $(SHOBJ)
 
 clean:
-	rm -f $(EXE) $(OBJ) $(SOBJ) $(LIB)
+	rm -f $(EXE) $(OBJ) $(SHOBJ) $(LIB) $(STOBJ) $(STATIC)
 
 install:all
-	install -Dm755 -t $(DESTDIR)/bin $(EXE)
+	install -Dm755 -t $(BINDIR) $(EXE)
+	install -Dm755 -t $(LIBDIR) $(LIB)
+	install -Dm644 -t $(INCDIR) $(INC)
+
+install-static:static
+	install -Dm755 -t $(BINDIR) $(STATIC)
 
 .PHONY: all clean install
-- 
2.25.3


  parent reply	other threads:[~2020-04-24 20:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 20:54 [PATCH v4 00/20] Split fsverity-utils into a shared library Jes Sorensen
2020-04-24 20:54 ` [PATCH 01/20] Build basic shared library framework Jes Sorensen
2020-04-24 20:54 ` [PATCH 02/20] Change compute_file_measurement() to take a file descriptor as argument Jes Sorensen
2020-04-24 20:54 ` [PATCH 03/20] Move fsverity_descriptor definition to libfsverity.h Jes Sorensen
2020-04-24 20:54 ` [PATCH 04/20] Move hash algorithm code to shared library Jes Sorensen
2020-04-24 20:54 ` [PATCH 05/20] Create libfsverity_compute_digest() and adapt cmd_sign to use it Jes Sorensen
2020-04-24 20:54 ` [PATCH 06/20] Introduce libfsverity_sign_digest() Jes Sorensen
2020-04-24 20:54 ` [PATCH 07/20] Validate input arguments to libfsverity_compute_digest() Jes Sorensen
2020-04-24 20:54 ` [PATCH 08/20] Validate input parameters for libfsverity_sign_digest() Jes Sorensen
2020-04-24 20:54 ` [PATCH 09/20] Document API of libfsverity Jes Sorensen
2020-04-24 20:54 ` [PATCH 10/20] Change libfsverity_compute_digest() to take a read function Jes Sorensen
2020-04-24 20:54 ` [PATCH 11/20] Make full_{read,write}() return proper error codes instead of bool Jes Sorensen
2020-04-24 20:54 ` [PATCH 12/20] libfsverity: Remove dependencies on util.c Jes Sorensen
2020-04-24 20:54 ` Jes Sorensen [this message]
2020-04-24 20:54 ` [PATCH 14/20] Change libfsverity_find_hash_alg_by_name() to return the alg number Jes Sorensen
2020-04-24 20:54 ` [PATCH 15/20] Make libfsverity_find_hash_alg_by_name() private to the shared library Jes Sorensen
2020-04-24 20:55 ` [PATCH 16/20] libfsverity_sign_digest() use ARRAY_SIZE() Jes Sorensen
2020-04-24 20:55 ` [PATCH 17/20] fsverity_cmd_sign() use sizeof() input argument instead of struct Jes Sorensen
2020-04-24 20:55 ` [PATCH 18/20] fsverity_cmd_sign() don't exit on error without closing file descriptor Jes Sorensen
2020-04-24 20:55 ` [PATCH 19/20] Improve documentation of libfsverity.h API Jes Sorensen
2020-04-24 20:55 ` [PATCH 20/20] Fixup Makefile Jes Sorensen
2020-05-07 14:03 ` [PATCH v4 00/20] Split fsverity-utils into a shared library Jes Sorensen
2020-05-07 17:35   ` Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200424205504.2586682-14-Jes.Sorensen@gmail.com \
    --to=jes.sorensen@gmail.com \
    --cc=ebiggers@google.com \
    --cc=jsorensen@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-fscrypt@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.