Skip to content

Commit ec4a491

Browse files
committed
selinux: fix Makefile for versions of make < v4.3
As noted in the comments of this commit, the current SELinux Makefile requires features found in make v4.3 or later, which is problematic as the Linux Kernel currently only requires make v3.82. This patch fixes the SELinux Makefile so that it works properly on these older versions of make, and adds a couple of comments to the Makefile about how it can be improved once make v4.3 is required by the kernel. Fixes: 6f933aa ("selinux: more Makefile tweaks") Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent cec5fe7 commit ec4a491

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

security/selinux/Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
# Makefile for building the SELinux module as part of the kernel tree.
44
#
55

6+
# NOTE: There are a number of improvements that can be made to this Makefile
7+
# once the kernel requires make v4.3 or greater; the most important feature
8+
# lacking in older versions of make is support for grouped targets. These
9+
# improvements are noted inline in the Makefile below ...
10+
611
obj-$(CONFIG_SECURITY_SELINUX) := selinux.o
712

813
ccflags-y := -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
@@ -19,11 +24,17 @@ selinux-$(CONFIG_IMA) += ima.o
1924

2025
genhdrs := flask.h av_permissions.h
2126

22-
$(addprefix $(obj)/,$(selinux-y)): $(addprefix $(obj)/,$(genhdrs))
27+
# see the note above, replace the dependency rule with the one below:
28+
# $(addprefix $(obj)/,$(selinux-y)): $(addprefix $(obj)/,$(genhdrs))
29+
$(addprefix $(obj)/,$(selinux-y)): $(obj)/flask.h
2330

2431
quiet_cmd_genhdrs = GEN $(addprefix $(obj)/,$(genhdrs))
2532
cmd_genhdrs = $< $(addprefix $(obj)/,$(genhdrs))
2633

27-
targets += $(genhdrs)
28-
$(addprefix $(obj)/,$(genhdrs)) &: scripts/selinux/genheaders/genheaders FORCE
34+
# see the note above, replace the $targets and 'flask.h' rule with the lines
35+
# below:
36+
# targets += $(genhdrs)
37+
# $(addprefix $(obj)/,$(genhdrs)) &: scripts/selinux/...
38+
targets += flask.h
39+
$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE
2940
$(call if_changed,genhdrs)

0 commit comments

Comments
 (0)