xref: /openbmc/linux/security/selinux/Makefile (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds#
31da177e4SLinus Torvalds# Makefile for building the SELinux module as part of the kernel tree.
41da177e4SLinus Torvalds#
51da177e4SLinus Torvalds
660272da0SPaul Gortmaker# NOTE: There are a number of improvements that can be made to this Makefile
71da177e4SLinus Torvalds# once the kernel requires make v4.3 or greater; the most important feature
860272da0SPaul Gortmaker# lacking in older versions of make is support for grouped targets.  These
94b36cb77SOndrej Mosnacek# improvements are noted inline in the Makefile below ...
1060272da0SPaul Gortmaker
1150077289SOndrej Mosnacekobj-$(CONFIG_SECURITY_SELINUX) := selinux.o
121da177e4SLinus Torvalds
13d28d1e08STrent Jaegerccflags-y := -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
14d28d1e08STrent Jaeger
155778eabdSPaul Mooreselinux-y := avc.o hooks.o selinuxfs.o netlink.o nlmsgtab.o netif.o \
165778eabdSPaul Moore	     netnode.o netport.o status.o \
17fe49c7e4SRavi Kumar Siddojigari	     ss/ebitmap.o ss/hashtab.o ss/symtab.o ss/sidtab.o ss/avtab.o \
18fe49c7e4SRavi Kumar Siddojigari	     ss/policydb.o ss/services.o ss/conditional.o ss/mls.o ss/context.o
19fdd1ffe8SLakshmi Ramasubramanian
20fdd1ffe8SLakshmi Ramasubramanianselinux-$(CONFIG_SECURITY_NETWORK_XFRM) += xfrm.o
219090a2d5SAndy Shevchenkoselinux-$(CONFIG_NETLABEL) += netlabel.o
221da177e4SLinus Torvaldsselinux-$(CONFIG_SECURITY_INFINIBAND) += ibpkey.o
23ceba72a6SPaul Gortmakerselinux-$(CONFIG_IMA) += ima.o
248753f6beSStephen Smalley
258753f6beSStephen Smalleygenhdrs := flask.h av_permissions.h
26bcab1adeSOndrej Mosnacek
278753f6beSStephen Smalley# see the note above, replace the dependency rule with the one below:
28a7a387ccSRalf Baechle#  $(addprefix $(obj)/,$(selinux-y)): $(addprefix $(obj)/,$(genhdrs))
29*42c4e97eSPaul Moore$(addprefix $(obj)/,$(selinux-y)): $(obj)/flask.h
30*42c4e97eSPaul Moore
31*42c4e97eSPaul Moorequiet_cmd_genhdrs = GEN     $(addprefix $(obj)/,$(genhdrs))
32*42c4e97eSPaul Moore      cmd_genhdrs = $< $(addprefix $(obj)/,$(genhdrs))
33*42c4e97eSPaul Moore
348753f6beSStephen Smalley# 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/...
38targets += flask.h
39$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE
40	$(call if_changed,genhdrs)
41