# Intel(R) ESB Watchdog Timer Kernel Module Makefile

KERNELDIR = /usr/src/linux-2.4.21-20.EL
INCLUDEDIR = $(KERNELDIR)/include

# We need the configuration file, for CONFIG_SMP and possibly other stuff
# (especiall for RISC platforms, where CFLAGS depends on the exact
# processor being used).
ifeq ($(KERNELDIR)/.config,$(wildcard $(KERNELDIR))/.config)
	include $(KERNELDIR)/.config
else
	MESSAGE := $(shell echo "WARNING: no .config file in $(KERNELDIR)")
endif

# CFLAGS: all assignments to CFLAGS are inclremental, so you can specify
# the initial flags on the command line or environment, if needed.

	CFLAGS +=  -Wall -D__KERNEL__ -DMODULE -O2 -I$(INCLUDEDIR)

ifdef CONFIG_SMP
	CFLAGS += -D__SMP__ -DSMP
endif

# Prepend modversions.h if we're running with versioning.
ifdef CONFIG_MODVERSIONS
	CFLAGS += -DMODVERSIONS -include $(KERNELDIR)/include/linux/modversions.h
endif

#Install dir
VERSIONFILE = $(INCLUDEDIR)/linux/version.h
VERSION     = $(shell awk -F\" '/REL/ {print $$2}' $(VERSIONFILE))
#INSTALLDIR = /lib/modules/$(VERSION)/misc

OBJS = esbwdt.o

all: $(OBJS)

install:
	$(MAKE)
	install esbwdt.o /lib/modules/$(VERSION)/kernel/drivers/char
	test -c /dev/watchdog || mknod -m 600 /dev/watchdog c 10 130

clean:
	rm -f *.o *~ core
