# *** NOTE ***
# This makefile is set up for DOS (DJGPP).  It will need some (small)
# changes to build under Unix.  See notes in comments below, marked with ***

# sources
# *** note the first one, that's the absolute I/O source module.  Change
# *** this to the one appropriate for your OS, for example unxabsio.c
# *** in the case of Unix.

SRCS=\
	djabsio.c \
	rstsflx.c \
	fip.c \
	rtime.c \
	filename.c \
	doget.c \
	dolist.c \
	doalloc.c \
	docomp.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 \
        platform.h \
	fip.h \
	rtime.h \
	filename.h \
	doget.h \
	dolist.h \
	doalloc.h \
	docomp.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 \
	docomp.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 \
	absio.o

# Flags and the like

# *** change the two lines below as needed for your C compiler.
CC= gcc
CFLAGS= -O3

# Rules

# ***  comment out or delete this first rule if not building on DOS
flx.exe: flx
	strip flx
	coff2exe -s /djgpp/bin/go32.exe flx

flx: $(OBJS)
	$(CC) -o flx $(OBJS)

# *** you can enable the rule below if you have a compiler that
# *** supports the -protoi switch (for example cc in DEC Ultrix).

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

# *** the rule below builds absio.o.  You need to use as source file
# *** an appropriate file; in Unix that's probably unxabsio.c but check
# *** the source file to be sure.

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

# general build rule for all other object files:
.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.
# *** it doesn't actually matter so long as you don't try "make proto"
# *** in the case where your compiler can't do that...

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 > docomp.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 docomp.c
	mv docomp.H docomp.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
docomp.h: docomp.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
scancmd.h: scancmd.c
rstsflx.h: rstsflx.c
fileio.h: fileio.c

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