###########################################################################
#
# Makefile for architecture-independent Core of the Lomac LKM.
#  
# input variables:
#   ARCH   must be set to dir of architecture for which we want to build.
#          Example:  ARCH = ../Arch/Linux2.2
#
###########################################################################

ARCH	= ../Arch/Linux2.2

###########################################################################
# User-configurable variables
###########################################################################

# some useful programs, should be OK as is.
#
CC 	= gcc
LD 	= ld
RM	= rm -f

# Set KERNELHEADERS to the directory that contains the kernel header
# files for the kernel version you intend to run with LOMAC.
#
# Value for RedHat:
# /usr/src/linux/include 
# 
# Value for Debian:
# /usr/src/kernel-source-2.2.17/include
# (change the version number to match yours)
#
KERNELHEADERS = /usr/src/linux/include

# Add -DNO_MEDIATION to CCFLAGS to build a version of LOMAC that logs
# denials, but does not actually deny operations.   (Useful for testing.)
#
# Include -DTRUST in CCFLAGS to produce a configuration of LOMAC that
# allows processes running "trusted" programs to avoid demotion.  The
# default policy is tailored towards configurations that include this
# feature; if you turn it off, you will have to modify the default policy.
#
CCFLAGS	= -O3 -Wall -Wstrict-prototypes -Winline -D__KERNEL__ \
	  -fomit-frame-pointer -DMODULE -DPARANOID -DTRUST \
	  -I. -I$(ARCH) -I$(KERNELHEADERS)

# linker flags, should be OK as is.
#
LDFLAGS	= -r


###########################################################################
# Rules that shouldn't need user-configuration.
###########################################################################

TARGET	= core.o
OBJS	= lomac_mediate.o lomac_monitor.o \
	  lomac_plm.o lomac_log.o lomac_tpl.o

.c.o :
	$(CC) $(CCFLAGS) -c $<

$(TARGET) : $(OBJS)
	$(LD) $(LDFLAGS) -o $(TARGET) $(OBJS)

# This rule copies core.o to a higher-level directory where some
# higher-level makefile can use it to build a complete LKM.
all : $(TARGET)

#
# Make clean rule, for convenience...
#

clean :
	$(RM) *.o


