From 1ab35113634a15927ca87254a6769bc1e2decdf3 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Tue, 29 Jan 2019 12:05:13 +0100 Subject: ffi,openpgp-ffi: Install .pc files in target directory. - Install the .pc files in the target directory when building so that it is easier to link against built, but uninstalled libraries. - 177835be9dba392ab10994254b67aa676be66331 accidentally removed this functionality for debug builds. Restore it, and also add it for release builds. - Avoid code duplication by using a macro. --- openpgp-ffi/Makefile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'openpgp-ffi') diff --git a/openpgp-ffi/Makefile b/openpgp-ffi/Makefile index ba4e1d0f..4ece1db2 100644 --- a/openpgp-ffi/Makefile +++ b/openpgp-ffi/Makefile @@ -19,11 +19,20 @@ INSTALL ?= install export PREFIX export DESTDIR +# $(1) = install dir +# $(2) = whether to set libdir to $(1) (empty string = false) +sequoia_openpgp_pc = \ + sed -e 's|VERSION|$(VERSION)|g' \ + -e 's|PREFIX|$(shell pwd)|g' \ + $(if $(2),-e 's|libdir=.*|libdir=$(1)|g') \ + sequoia-openpgp.pc.in \ + > $(1)/sequoia-openpgp.pc + all: build .PHONY: build build: - : + $(call sequoia_openpgp_pc,$(CARGO_TARGET_DIR)/debug,true) # Testing and examples. .PHONY: test check @@ -37,15 +46,12 @@ examples: # Installation. .PHONY: build-release build-release: - : + $(call sequoia_openpgp_pc,$(CARGO_TARGET_DIR)/release,true) .PHONY: install install: $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/pkgconfig - sed -e 's|VERSION|$(VERSION)|g' \ - -e 's|PREFIX|$(PREFIX)|g' \ - sequoia-openpgp.pc.in \ - > $(DESTDIR)$(PREFIX)/share/pkgconfig/sequoia-openpgp.pc + $(call sequoia_openpgp_pc,$(DESTDIR)$(PREFIX)/share/pkgconfig,) $(INSTALL) -d $(DESTDIR)$(PREFIX)/include $(INSTALL) -d $(DESTDIR)$(PREFIX)/include/sequoia $(INSTALL) -t $(DESTDIR)$(PREFIX)/include/sequoia \ -- cgit v1.2.3