# Copyright (c) 1991, 1992 by Frank J. Edwards
# See the file COPYRIGHT in this distribution for copyright details.

# Uncomment the next line if you have the programs "fixproto" and "mkptypes",
# and the subdirectory ".proto".  They are not part of the distribution.
#PROTOS	= `test -d .proto && echo ' -DUSE_PROTOS'`

DEBUG	= -DNO_PARALLEL -DNO_SERIAL # -DNO_PRINTF -DNO_STRLOG
COPTS	= -O $(DEBUG) $(PROTOS)
CFLAGS	= $(COPTS) -DSYSV -D_KERNEL -I/usr/sys/amiga/driver -I/usr/sys/amiga/inc
PROTO_H	= ados_proto.h

OBJ = blocks.o debug.o subr.o subr2.o util.o vfsops.o vnops.o
SRC = $(OBJ:.o=.c)
HDR = ados.h ados_root.h ados_defs.h ados_date.h \
	ados_anode.h ados_dir.h ados_proto.h ados_vfs.h missing.h

.PHONY: clean ci

.c.o:
	gcc $(CFLAGS) -c $<

exp:    ./fixproto tags $(OBJ)
	ld -r -o exp $(OBJ)

$(OBJ): $(HDR)

clean:
	-rm -f $(OBJ) exp ../exp ../../exp

cflow:	$(SRC)
	cflow $(CFLOW) $(CFLAGS) -Dlint $(SRC) > $@

tags:	$(SRC)
	-ctags $(SRC)

ci:	RCS
RCS:	Makefile README TODO $(HDR) $(SRC)
	-ci -l $(CIFLAGS) $?

./fixproto:
	if test -x $@ -a -d .proto; then			\
	    CFLAGS="$(CFLAGS)" $@ -p "$(PROTO_H)" $(SRC);	\
	    cmp -s .proto/.pro "$(PROTO_H)" ||			\
		cp .proto/.pro "$(PROTO_H)";			\
	fi
