diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | Makefile.flags | 12 |
2 files changed, 12 insertions, 1 deletions
@@ -297,6 +297,7 @@ NM = $(CROSS_COMPILE)nm | |||
297 | STRIP = $(CROSS_COMPILE)strip | 297 | STRIP = $(CROSS_COMPILE)strip |
298 | OBJCOPY = $(CROSS_COMPILE)objcopy | 298 | OBJCOPY = $(CROSS_COMPILE)objcopy |
299 | OBJDUMP = $(CROSS_COMPILE)objdump | 299 | OBJDUMP = $(CROSS_COMPILE)objdump |
300 | PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config | ||
300 | AWK = awk | 301 | AWK = awk |
301 | GENKSYMS = scripts/genksyms/genksyms | 302 | GENKSYMS = scripts/genksyms/genksyms |
302 | DEPMOD = /sbin/depmod | 303 | DEPMOD = /sbin/depmod |
diff --git a/Makefile.flags b/Makefile.flags index e77c0e527..307afa7f5 100644 --- a/Makefile.flags +++ b/Makefile.flags | |||
@@ -78,6 +78,12 @@ ARCH_FPIC ?= -fpic | |||
78 | ARCH_FPIE ?= -fpie | 78 | ARCH_FPIE ?= -fpie |
79 | ARCH_PIE ?= -pie | 79 | ARCH_PIE ?= -pie |
80 | 80 | ||
81 | # Usage: $(eval $(call pkg_check_modules,VARIABLE-PREFIX,MODULES)) | ||
82 | define pkg_check_modules | ||
83 | $(1)_CFLAGS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags $(2)) | ||
84 | $(1)_LIBS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs $(2)) | ||
85 | endef | ||
86 | |||
81 | ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y) | 87 | ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y) |
82 | # on i386: 14% smaller libbusybox.so | 88 | # on i386: 14% smaller libbusybox.so |
83 | # (code itself is 9% bigger, we save on relocs/PLT/GOT) | 89 | # (code itself is 9% bigger, we save on relocs/PLT/GOT) |
@@ -89,6 +95,7 @@ endif | |||
89 | 95 | ||
90 | ifeq ($(CONFIG_STATIC),y) | 96 | ifeq ($(CONFIG_STATIC),y) |
91 | CFLAGS_busybox += -static | 97 | CFLAGS_busybox += -static |
98 | PKG_CONFIG_FLAGS += --static | ||
92 | endif | 99 | endif |
93 | 100 | ||
94 | ifeq ($(CONFIG_PIE),y) | 101 | ifeq ($(CONFIG_PIE),y) |
@@ -131,7 +138,10 @@ LDLIBS += pam pam_misc pthread | |||
131 | endif | 138 | endif |
132 | 139 | ||
133 | ifeq ($(CONFIG_SELINUX),y) | 140 | ifeq ($(CONFIG_SELINUX),y) |
134 | LDLIBS += selinux sepol | 141 | SELINUX_PC_MODULES = libselinux libsepol |
142 | $(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES))) | ||
143 | CPPFLAGS += $(SELINUX_CFLAGS) | ||
144 | LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%)) | ||
135 | endif | 145 | endif |
136 | 146 | ||
137 | ifeq ($(CONFIG_EFENCE),y) | 147 | ifeq ($(CONFIG_EFENCE),y) |