# On a PC, cpp and cem are in /lib and will be removed to make space while
# linking the kernel.  On an AT, they are in /usr/lib are are not removed.
# This is because they have to be in /lib on a PC; the diskette is too small
# for them to be in /usr/lib.
#
# This makefile has been modified for separate-directory compilation
# ("newboot" project).
#
CFLAGS	= -Di8088 -T. -I. -I../../fs
H	= ../../h
# h	= h/const.h
h	= ../../h
F	= ../../fs
f	= ../../fs
L=/usr/lib

obj =	main.s open.s read.s write.s pipe.s device.s \
	path.s mount.s link.s super.s inode.s cache.s filedes.s \
	stadir.s protect.s time.s misc.s utility.s table.s putc.s

fs:	makefile   $L/head.s $(obj) $L/libc.a $L/end.s
	@echo "Start linking FS.  "
	@cc -i -o fs -T. $(obj) ../lib/syslib.s
#	@asld  -o fs -T. $L/head.s $(obj) ../lib/syslib.s $L/libc.a $L/end.s
	@chmem =2000 fs
	@echo "FS done.  "

clean:
	rm -f $(obj)

cache.s:	$F/const.h $F/type.h $h/const.h $H/type.h
cache.s:	$H/error.h
cache.s:	$F/buf.h
cache.s:	$F/file.h
cache.s:	$F/fproc.h
cache.s:	$F/glo.h
cache.s:	$F/inode.h
cache.s:	$F/super.h
cache.s:	cache.c
	$(CC) $(CFLAGS) -c cache.c

device.s:	$F/const.h $F/type.h $h/const.h $H/type.h
device.s:	$H/com.h
device.s:	$H/error.h
device.s:	$F/dev.h
device.s:	$F/file.h
device.s:	$F/fproc.h
device.s:	$F/glo.h
device.s:	$F/inode.h
device.s:	$F/param.h
	$(CC) $(CFLAGS) -c $f/device.c

filedes.s:	$F/const.h $F/type.h $H/const.h $H/type.h
filedes.s:	$H/error.h
filedes.s:	$F/file.h
filedes.s:	$F/fproc.h
filedes.s:	$F/glo.h
filedes.s:	$F/inode.h
	$(CC) $(CFLAGS) -c $f/filedes.c

inode.s:	$F/const.h $F/type.h $h/const.h $H/type.h
inode.s:	$H/error.h
inode.s:	$F/buf.h
inode.s:	$F/file.h
inode.s:	$F/fproc.h
inode.s:	$F/glo.h
inode.s:	$F/inode.h
inode.s:	$F/super.h
inode.s:	inode.c
	$(CC) $(CFLAGS) -c inode.c

link.s:		$F/const.h $F/type.h $H/const.h $H/type.h
link.s:		$H/error.h
link.s:		$F/buf.h
link.s:		$F/file.h
link.s:		$F/fproc.h
link.s:		$F/glo.h
link.s:		$F/inode.h
link.s:		$F/param.h
	$(CC) $(CFLAGS) -c $f/link.c

main.s:		$F/const.h $F/type.h $h/const.h $H/type.h
main.s:		$H/callnr.h
main.s:		$h/com.h
main.s:		$H/error.h
main.s:		$F/buf.h
main.s:		$F/file.h
main.s:		$F/fproc.h
main.s:		$F/glo.h
main.s:		$F/inode.h
main.s:		$F/param.h
main.s:		$F/super.h
main.s:		main.c
	$(CC) $(CFLAGS) -c main.c

misc.s:		$F/const.h $F/type.h $h/const.h $H/type.h
misc.s:		$H/callnr.h
misc.s:		$H/com.h
misc.s:		$H/error.h
misc.s:		$F/buf.h
misc.s:		$F/file.h
misc.s:		$F/fproc.h
misc.s:		$F/glo.h
misc.s:		$F/inode.h
misc.s:		$F/param.h
misc.s:		$F/super.h
misc.s:		misc.c
	$(CC) $(CFLAGS) -c misc.c

mount.s:	$F/const.h $F/type.h $h/const.h $H/type.h
mount.s:	$H/error.h
mount.s:	$F/buf.h
mount.s:	$F/file.h
mount.s:	$F/fproc.h
mount.s:	$F/glo.h
mount.s:	$F/inode.h
mount.s:	$F/param.h
mount.s:	$F/super.h
	$(CC) $(CFLAGS) -c $f/mount.c

