# SPDX-License-Identifier: GPL-2.0-only
#
# Makefile for the RBAC LSM
#

obj-$(CONFIG_SECURITY_RBAC) := rbac.o

rbac-y := rbac_lsm.o

rbac-$(CONFIG_SECURITY_RBAC_BIBA) += biba/biba.o

rbac-$(CONFIG_SECURITY_RBAC_MLS) += mls/mls.o

rbac-$(CONFIG_SECURITY_RBAC_ROLE) += role/role.o

ccflags-y := -I$(srctree)/security/rbac

genhdrs := flask.h av_permissions.h

# see the note above, replace the dependency rule with the one below:
#  $(addprefix $(obj)/,$(rbac-y)): $(addprefix $(obj)/,$(genhdrs))
$(addprefix $(obj)/,$(rbac-y)): $(obj)/flask.h

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

# see the note above, replace the $targets and 'flask.h' rule with the lines
# below:
#  targets += $(genhdrs)
#  $(addprefix $(obj)/,$(genhdrs)) &: scripts/rbac/...
targets += flask.h
$(obj)/flask.h: scripts/rbac/genheaders/genheaders FORCE
	$(call if_changed,genhdrs)
