# srr/mod/Makefile
#
# $Id: Makefile,v 1.18 2001/07/26 18:26:53 andrew Exp $
#

# Change it here or specify it on the "make" commandline
# This directory may not exist if you do not have the kernel source
# installed, which is OK unless you are running an installation
# like RedHat 7.0.  If this directory is absent, try using
#     INCLUDEDIR = /usr/include
# If you are running RedHat 7.0 (and possibly others) you need to
# install the kernel source to build a module.

INCLUDEDIR = /usr/src/linux/include

# add flags for kernel module compilation
CFLAGS = -Wall -D__KERNEL__ -DMODULE -DLINUX -I$(INCLUDEDIR) -I../inc

# Export SRRDEBUG=y to enable debugging, at quite a performance penalty.
ifeq ($(SRRDEBUG),n)
  CFLAGS += -O2
else
  CFLAGS += -O -g -DSRR_DEBUG # "-O" is needed to expand inlines
endif

MOD = srripc
SRC	= $(wildcard *.c)
OBJ	= $(SRC:.c=.o)

all: deps $(MOD).o

$(MOD).o: $(OBJ)
	$(LD) -m elf_i386 -r $^ -o $@

load:
	-@SRRPATH=. ../exe/srrmodule testload

unload:
	-@SRRPATH=. ../exe/srrmodule unload

deps:
	@$(CC) -M $(CFLAGS) $(SRC) > .depend

clean:
	rm -f $(OBJ)

empty: clean
	rm -f .depend $(MOD).o

tail:
	tail -f /var/log/kmsg

zero:
	cat /dev/null > /var/log/kmsg

-include .depend


# DO NOT DELETE


