###########################################################################
#
# Makefile for the Linux 2.2 Kernel Interface for the Lomac LKM.
#  
###########################################################################

###########################################################################
# 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

CCFLAGS	= -O3 -Wall -Wstrict-prototypes -Winline -D__KERNEL__ \
	  -fomit-frame-pointer -DMODULE -DPARANOID \
	  -I../../Core -I. -I$(KERNELHEADERS)

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


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

TARGET	= arch.o
OBJS	= kernel_lkm.o kernel_wrappers.o kernel_interface.o kernel_driver.o \
	  kernel_util.o kernel_binfmt.o 

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

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

# this rule copies $(TARGET) to the parent directory where a higher-level
# Makefile can use it as part of the complete LOMAC LKM.
all : $(TARGET)

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

clean :
	$(RM) *.o


