#
# Makefile for the linux userfs-filesystem routines.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...

.c.s:
	$(CC) $(CFLAGS) -S $<
.c.o:
	$(CC) $(CFLAGS) -c $<
.s.o:
	$(AS) -o $*.o $<

TOP=../..
GENDIR=$(TOP)/genser
GENHDR=$(GENDIR)/genhdr
GENCODE=$(GENDIR)/gencode
INCL=$(TOP)/kernel/linux

# If you're using Linux 1.1.11 or later, define AFTER1_1_11
# If you're using the new TTY driver patches or Linux 1.1.13 or later,
# define AFTER1_1_13.

DEFINES=-DAFTER1_1_13
CFLAGS=-I.. -O2 -fomit-frame-pointer $(DEFINES) -D__KERNEL__ -DMODULE -Wall

all:	userfs.o


typedir: userfs_types.ty types
	rm -f types/*
	$(GENCODE) -sedl types userfs_types.ty
	rm -f types/encode*_r.c types/decode*_s.c
	cd types; for i in *.c ; do echo $$i: ; $(CC) -I.. $(CFLAGS) -c $$i; done
	touch typedir

OBJS=	 inode.o file.o super.o uio.o userfs_types.o module.o release.o

types: dummy
	mkdir types

release.c: dummy
	echo "char kernel_version[] = \"`uname -r`\";" > release.c

userfs.o: $(OBJS)
	$(LD) -r -o userfs.o $(OBJS)

types.a: typedir
	rm -f types.a
	$(AR) r types.a types/*.o
	ranlib types.a

clean:
	rm -f core *.o *.a *.s *~
	rm -f types/* typedir types.a

depend dep: $(INCL)/userfs_types.h
	$(CPP) $(CFLAGS) -M *.c > .depend

dummy:

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