Makefile: generate libfsverity.pc during 'make install'

The current approach doesn't really work as expected because 'make &&
make PREFIX=/usr install' causes a rebuild due to PREFIX changing.
Avoid this for now by generating libfsverity.pc during 'make install'.

Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
Eric Biggers
2020-10-28 11:51:00 -07:00
parent 97bc1aa377
commit 5ca4c55e33
2 changed files with 6 additions and 16 deletions
-1
View File
@@ -6,7 +6,6 @@
/.build-config
/fsverity
/fsverity.sig
/libfsverity.pc
/run-tests.log
/test_*
cscope.*
+6 -15
View File
@@ -70,10 +70,6 @@ PKGCONF ?= pkg-config
echo 'LDFLAGS=$(LDFLAGS)'; \
echo 'LDLIBS=$(LDLIBS)'; \
echo 'USE_SHARED_LIB=$(USE_SHARED_LIB)'; \
echo 'PREFIX=$(PREFIX)'; \
echo 'LIBDIR=$(LIBDIR)'; \
echo 'INCDIR=$(INCDIR)'; \
echo 'BINDIR=$(BINDIR)'; \
); \
if [ "$$flags" != "`cat $@ 2>/dev/null`" ]; then \
[ -e $@ ] && echo "Rebuilding due to new settings"; \
@@ -131,15 +127,6 @@ libfsverity.so:libfsverity.so.$(SOVERSION)
DEFAULT_TARGETS += libfsverity.so
# Create the pkg-config file
libfsverity.pc: lib/libfsverity.pc.in .build-config
$(QUIET_GEN) sed -e "s|@PREFIX@|$(PREFIX)|" \
-e "s|@LIBDIR@|$(LIBDIR)|" \
-e "s|@INCDIR@|$(INCDIR)|" \
$< > $@
DEFAULT_TARGETS += libfsverity.pc
##############################################################################
#### Programs
@@ -216,8 +203,12 @@ install:all
install -m644 libfsverity.a $(DESTDIR)$(LIBDIR)
install -m755 libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)
ln -sf libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)/libfsverity.so
install -m644 libfsverity.pc $(DESTDIR)$(LIBDIR)/pkgconfig
install -m644 include/libfsverity.h $(DESTDIR)$(INCDIR)
sed -e "s|@PREFIX@|$(PREFIX)|" \
-e "s|@LIBDIR@|$(LIBDIR)|" \
-e "s|@INCDIR@|$(INCDIR)|" \
lib/libfsverity.pc.in \
> $(DESTDIR)$(LIBDIR)/pkgconfig/libfsverity.pc
chmod 644 $(DESTDIR)$(LIBDIR)/pkgconfig/libfsverity.pc
uninstall:
rm -f $(DESTDIR)$(BINDIR)/fsverity