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