Add some preliminary support for packages found with pkg-config

This commit is contained in:
Christophe de Dinechin 2017-11-07 15:19:52 +01:00
parent 981fe36296
commit e0e5b4a84c
2 changed files with 14 additions and 7 deletions

View File

@ -31,6 +31,5 @@ DLL_EXT= .dylib
MAKE_LIB= $(LIBTOOL) -static $(LDFLAGS) $(LDFLAGS_$*) $(LINK_INPUTS) -o $@
MAKE_DLL= $(LD) -shared $(LDFLAGS) $(LDFLAGS_$*) $(LINK_INPUTS) -o $@
# On MacOSX, we will use basic frameworks e.g. for string and filesystem functions
LDFLAGS_macosx-clang= -framework CoreFoundation -framework CoreServices

View File

@ -25,10 +25,9 @@ include $(BUILD)config.mk
XINCLUDES= $(INCLUDES) $(INCLUDES_$(BUILDENV)) $(INCLUDES_$(TARGET)) $(INCLUDES_EXTRA)
XDEFINES= $(DEFINES) $(DEFINES_$(BUILDENV)) $(DEFINES_$(TARGET)) $(DEFINES_EXTRA)
CPPFLAGS+= $(CPPFLAGS_$(BUILDENV)) $(CPPFLAGS_$(TARGET)) $(CPPFLAGS_EXTRA) $(XDEFINES:%=-D%) $(XINCLUDES:%=-I%)
CFLAGS+= $(CPPFLAGS) $(CFLAGS_STD) $(CFLAGS_$(BUILDENV)) $(CFLAGS_$(TARGET)) $(CFLAGS_EXTRA)
CXXFLAGS+= $(CPPFLAGS) $(CXXFLAGS_STD) $(CXXFLAGS_$(BUILDENV)) $(CXXFLAGS_$(TARGET)) $(CFLAGS_EXTRA) $(CXXFLAGS_EXTRA)
LDFLAGS+= $(CFLAGS_STD) $(CXXFLAGS_STD) $(LDFLAGS_$(BUILDENV)) $(LDFLAGS_$(TARGET)) $(CFLAGS_EXTRA) $(LDFLAGS_EXTRA)
CFLAGS+= $(CPPFLAGS) $(CFLAGS_STD) $(CFLAGS_PKGCONFIG) $(CFLAGS_$(BUILDENV)) $(CFLAGS_$(TARGET)) $(CFLAGS_EXTRA)
CXXFLAGS+= $(CPPFLAGS) $(CXXFLAGS_STD) $(CFLAGS_PKGCONFIG) $(CXXFLAGS_$(BUILDENV)) $(CXXFLAGS_$(TARGET)) $(CFLAGS_EXTRA) $(CXXFLAGS_EXTRA)
LDFLAGS+= $(CFLAGS_STD) $(CXXFLAGS_STD) $(LDFLAGS_PKGCONFIG) $(LDFLAGS_$(BUILDENV)) $(LDFLAGS_$(TARGET)) $(CFLAGS_EXTRA) $(LDFLAGS_EXTRA)
# Get BUILDOBJ from the BUILD_OBJECTS environment variable if set
BUILDOBJ= $(BUILD_OBJECTS)
@ -99,6 +98,9 @@ BUILD_COUNT:= $(words $(SOURCES))
GIT_REVISION:= $(shell git rev-parse --short HEAD 2> /dev/null || echo "unknown")
PROFILE_OUTPUT:=$(subst $(EXE_EXT),,$(OBJROOT_EXE))_prof_$(GIT_REVISION).vsp
-include $(PKGCONFIGS:%=$(OBJROOT)/%.pkg-config.mk)
#------------------------------------------------------------------------------
# User targets
#------------------------------------------------------------------------------
@ -183,7 +185,7 @@ product:$(OBJPRODUCTS)
objects:$(OBJDIR:%=%/.mkdir) $(OBJECTS)
# "Hooks" for pre and post build steps
config: $(CONFIG:%=config.h)
config: $(CONFIG:%=config.h) $(PKGCONFIGS:%=$(OBJROOT)/%.pkg-config.mk)
prebuild:
postbuild:
@ -209,6 +211,11 @@ product.test: product .ALWAYS
%.install_hdr: $(PREFIX_HDR).mkdir
$(PRINT_INSTALL) $(INSTALL) $* $(PREFIX_HDR)
# Check pkg-config
$(OBJROOT)/%.pkg-config.mk: $(MAKEFILE_DEPS) $(OBJROOT)/.mkdir
$(PRINT_PKGCONFIG) pkg-config $*
$(PRINT_GENERATE) echo CFLAGS_PKGCONFIG+=`pkg-config --cflags $*` > $@ && echo LDFLAGS_PKGCONFIG+=`pkg-config --libs $*` >> $@
# Benchmarking (always done with profile target)
benchmark: $(BENCHMARK:%=%.benchmark) $(BENCHMARKS:%=%.benchmark)
product.benchmark: product .ALWAYS
@ -299,7 +306,8 @@ PRINT_COPY= $(PRINT_COMMAND) $(INFO) "[COPY]" $< '=>' $@ ;
PRINT_DEPEND= $(PRINT_COMMAND) $(INFO) "[DEPEND] " $< ;
PRINT_TEST= $(PRINT_COMMAND) $(INFO) "[TEST]" $(@:.test=) ;
PRINT_CONFIG= $(PRINT_COMMAND) $(INFO) "[CONFIG]" "$*" ;
PRINT_LIBCONFIG=$(PRINT_COMMAND) $(INFO) "[CONFIG]" "lib$*" ;
PRINT_PKGCONFIG=$(PRINT_COMMAND) $(INFO) "[PKGCONFIG]" "$*" ;
PRINT_LIBCONFIG=$(PRINT_COMMAND) $(INFO) "[LIBCONFIG]" "lib$*" ;
endif
logs.mkdir: $(dir $(BUILD_LOG))/.mkdir $(dir $(BUILD_SAVED_LOG))/.mkdir