# sources
SRCS=\
	rstsflx.c \
	fip.c \
	rtime.c \
	filename.c \
	doget.c \
	dolist.c \
	doalloc.c \
	dotype.c \
	doput.c \
	dodump.c \
	dodelete.c \
	dorename.c \
	dorts.c \
	doprot.c \
	dodir.c \
	doident.c \
	doinit.c \
	dohook.c \
	scancmd.c \
	fileio.c \
	diskio.c

# prototype header files (none for rstsflx.c and scancmd.c)
PROTOS=\
	rstsflx.h \
	fip.h \
	rtime.h \
	filename.h \
	doget.h \
	dolist.h \
	doalloc.h \
	dotype.h \
	doput.h \
	dodump.h \
	dodelete.h \
	dorename.h \
	dorts.h \
	doprot.h \
	dodir.h \
	doident.h \
	doinit.h \
	doinit.h \
	scancmd.h \
	fileio.h \
	diskio.h

# objects
OBJS=\
	rstsflx.o \
	fip.o \
	rtime.o \
	filename.o \
	doget.o \
	dolist.o \
	doalloc.o \
	dotype.o \
	doput.o \
	dodump.o \
	dodelete.o \
	dorename.o \
	dorts.o \
	doprot.o \
	dodir.o \
	doident.o \
	doinit.o \
	dohook.o \
	scancmd.o \
	fileio.o \
	diskio.o

# Flags and the like

CC= gcc
CFLAGS= -O3

# Rules
flx: $(OBJS)
	$(CC) -o flx $(OBJS)
	strip flx

flx.exe: flx
	coff2exe -s /djgpp/bin/go32.exe flx

# the next rule depends on a compiler that supports -protoi (gcc doesn't)

.c.h:
#	cat /dev/null > $*.h
#	cc -protoi $<
#	mv $*.H $*.h

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

# ideally the rule below would read:
#	gcc -MM $(SRCS) > flx.dep
# but that's too long a command line to pass in DOS, so we'll do it the
# simple way...

depend:
	gcc -MM *.c > flx.dep

# note: "proto" depends on a cc that supports the -protoi switch;
# gcc does not support it.

proto:
	cat /dev/null > fip.h
	cat /dev/null > diskio.h
	cat /dev/null > rtime.h
	cat /dev/null > filename.h
	cat /dev/null > doget.h
	cat /dev/null > dolist.h
	cat /dev/null > doalloc.h
	cat /dev/null > dotype.h
	cat /dev/null > doput.h
	cat /dev/null > dodump.h
	cat /dev/null > dodelete.h
	cat /dev/null > dorename.h
	cat /dev/null > dorts.h
	cat /dev/null > doprot.h
	cat /dev/null > dodir.h
	cat /dev/null > doident.h
	cat /dev/null > doinit.h
	cat /dev/null > dohook.h
	cat /dev/null > fileio.h
	cat /dev/null > scancmd.h
	cat /dev/null > rstsflx.h
	cc -protoi fip.c
	mv fip.H fip.h
	cc -protoi diskio.c
	mv diskio.H diskio.h
	cc -protoi rtime.c
	mv rtime.H rtime.h
	cc -protoi filename.c
	mv filename.H filename.h
	cc -protoi doget.c
	mv doget.H doget.h
	cc -protoi dolist.c
	mv dolist.H dolist.h
	cc -protoi doalloc.c
	mv doalloc.H doalloc.h
	cc -protoi dotype.c
	mv dotype.H dotype.h
	cc -protoi doput.c
	mv doput.H doput.h
	cc -protoi dodump.c
	mv dodump.H dodump.h
	cc -protoi dodelete.c
	mv dodelete.H dodelete.h
	cc -protoi dorename.c
	mv dorename.H dorename.h
	cc -protoi dorts.c
	mv dorts.H dorts.h
	cc -protoi doprot.c
	mv doprot.H doprot.h
	cc -protoi dodir.c
	mv dodir.H dodir.h
	cc -protoi doident.c
	mv doident.H doident.h
	cc -protoi doinit.c
	mv doinit.H doinit.h
	cc -protoi dohook.c
	mv dohook.H dohook.h
	cc -protoi fileio.c
	mv fileio.H fileio.h
	cc -protoi scancmd.c
	mv scancmd.H scancmd.h
	cc -protoi rstsflx.c
	mv rstsflx.H rstsflx.h

# dependencies

fip.h: fip.c
diskio.h: diskio.c
rtime.h: rtime.c
filename.h: filename.c
doget.h: doget.c
dolist.h: dolist.c
doalloc.h: doalloc.c
dotype.h: dotype.c
doput.h: doput.c
dodump.h: dodump.c
dodelete.h: dodelete.c
dorename.h: dorename.c
dorts.h: dorts.c
doprot.h: doprot.c
dodir.h: dodir.c
doident.h: doident.c
doinit.h: doinit.c
dohook.h: dohook.c
doalloc.h: doalloc.c
scancmd.h: scancmd.c
rstsflx.h: rstsflx.c
fileio.h: fileio.c

# the one below is created by make depend
include flx.dep
                                                                                                                                                                   