@@ -1,20 +1,32 @@
EXE := fsverity
+LIB := libfsverity.so
CFLAGS := -O2 -Wall
CPPFLAGS := -D_FILE_OFFSET_BITS=64
LDLIBS := -lcrypto
DESTDIR := /usr/local
+LIBDIR := /usr/lib64
SRC := $(wildcard *.c)
-OBJ := $(SRC:.c=.o)
+OBJ := fsverity.o hash_algs.o cmd_enable.o cmd_measure.o cmd_sign.o util.o
+SSRC := libverity.c
+SOBJ := libverity.so
HDRS := $(wildcard *.h)
all:$(EXE)
-$(EXE):$(OBJ)
+$(EXE):$(OBJ) $(LIB)
+ $(CC) -o $@ $(OBJ) $(LDLIBS) -L . -l fsverity
$(OBJ): %.o: %.c $(HDRS)
+ $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
+
+$(SOBJ): %.so: %.c $(HDRS)
+ $(CC) -c -fPIC $(CFLAGS) $(CPPFLAGS) $< -o $@
+
+libfsverity.so: $(SOBJ)
+ $(CC) $(LDLIBS) -shared -o libfsverity.so $(SOBJ)
clean:
- rm -f $(EXE) $(OBJ)
+ rm -f $(EXE) $(OBJ) $(SOBJ) $(LIB)
install:all
install -Dm755 -t $(DESTDIR)/bin $(EXE)
new file mode 100644
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * The 'fsverity library'
+ *
+ * Copyright (C) 2018 Google LLC
+ * Copyright (C) 2020 Facebook
+ *
+ * Written by Eric Biggers and Jes Sorensen.
+ */
+