Bugfix: Don’t use a blank after comma in ldflags_for_lib calls (Thanks Raphael)

'-l foo' instead of '-lfoo' is a problem on FreeBSD.
This commit is contained in:
Michael Stapelberg 2011-10-09 18:24:06 +01:00
parent f595347792
commit 45a9eeb29d
1 changed files with 18 additions and 14 deletions

View File

@ -21,7 +21,11 @@ $(error "pkg-config was not found")
endif endif
# An easier way to get CFLAGS and LDFLAGS falling back in case there's # An easier way to get CFLAGS and LDFLAGS falling back in case there's
# no pkg-config support for certain libraries # no pkg-config support for certain libraries.
# NOTE that you must not use a blank after comma when calling this:
# $(call ldflags_for_lib name, fallback) # bad
# $(call ldflags_for_lib name,fallback) # good
# Otherwise, the compiler will get -l foo instead of -lfoo
cflags_for_lib = $(shell pkg-config --silence-errors --cflags $(1)) cflags_for_lib = $(shell pkg-config --silence-errors --cflags $(1))
ldflags_for_lib = $(shell pkg-config --exists $(1) && pkg-config --libs $(1) || echo -l$(2)) ldflags_for_lib = $(shell pkg-config --exists $(1) && pkg-config --libs $(1) || echo -l$(2))