#
# Makefile for the linux ncp-filesystem routines.
#

KERNEL = 1.2

INCLUDES =  -I/usr/src/linux/include -Ikernel
BINDIR = ./bin

CFLAGS = -Wall $(INCLUDES)
CC = gcc

all: kernel
	make -C util
	make -C kernel/src ncpfs.o
	cp kernel/src/ncpfs.o bin

kernel:
	rm -f kernel
	ln -s kernel-$(KERNEL) kernel

dep:
	$(CPP) -M $(INCLUDES) *.c > .depend

clean:
	rm -f kernel
	rm -f `find . -type f -name '*.o' -print`
	rm -f `find . -type f -name '*~' -print`
	rm -f `find . -type f -name '.depend' -print`
	rm -f `find . -type f -name '*.out' -print`


realclean: clean
	rm -fr bin/* ncpfs.tgz
	make -C util realclean

modules: ncpfs.o

SRCPATH=$(shell pwd)
SRCDIR=$(shell basename $(SRCPATH))
DISTFILE=$(SRCDIR).tgz

dist: realclean
	(cd ..; \
         tar cvf - $(SRCDIR) | \
            gzip -9 > $(DISTFILE); \
         mv $(DISTFILE) $(SRCDIR))

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
