#
# File: rsbac/adf/Makefile
#
# Makefile for the Linux RSBAC Access Control Decision Facility (ADF)
#
# Author and (c) 1999-2001 Amon Ott
#

#TOPDIR := ../..

O_TARGET := adf.o
ALL_SUB_DIRS := mac fc sim pm ms ff rc auth reg acl cap jail

ifeq ($(PATCHLEVEL),2)

OX_OBJS  := adf_main.o
O_OBJS   :=
M_OBJS   :=
SUB_DIRS :=
MOD_SUB_DIRS :=

ifeq ($(CONFIG_RSBAC_DEBUG),y)
O_OBJS   += adf_check.o
endif

# Adding policies
ifeq ($(CONFIG_RSBAC_MAC),y)
SUB_DIRS += mac
O_OBJS   += mac/mac.o
endif

ifeq ($(CONFIG_RSBAC_FC),y)
ifneq ($(CONFIG_RSBAC_MAINT),y)
SUB_DIRS += fc
O_OBJS   += fc/fc.o
endif
endif

ifeq ($(CONFIG_RSBAC_SIM),y)
ifneq ($(CONFIG_RSBAC_MAINT),y)
SUB_DIRS += sim
O_OBJS   += sim/sim.o
endif
endif

ifeq ($(CONFIG_RSBAC_PM),y)
SUB_DIRS += pm
O_OBJS   += pm/pm.o
endif

ifeq ($(CONFIG_RSBAC_MS),y)
ifneq ($(CONFIG_RSBAC_MAINT),y)
SUB_DIRS += ms
O_OBJS   += ms/ms.o
endif
endif

ifeq ($(CONFIG_RSBAC_FF),y)
ifneq ($(CONFIG_RSBAC_MAINT),y)
SUB_DIRS += ff
O_OBJS   += ff/ff.o
endif
endif

ifeq ($(CONFIG_RSBAC_RC),y)
SUB_DIRS += rc
O_OBJS   += rc/rc.o
endif

ifeq ($(CONFIG_RSBAC_AUTH),y)
SUB_DIRS += auth
O_OBJS   += auth/auth.o
endif

ifeq ($(CONFIG_RSBAC_REG),y)
SUB_DIRS += reg
MOD_SUB_DIRS += reg
O_OBJS   += reg/reg.o
endif

ifeq ($(CONFIG_RSBAC_ACL),y)
SUB_DIRS += acl
O_OBJS   += acl/acl.o
endif

ifeq ($(CONFIG_RSBAC_CAP),y)
ifneq ($(CONFIG_RSBAC_MAINT),y)
SUB_DIRS += cap
O_OBJS   += cap/cap.o
endif
endif

ifeq ($(CONFIG_RSBAC_JAIL),y)
SUB_DIRS += jail
O_OBJS   += jail/jail.o
endif

ifeq ($(CONFIG_RSBAC_RES),y)
ifneq ($(CONFIG_RSBAC_MAINT),y)
SUB_DIRS += res
O_OBJS   += res/res.o
endif
endif

else

obj-y   := adf_main.o
export-objs += adf_main.o

ifeq ($(CONFIG_RSBAC_DEBUG),y)
obj-y   += adf_check.o
endif

# Adding policies
subdir-$(CONFIG_RSBAC_MAC) += mac
obj-$(CONFIG_RSBAC_MAC) += mac/mac.o

ifneq ($(CONFIG_RSBAC_MAINT),y)
subdir-$(CONFIG_RSBAC_FC) += fc
obj-$(CONFIG_RSBAC_FC) += fc/fc.o
endif

ifneq ($(CONFIG_RSBAC_MAINT),y)
subdir-$(CONFIG_RSBAC_SIM) += sim
obj-$(CONFIG_RSBAC_SIM) += sim/sim.o
endif

subdir-$(CONFIG_RSBAC_PM) += pm
obj-$(CONFIG_RSBAC_PM) += pm/pm.o

ifneq ($(CONFIG_RSBAC_MAINT),y)
subdir-$(CONFIG_RSBAC_MS) += ms
obj-$(CONFIG_RSBAC_MS) += ms/ms.o
endif

ifneq ($(CONFIG_RSBAC_MAINT),y)
subdir-$(CONFIG_RSBAC_FF) += ff
obj-$(CONFIG_RSBAC_FF) += ff/ff.o
endif

subdir-$(CONFIG_RSBAC_RC) += rc
obj-$(CONFIG_RSBAC_RC) += rc/rc.o

subdir-$(CONFIG_RSBAC_AUTH) += auth
obj-$(CONFIG_RSBAC_AUTH) += auth/auth.o

subdir-$(CONFIG_RSBAC_ACL) += acl
obj-$(CONFIG_RSBAC_ACL) += acl/acl.o

ifneq ($(CONFIG_RSBAC_MAINT),y)
subdir-$(CONFIG_RSBAC_CAP) += cap
obj-$(CONFIG_RSBAC_CAP) += cap/cap.o
endif

subdir-$(CONFIG_RSBAC_JAIL) += jail
obj-$(CONFIG_RSBAC_JAIL) += jail/jail.o

ifneq ($(CONFIG_RSBAC_MAINT),y)
subdir-$(CONFIG_RSBAC_RES) += res
obj-$(CONFIG_RSBAC_RES) += res/res.o
endif

subdir-$(CONFIG_RSBAC_REG) += reg
obj-$(CONFIG_RSBAC_REG) += reg/reg.o
subdir-m += reg

endif

include $(TOPDIR)/Rules.make
