# Build the CH375 module against the installed 2.2.6 kernel tree, a second
# copy against 2.2.26 (the Book386 kernel; its block structs differ, so one
# .o cannot serve both), and the userspace protocol test.

KERNEL = /usr/src/linux
KERNEL2226 = /usr/src/linux-2.2.26
CC = gcc
KFLAGS = -D__KERNEL__ -DMODULE -Wall -Wstrict-prototypes \
        -O2 -fomit-frame-pointer -fno-strength-reduce -pipe -m386 -DCPU=386

all: ch375.o ch375-2.2.26.o sim/ch375sim

ch375.o: ch375.c ch375_hw.h
        $(CC) $(KFLAGS) -I$(KERNEL)/include -c ch375.c

ch375-2.2.26.o: ch375.c ch375_hw.h
        $(CC) $(KFLAGS) -I$(KERNEL2226)/include -c ch375.c -o ch375-2.2.26.o

sim/ch375sim: sim/ch375sim.c ch375_hw.h
        $(CC) -O -Wall -o sim/ch375sim sim/ch375sim.c

test: sim/ch375sim
        ./sim/ch375sim

clean:
        rm -f ch375.o ch375-2.2.26.o sim/ch375sim

