aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--Makefile.flags12
2 files changed, 12 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index b2e94775c..8995ff506 100644
--- a/Makefile
+++ b/Makefile
@@ -297,6 +297,7 @@ NM = $(CROSS_COMPILE)nm
297STRIP = $(CROSS_COMPILE)strip 297STRIP = $(CROSS_COMPILE)strip
298OBJCOPY = $(CROSS_COMPILE)objcopy 298OBJCOPY = $(CROSS_COMPILE)objcopy
299OBJDUMP = $(CROSS_COMPILE)objdump 299OBJDUMP = $(CROSS_COMPILE)objdump
300PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
300AWK = awk 301AWK = awk
301GENKSYMS = scripts/genksyms/genksyms 302GENKSYMS = scripts/genksyms/genksyms
302DEPMOD = /sbin/depmod 303DEPMOD = /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
78ARCH_FPIE ?= -fpie 78ARCH_FPIE ?= -fpie
79ARCH_PIE ?= -pie 79ARCH_PIE ?= -pie
80 80
81# Usage: $(eval $(call pkg_check_modules,VARIABLE-PREFIX,MODULES))
82define 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))
85endef
86
81ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y) 87ifeq ($(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
90ifeq ($(CONFIG_STATIC),y) 96ifeq ($(CONFIG_STATIC),y)
91CFLAGS_busybox += -static 97CFLAGS_busybox += -static
98PKG_CONFIG_FLAGS += --static
92endif 99endif
93 100
94ifeq ($(CONFIG_PIE),y) 101ifeq ($(CONFIG_PIE),y)
@@ -131,7 +138,10 @@ LDLIBS += pam pam_misc pthread
131endif 138endif
132 139
133ifeq ($(CONFIG_SELINUX),y) 140ifeq ($(CONFIG_SELINUX),y)
134LDLIBS += selinux sepol 141SELINUX_PC_MODULES = libselinux libsepol
142$(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES)))
143CPPFLAGS += $(SELINUX_CFLAGS)
144LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%))
135endif 145endif
136 146
137ifeq ($(CONFIG_EFENCE),y) 147ifeq ($(CONFIG_EFENCE),y)