# This Makefile is derived from the Linux 1.2.11 main Makefile.
# Author: Christian Starkjohann
#
# This and the subdirectory Makefiles must be run by GNU-Make.

.EXPORT_ALL_VARIABLES:

NAME=vmount

TOPDIR	:=	$(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
SUBDIRS =nfs fs
#CFLAGS = -Wall -O2 -g
CFLAGS = -Wall -O2 -traditional-cpp 
# Use the -traditional-cpp option for NeXT's cc!
# The '-fomit-frame-pointer' option may be necessary for some inline
# assembler code to work (especially asm/string.h, but most of this has
# been disabled already). Unfortunately it makes debugging impossible.
# And unfortunately the program crashes with a bus error when this option
# is turned on.

MYINCL = $(TOPDIR)/my_include
INCL = $(TOPDIR)/include

AS	=as
LD	=ld
CC	=cc -I$(MYINCL) -I$(INCL) -D__KERNEL__
HOSTCC	=cc -I$(MYINCL) -I$(INCL)
# Header files in $(MYINCL) may override those of $(INCL)!
CPP	=$(CC) -E
AR	=ar
NM	=nm
STRIP	=strip


include $(TOPDIR)/config.make


OFILES = main.o dummies.o buffers.o missing.o cache.o file_ops.o	\
			id_translate.o

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

all: vumount $(NAME)

# the fs_dir rule makes just the fs/* subdirectories
fs_dir:
	$(MAKE) -C fs

filesystems:
	set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done

depend dep:
	set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i dep; done

vumount: vumount.o
	$(CC) -o vumount vumount.o

$(NAME): $(OFILES) filesystems
	$(CC) -o $(NAME) $(OFILES) nfs/nfs.o fs/filesystems.a

clean:	# burte force clean
	rm -f `find . -name '*.o' -print`
	rm -f fs/filesystems.a $(NAME)
