@@ -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
+SSRC := hash_algs.c cmd_sign.c cmd_enable.c cmd_measure.c util.c
+SOBJ := hash_algs.so cmd_sign.so cmd_enable.so cmd_measure.so util.so
HDRS := $(wildcard *.h)
all:$(EXE)
-$(EXE):$(OBJ)
+$(EXE):$(OBJ) $(LIB)
+ $(CC) -o $@ $< -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)