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

KERNEL = 1.2

INCLUDES =  -I/usr/src/linux/include -Ikernel
BINDIR = ./bin
SUBDIRS = kernel-$(KERNEL)/src util ipx-0.75

CFLAGS = -Wall $(INCLUDES)
CC = gcc

all: kernel
	for i in $(SUBDIRS); do make -C $$i; done
	cp kernel/src/ncpfs.o bin

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

dep:
	for i in $(SUBDIRS); do	make -C $$i dep; done

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`
	for i in $(SUBDIRS); do	make -C $$i clean; done

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