open.s:		$F/const.h $F/type.h $H/const.h $H/type.h
open.s:		$H/callnr.h
open.s:		$H/error.h
open.s:		$F/buf.h
open.s:		$F/file.h
open.s:		$F/fproc.h
open.s:		$F/glo.h
open.s:		$F/inode.h
open.s:		$F/param.h
	$(CC) $(CFLAGS) -c $f/open.c

path.s:		$F/const.h $F/type.h $H/const.h $H/type.h
path.s:		$H/error.h
path.s:		$F/buf.h
path.s:		$F/file.h
path.s:		$F/fproc.h
path.s:		$F/glo.h
path.s:		$F/inode.h
path.s:		$F/super.h
	$(CC) $(CFLAGS) -c $f/path.c

pipe.s:		$F/const.h $F/type.h $H/const.h $H/type.h
pipe.s:		$H/callnr.h
pipe.s:		$H/com.h
pipe.s:		$H/error.h
pipe.s:		$H/signal.h
pipe.s:		$F/file.h
pipe.s:		$F/fproc.h
pipe.s:		$F/glo.h
pipe.s:		$F/inode.h
pipe.s:		$F/param.h
	$(CC) $(CFLAGS) -c $f/pipe.c

protect.s:	$F/const.h $F/type.h $H/const.h $H/type.h
protect.s:	$H/error.h
protect.s:	$F/buf.h
protect.s:	$F/file.h
protect.s:	$F/fproc.h
protect.s:	$F/glo.h
protect.s:	$F/inode.h
protect.s:	$F/param.h
protect.s:	$F/super.h
	$(CC) $(CFLAGS) -c $f/protect.c

putc.s:		$F/const.h $F/type.h $H/const.h $H/type.h
putc.s:		$H/com.h
	$(CC) $(CFLAGS) -c $f/putc.c

read.s:		$F/const.h $F/type.h $h/const.h $H/type.h
read.s:		$H/com.h
read.s:		$H/error.h
read.s:		$F/buf.h
read.s:		$F/file.h
read.s:		$F/fproc.h
read.s:		$F/glo.h
read.s:		$F/inode.h
read.s:		$F/param.h
read.s:		$F/super.h
	$(CC) $(CFLAGS) -c $f/read.c

stadir.s:	$F/const.h $F/type.h $H/const.h $H/type.h
stadir.s:	$H/error.h
stadir.s:	$H/stat.h
stadir.s:	$F/file.h
stadir.s:	$F/fproc.h
stadir.s:	$F/glo.h
stadir.s:	$F/inode.h
stadir.s:	$F/param.h
	$(CC) $(CFLAGS) -c $f/stadir.c

super.s:	$F/const.h $F/type.h $h/const.h $H/type.h
super.s:	$H/error.h
super.s:	$F/buf.h
super.s:	$F/inode.h
super.s:	$F/super.h
super.s:	super.c
	$(CC) $(CFLAGS) -c super.c

table.s:	$F/const.h $F/type.h $H/const.h $H/type.h
table.s:	$H/com.h
table.s:	$H/callnr.h
table.s:	$H/error.h
table.s:	$H/stat.h
table.s:	$F/buf.h
table.s:	$F/dev.h
table.s:	$F/file.h
table.s:	$F/fproc.h
table.s:	$F/glo.h
table.s:	$F/inode.h
table.s:	$F/super.h
	$(CC) $(CFLAGS) -c $f/table.c

time.s:		$F/const.h $F/type.h $H/const.h $H/type.h
time.s:		$H/callnr.h
time.s:		$H/com.h
time.s:		$H/error.h
time.s:		$F/file.h
time.s:		$F/fproc.h
time.s:		$F/glo.h
time.s:		$F/inode.h
time.s:		$F/param.h
	$(CC) $(CFLAGS) -c $f/time.c

utility.s:	$F/const.h $F/type.h $h/const.h $H/type.h
utility.s:	$H/com.h
utility.s:	$H/error.h
utility.s:	$F/buf.h
utility.s:	$F/file.h
utility.s:	$F/fproc.h
utility.s:	$F/glo.h
utility.s:	$F/inode.h
utility.s:	$F/param.h
utility.s:	$F/super.h
utility.s:	utility.c
	$(CC) $(CFLAGS) -c utility.c

write.s:	$F/const.h $F/type.h $H/const.h $H/type.h
write.s:	$H/error.h
write.s:	$F/buf.h
write.s:	$F/file.h
write.s:	$F/fproc.h
write.s:	$F/glo.h
write.s:	$F/inode.h
write.s:	$F/super.h
	$(CC) $(CFLAGS) -c $f/write.c
