#
# Makefile for audiodev, audioflush and the corresponding manpages.
# Everything must be compiled with 16-bit integers.
#

CC     = gcc
AS     = gcc -c
ZOO    = zoo

CFLAGS = -mshort -Wall $(OPTIM)
LFLAGS = -mshort -s
OPTIM  = -O2 -fomit-frame-pointer

all: programs # manpages

#
# The executables. On Minix partitions we have to set their 'x' bit because
# older versions of the Gcc won't do it automatically. The 'makefast'
# utility sets the fastload bit of the executables; if you don't have it
# you can ignore it, or use 'toglclr' or 'prgflags' instead.
#

OBJ1   = audiodev.o dmasound.o
AUDIODEV  = audiodev.ttp

OBJ2   = audioflush.o
AUDIOFLS  = audioflush.ttp

programs: $(AUDIODEV) $(AUDIOFLS)

$(AUDIODEV): $(OBJ1)
	$(CC) -o $(AUDIODEV) $(OBJ1) $(LFLAGS)
	chmod +x $(AUDIODEV)
	: makefast $(AUDIODEV)

$(AUDIOFLS): $(OBJ2)
	$(CC) -o $(AUDIOFLS) $(OBJ2) $(LFLAGS)
	chmod +x $(AUDIOFLS)
	: makefast $(AUDIOFLS)

clean:
	rm -f *.o *.ttp *.asc

#
# Man pages. The .asc files are already provided in the archive, so
# you probably won't need this rules.
#

#manpages: audiodev.asc audioflush.asc
#
#audiodev.asc: audiodev.8
#	cawf -man -fn audiodev.8 > audiodev.asc
#
#audioflush.asc: audioflush.1
#	cawf -man -fn audioflush.1 > audioflush.asc

#
# Dependencies
#

#audiodev.o : audiodev.c audiodev.h filesys.h atarierr.h
#dmasound.o : dmasound.s
#audioflush.o: audioflush.c audiodev.h filesys.h atarierr.h

#
# Archiving
#

#SOURCES = \
#	atarierr.h filesys.h COPYING \
#	Makefile README audiodev.8 audioflush.1 \
#	dmasound.s audiodev.h audiodev.c audioflush.c

#OTHER_FILES = \
#	$(AUDIODEV) audiodev.asc \
#	$(AUDIOFLS) audioflush.asc

#ARCHIVE_DIR = /h/Archives

#archive:
#	$(ZOO) aunhP: Lpdev $(SOURCES) $(OTHER_FILES)
#	cp -a Lpdev.zoo $(ARCHIVE_DIR)
