# sod2, a player for polychannel .csf music files.
# Copyright (C) 1995, 1996 Russell Marks. See sod2.c for license details.
#
# Based on `sodman' by Graham Richards.
#
#
# Makefile - makefile for sod2

# Notes
# -----
#
# You need an ANSI C compiler to compile sod2. Use one which permits
# using the 'inline' keyword to mark functions which should be
# inlined, if possible.
#
# If you don't have an ANSI C compiler, consider installing gcc, the
# GNU C compiler. It's portable, and free. Look on prep.ai.mit.edu or
# a site which mirrors it. (On prep, it's in /pub/gnu.)
#
# If you're using MS-DOS, compile with djgpp. I think this is on
# oak.oakland.edu. It's a DOS port of gcc.


# Compile-time settings
# ---------------------
#
# _ALLOW_INLINE : comment this out if your compiler doesn't like the
#                 'inline' keyword.
INLINE_FLAG = -D_ALLOW_INLINE

# _ALLOW_BUFFERING : comment this out if you're not using Linux.
BUF_FLAG = -D_ALLOW_BUFFERING

# _ALLOW_PAUSE : comment this out if you don't have usleep() or
#		 select().
PAUSE_FLAG = -D_ALLOW_PAUSE

# settings for gcc.
CC=gcc
CFLAGS=-Wall -O2 -fomit-frame-pointer $(INLINE_FLAG) $(BUF_FLAG) $(PAUSE_FLAG)

# settings for generic ANSI C compiler. Comment out the lines above if
# you use this.
#CFLAGS=-O $(INLINE_FLAG) $(BUF_FLAG)

# directory to install the 'sod2' binary in
BINDIR=/usr/local/bin

# directory in which to install 'sod2.1', the sod2 man page (and
# others)
MANDIR1=/usr/local/man/man1

# directory in which to install 'csf.5', the csf file format man page
MANDIR5=/usr/local/man/man5

# ------------- don't edit anything below this line --------------

OBJS = sod2.o grokfile.o tarfile.o
TUNE_OBJS = tune_main.o tune_fft.o

all: sod2 tunesam

sod2: $(OBJS)
	$(CC) $(CFLAGS) -o sod2 $(OBJS) -lm

tunesam: $(TUNE_OBJS)
	$(CC) $(CFLAGS) -o tunesam $(TUNE_OBJS) -lm

install: all
	strip sod2
	install -m 511 sod2 tunesam		$(BINDIR)
	install -m 755 csf2tar csffile csfmulti	$(BINDIR)
	install -m 444 sod2.1 tunesam.1 	$(MANDIR1)
	install -m 444 csf2tar.1 csffile.1 csfmulti.1 	$(MANDIR1)
	install -m 444 csf.5			$(MANDIR5)

clean:
	$(RM) *.o *~

distclean:
	$(RM) *.o *~ TAGS sod2 tunesam

tar:	distclean
	cd ..;tar -cvf - sod2 | gzip >$(HOME)/sod2.tar.gz

tags:
	etags *.[ch]

# Dependancies

grokfile.o : grokfile.c sod2.h config.h tarfile.h 
sod2.o : sod2.c sod2.h config.h grokfile.h 
tarfile.o : tarfile.c sod2.h config.h tarfile.h 
