build: Generate a pkg-conf file

This commit is contained in:
Luca Barbato 2015-07-29 02:26:20 +02:00
parent 1834ae8f45
commit 5c7a808bbd
2 changed files with 28 additions and 7 deletions

View file

@ -66,6 +66,8 @@ endif
CFLAGS += -m$(TARGET_CPU_BITS)
LDFLAGS += -m$(TARGET_CPU_BITS)
INSTALL_TARGETS = install-prog install-pc
# Windows (cygwin/mingw) specific flags
ifeq ($(SYSTEM), Windows)
ifeq ($(ARCH), x86_64)
@ -78,7 +80,7 @@ ifeq ($(SYSTEM), Windows)
endif
CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
ALL_TARGETS = $(PROG) $(DLL)
INSTALL_TARGETS = install-prog install-dll
INSTALL_TARGETS += install-dll
# OS X specific flags
else ifeq ($(SYSTEM), Darwin)
@ -89,18 +91,18 @@ else ifeq ($(SYSTEM), Darwin)
endif
ASFLAGS += -DPREFIX
ALL_TARGETS = $(PROG) $(DYLIB)
INSTALL_TARGETS = install-prog install-dylib
INSTALL_TARGETS += install-dylib
# Default to Linux/elf specific flags
else
LDFLAGS += -lrt
LIBS += -lrt
ifeq ($(ARCH), x86_64)
ASFLAGS += -f elf64
else
ASFLAGS += -f elf32
endif
ALL_TARGETS = $(PROG) $(LIB)
INSTALL_TARGETS = install-prog install-lib
INSTALL_TARGETS += install-lib
endif
# Flags shared across systems
@ -236,13 +238,13 @@ $(DYLIB): LDFLAGS += -dynamiclib \
-compatibility_version $(VER_MAJOR) \
-install_name $(LIBDIR)/$@
$(LIB) $(DLL) $(DYLIB): $(OBJS)
$(LD) $^ $(LDFLAGS) -o $@
$(LD) $^ $(LDFLAGS) $(LIBS) -o $@
$(DEBUG): $(DEBUG_OBJS)
$(LD) $^ $(LDFLAGS) -o $@
$(LD) $^ $(LDFLAGS) $(LIBS) -o $@
$(TESTS): $(TESTS_OBJS)
$(LD) $^ $(LDFLAGS) -o $@
$(LD) $^ $(LDFLAGS) $(LIBS) -o $@
%.o %_debug.o: %.asm Makefile
$(AS) $(ASFLAGS) -o $@ $<
@ -250,12 +252,21 @@ $(TESTS): $(TESTS_OBJS)
%.o %_debug.o: %.c Makefile
$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@
kvazaar.pc: kvazaar.pc.in Makefile
sed -e "s;@prefix@;$(PREFIX);" -e "s;@libdir@;$(LIBDIR);" \
-e "s;@VERSION@;$(VER_MAJOR).$(VER_MINOR).$(VER_RELEASE);" \
-e "s;@LIBS@;$(LIBS);" kvazaar.pc.in > $@
init_submodules:
git submodule init
git submodule update
install: $(INSTALL_TARGETS)
install-pc: kvazaar.pc
$(INSTALL) -d $(DESTDIR)$(LIBDIR)/pkgconfig
$(INSTALL) -m644 $^ $(DESTDIR)$(LIBDIR)/pkgconfig
install-prog: $(PROG)
$(INSTALL) -d $(DESTDIR)$(BINDIR)
$(INSTALL) -m755 $(PROG) $(DESTDIR)$(BINDIR)

10
src/kvazaar.pc.in Normal file
View file

@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=${prefix}
libdir=@libdir@
incdir=${prefix}/include
Name: libkvazaar
Description: Open-source HEVC encoder
Version: @VERSION@
Libs: -L${libdir} -lkvazaar -lm @LIBS@
Cflags: -I${incdir}