# Makefile for 680x0 Linux filesystem source directory
#
# Copyright 1993 by Hamish Macdonald
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "README.legal" in the main directory of this archive
# for more details.

include ../.config
include ../MakeVars

SUBDIRS    = minix ext msdos proc isofs nfs xiafs affs
FS_SUBDIRS = minix affs

ifdef CONFIG_BINFMT_ELF
BINFMTS := $(BINFMTS) binfmt_elf.o
endif

OBJS=	open.o read_write.o inode.o devices.o file_table.o buffer.o super.o \
	block_dev.o stat.o exec.o pipe.o namei.o fcntl.o ioctl.o \
	select.o fifo.o locks.o filesystems.o $(BINFMTS)

all: fs.o filesystems.a

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

filesystems.a: dummy
	$(RM) filesystems.a
	@for i in $(FS_SUBDIRS); do [ ! -d $$i ] || \
		(cd $$i && echo cd $$i && $(MAKE) $(MFLAGS) && \
		$(AR) ruv ../filesystems.a $$i.o) || exit; done
	$(RANLIB) filesystems.a

clean:
	$(RM) $(RMFLAGS) *.o *.a
	for i in $(SUBDIRS); do ([ -d $$i ] && cd $$i && $(MAKE) $(MFLAGS) clean); done || exit 0

dep:
	$(CPP) -M $(INCFLAGS) *.c > .depend
	for i in $(SUBDIRS); do [ ! -d $$i ] || (cd $$i && $(MAKE) $(MFLAGS) dep) || exit; done

dummy:

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