xref: /linux/security/selinux/Makefile (revision 1260ed77798502de9c98020040d2995008de10cc)
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
6ec4a491dSPaul Moore# NOTE: There are a number of improvements that can be made to this Makefile
7ec4a491dSPaul Moore# once the kernel requires make v4.3 or greater; the most important feature
8ec4a491dSPaul Moore# lacking in older versions of make is support for grouped targets.  These
9ec4a491dSPaul Moore# improvements are noted inline in the Makefile below ...
10ec4a491dSPaul Moore
1160272da0SPaul Gortmakerobj-$(CONFIG_SECURITY_SELINUX) := selinux.o
121da177e4SLinus Torvalds
136f933aa7SPaul Mooreccflags-y := -I$(srctree)/security/selinux -I$(srctree)/security/selinux/include
146f933aa7SPaul Moore
156f594f5aSChristian Göttscheccflags-$(CONFIG_SECURITY_SELINUX_DEBUG) += -DDEBUG
166f594f5aSChristian Göttsche
1760272da0SPaul Gortmakerselinux-y := avc.o hooks.o selinuxfs.o netlink.o nlmsgtab.o netif.o \
184b36cb77SOndrej Mosnacek	     netnode.o netport.o status.o \
1960272da0SPaul Gortmaker	     ss/ebitmap.o ss/hashtab.o ss/symtab.o ss/sidtab.o ss/avtab.o \
2050077289SOndrej Mosnacek	     ss/policydb.o ss/services.o ss/conditional.o ss/mls.o ss/context.o
211da177e4SLinus Torvalds
22d28d1e08STrent Jaegerselinux-$(CONFIG_SECURITY_NETWORK_XFRM) += xfrm.o
235778eabdSPaul Mooreselinux-$(CONFIG_NETLABEL) += netlabel.o
24fe49c7e4SRavi Kumar Siddojigariselinux-$(CONFIG_SECURITY_INFINIBAND) += ibpkey.o
25fdd1ffe8SLakshmi Ramasubramanianselinux-$(CONFIG_IMA) += ima.o
26fdd1ffe8SLakshmi Ramasubramanian
276f933aa7SPaul Mooregenhdrs := flask.h av_permissions.h
281da177e4SLinus Torvalds
29ec4a491dSPaul Moore# see the note above, replace the dependency rule with the one below:
30ec4a491dSPaul Moore#  $(addprefix $(obj)/,$(selinux-y)): $(addprefix $(obj)/,$(genhdrs))
31ec4a491dSPaul Moore$(addprefix $(obj)/,$(selinux-y)): $(obj)/flask.h
328753f6beSStephen Smalley
336f933aa7SPaul Moorequiet_cmd_genhdrs = GEN     $(addprefix $(obj)/,$(genhdrs))
346f933aa7SPaul Moore      cmd_genhdrs = $< $(addprefix $(obj)/,$(genhdrs))
358753f6beSStephen Smalley
36*b01c939dSThomas Weißschuhtargets += $(genhdrs)
37*b01c939dSThomas Weißschuh
38*b01c939dSThomas Weißschuh# see the note above, replace the 'flask.h' rule with the line below:
393b70b66eSMasahiro Yamada#  $(addprefix $(obj)/,$(genhdrs)) &: $(obj)/genheaders FORCE
403b70b66eSMasahiro Yamada$(obj)/flask.h: $(obj)/genheaders FORCE
416f933aa7SPaul Moore	$(call if_changed,genhdrs)
423b70b66eSMasahiro Yamada
433b70b66eSMasahiro Yamadahostprogs := genheaders
443b70b66eSMasahiro YamadaHOST_EXTRACFLAGS += -I$(srctree)/security/selinux/include
45