Add support for generating pkg-config files
This commit is contained in:
parent
2bcd0c9bcf
commit
b678656455
11
config.mk
11
config.mk
|
@ -64,6 +64,10 @@ NOT_PARALLEL?= .NOTPARALLEL
|
|||
# Git revision for the current code
|
||||
GIT_REVISION:= $(shell git rev-parse --short HEAD 2> /dev/null || echo "unknown")
|
||||
|
||||
# Package installation directory
|
||||
PACKAGE_DIR=$(PACKAGE_NAME:%=%/)
|
||||
PACKAGE_LIBS=$(MIQ_PRODLIB)
|
||||
PACKAGE_DLLS=$(MIQ_PRODDLL)
|
||||
|
||||
# Local setup - Location of configuration files, etc (tweaked at install time)
|
||||
-include $(MIQ)config.local-setup.mk
|
||||
|
@ -80,10 +84,11 @@ CLANG_FORMAT_SOURCES=$(SOURCES) $(HDR_INSTALL)
|
|||
SYSCONFIG?=$(DESTDIR)/etc/
|
||||
PREFIX?=$(DESTDIR)/usr/local/
|
||||
PREFIX_BIN?=$(PREFIX)bin/
|
||||
PREFIX_LIB?=$(PREFIX)lib/
|
||||
PREFIX_LIB?=$(PREFIX)lib/$(PACKAGE_DIR)
|
||||
PREFIX_DLL?=$(PREFIX_LIB)
|
||||
PREFIX_HDR?=$(PREFIX)include/
|
||||
PREFIX_SHARE?=$(PREFIX)share/
|
||||
PREFIX_HDR?=$(PREFIX)include/$(PACKAGE_DIR)
|
||||
PREFIX_SHARE?=$(PREFIX)share/$(PACKAGE_DIR)
|
||||
PREFIX_PKGCONFIG=$(PREFIX)share/pkgconfig/
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
35
rules.mk
35
rules.mk
|
@ -68,6 +68,8 @@ MIQ_LDFLAGS= $(LDFLAGS) \
|
|||
$(LDFLAGS_VARIANT_$(VARIANT)) \
|
||||
$(LDFLAGS_$*)
|
||||
|
||||
MIQ_PACKAGE= $(PACKAGE_NAME:%=$(MIQ_OBJDIR)%.pc)
|
||||
|
||||
MIQ_INSTALL= $(TO_INSTALL:%=%.install) \
|
||||
$(MIQ_OUTEXE:%=%.install_exe) \
|
||||
$(MIQ_OUTLIB:%=%.install_lib) \
|
||||
|
@ -75,7 +77,9 @@ MIQ_INSTALL= $(TO_INSTALL:%=%.install) \
|
|||
$(EXE_INSTALL:%=%.install_exe) \
|
||||
$(LIB_INSTALL:%=%.install_lib) \
|
||||
$(DLL_INSTALL:%=%.install_dll) \
|
||||
$(HDR_INSTALL:%=%.install_hdr)
|
||||
$(HDR_INSTALL:%=%.install_hdr) \
|
||||
$(SHR_INSTALL:%=%.install_shr) \
|
||||
$(MIQ_PACKAGE:%=%.install_pc)
|
||||
|
||||
MIQ_SOURCES= $(SOURCES) \
|
||||
$(SOURCES_BUILDENV_$(BUILDENV)) \
|
||||
|
@ -543,6 +547,35 @@ benchmark: $(BENCHMARKS:%=%.benchmark)
|
|||
$(PRINT_INSTALL) $(INSTALL) $* $(PREFIX_DLL)
|
||||
%.install_hdr: $(PREFIX_HDR).mkdir-only
|
||||
$(PRINT_INSTALL) $(INSTALL) $* $(PREFIX_HDR)
|
||||
%.install_shr: $(PREFIX_SHR).mkdir-only
|
||||
$(PRINT_INSTALL) $(INSTALL) $* $(PREFIX_SHR)
|
||||
%.install_pc: $(PREFIX_PKGCONFIG).mkdir-only %
|
||||
$(PRINT_INSTALL) $(INSTALL) $* $(PREFIX_PKGCONFIG)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Generation of pkg-config data file
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
MIQ_PACKAGELIBS=$(PACKAGE_LIBS:%.lib=$(LINK_LIB_OPT)%) \
|
||||
$(PACKAGE_DLLS:%.dll=$(LINK_DLL_OPT)%)
|
||||
MIQ_GENPC= \
|
||||
(echo 'prefix=$(PREFIX)' ;\
|
||||
echo 'exec_prefix=$${prefix}' ;\
|
||||
echo 'libdir=$(PREFIX_LIB)' ;\
|
||||
echo 'includedir=$(PREFIX_HDR)' ;\
|
||||
echo 'Name: $(PACKAGE_NAME)' ;\
|
||||
echo 'Description: $(PACKAGE_DESCRIPTION)' ;\
|
||||
echo 'Version: $(PACKAGE_VERSION)' ;\
|
||||
echo 'URL: $(PACKAGE_URL)' ;\
|
||||
echo 'Requires: $(PACKAGE_REQUIRES)' ;\
|
||||
echo 'Conflicts: $(PACKAGE_CONFLICTS)' ;\
|
||||
echo 'Libs: -L$${libdir} $(MIQ_PACKAGELIBS)' ;\
|
||||
echo 'Cflags: -I$${includedir}' )
|
||||
|
||||
$(MIQ_PACKAGE): $(MIQ_MAKEDEPS)
|
||||
$(PRINT_BUILD) $(MIQ_GENPC) > $@
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Clang format
|
||||
|
|
Loading…
Reference in New Issue