# $Header: /afs/net.mit.edu/user/foley/src/CVSROOT/morse/Makefile.in,v 1.2 1997/08/29 22:31:44 foley Exp $
#
# **** WARNING!!!! - Use configure options to configure things
# **** otherwise they may be replaced next time you run "configure"
#
# Select your audio output device.  Current choices are:
#
#   Sun:   Sun workstation with audio hardware.
#   HP:    HP9000s700 with audio hardware.
#   X11:   The X11 window system.
#   Indigo: SGI Indigo workstation.
#   Linux: IBM PC Console running Linux.
#
# Adding a new device is as simple as creating a new implementation of the
# beep.h interface.  See beep*.c for examples.  Please send any additions
# to the authors!
#
DEVICE = @DEVICE@
#DEVICE = Sun
#DEVICE = HP
#DEVICE = X11
#DEVICE = Indigo
#DEVICE = Linux
#
# For termio a la System V, add -DUSG to DEFINES. (Linux in particular needs
#   this.)
#
# For alternate random number generator, add either -DUSELRAND for lrand48(),
#   or -DUSERAND for (ugh) rand(). Default is -DUSERANDOM for random().
#
# Define SIGRET to be your signal handler return type if not "void".
#
# Define BSDSIGS or POSIXSIGS, depending on what kind of signals you
#   have. "Old-style" signals are not currently supported. Default is BSDSIGS.
#
# If the same speaker making the morse code beeps will also make ^G beeps
#   (which occur when you get a letter wrong), you may want to #define
#   ERROR_VOLUME to be 1.; this will cause the ^G beeps to be made using
#   the same routines that do the morse-code beeps, possibly preventing
#   conflicts. (If you prefer quieter error beeps, you can use anything
#   between 0. and 1.; if you want it the same volume as the morse-code
#   beeps, use "-DERROR_VOLUME=volume". If you don't like the pitch of
#   the error tone, you can override the default by #defining ERROR_FREQ to
#   be your favorite wake-up alarm frequency, in hertz.)
#
# On a Sun workstation you may want to compile with -DFULLVOLUME (see beepSun.c
#   for more details).
#
# For the semi-supported international character sets
#   add a "-funsigned-char -DALLOW_NON_INTL_MORSE" to the DEFINES line
#DEFINES = -DUSG -DERROR_VOLUME=1. -DERROR_FREQ=2000.
DEFINES=@DEFINES@

# The flags necessary to link with the X11 libraries.
#X11LIBS = -L/usr/X386/lib -lX11 -lsocket -lnsl
X11CFLAGS=@X_CFLAGS@
X11LIBS=${LIBS} @X_PRE_LIBS@ -lX11 @X_LIBS@ @X_EXTRA_LIBS@

# Any additional flags your favorite C compiler requires to work.
#CFLAGS  = -O -I/usr/X386/include -DSVR4 -DSYSV386 ${DEFINES}
CFLAGS=${DEBUG} @CPPFLAGS@ ${DEFINES}
LDFLAGS=${DEBUG}  @LDFLAGS@ ${LIBS}
LIBS=@LIBS@
DEBUG=@DEBUG_FLAGS@

# Not all platforms need the alarm signaling
ALARM=@ALARM@

# Makefile utils
LN=ln -s
RM=rm -f
CC=gcc
SHELL=/bin/sh
ENSUREDIR=$(srcdir)/common/ensure-dir.sh
INSTALL=@INSTALL@

# Autoconf stuff
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=$(exec_prefix)/bin
libdir=$(exec_prefix)/lib
mandir=$(prefix)/man
includedir=$(prefix)/include

VPATH=@srcdir@
srcdir=@srcdir@
top_srcdir=@top_srcdir@

default: all

morse:	morse${DEVICE}
	$(RM) $@
	$(LN) morse${DEVICE} $@	

#morse${DEVICE}:	morse.o beep${DEVICE}.o ${ALARM}
#	$(CC) -o $@ morse.o beep${DEVICE}.o ${ALARM} ${LDFLAGS}

morseX11:	morse.o beepX11.o alarm.o
	$(CC) -o $@ morse.o beepX11.o ${ALARM} $(X11LIBS) ${LDFLAGS} 

morseSun:	morse.o beepSun.o
	$(CC) -o $@ morse.o beepSun.o ${ALARM} ${LDFLAGS}

morseHP:	morse.o beepHP.o alarm.o
	$(CC) -o $@ morse.o beepHP.o ${ALARM} ${LDFLAGS}

morseIndigo:	morse.o beepIndigo.o
	$(CC) -o $@ morse.o beepIndigo.o ${ALARM} ${LDFLAGS}

morseLinux:	morse.o beepLinux.o alarm.o
	$(CC) -o $@ morse.o beepLinux.o ${ALARM} ${LDFLAGS}

QSO:	
	cd qso; make
	$(RM) QSO
	$(LN) qso/QSO ./QSO

#
# "Jocks find quartz glyph, vex BMW." is my attempt to win Stephen J. Gould's
# prize (a copy of all his books) for the first person who can come up with a
# "perfect pangram": a meaningful sentence consisting entirely of common
# English words, with no abbreviations or proper names, that contains each
# letter exactly once. He rejected it because it contains "BMW", alas, but
# he did say it's the closest he's seen so far. - Joe Dellinger
#
test:	morse QSO
	\$(RM) junk
	cat test_input > junk
	qso/QSO >> junk
	./morse -w 24 -l -e < junk
	\$(RM) junk

testqso:	morse QSO
	qso/QSO | ./morse -w 20 -l -e

all:	morse QSO

clean:
	$(RM) *.o morse QSO morseSun morseHP morseX11 morseIndigo morseLinux
	$(RM) junk
	cd qso; make clean


morse.o:	beep.h Makefile
beepSun.o:	beep.h
beepHP.o:	beep.h alarm.h
beepX11.o:	beep.h alarm.h
beepIndigo.o:	beep.h
beepLinux.o:	beep.h alarm.h
alarm.o:	alarm.h

.PHONY: clean QSO
