################################################################################
#
# File:		Makefile
# Version:	$Id: Makefile,v 1.38.1.1 1995/08/07 05:30:45 burgaard Exp $	
#
# Project:      Roland MPU-401 Device driver.
#		MIDI/Sequencer library.
# Authors:	Kim Burgaard, <burgaard@daimi.aau.dk>
# Copyrights:	Copyright (c) 1994, 1995 Kim Burgaard.
#
#		This program is free software; you can redistribute it and/or
#		modify it under the terms of the GNU General Public License as
#		published by the Free Software Foundation; either version 2, or
#		(at your option) any later version.
#
#		This program is distributed in the hope that it will be useful,
#		but WITHOUT ANY WARRANTY; without even the implied warranty of
#		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#		GNU General Public License for more details.
#
#		You should have received a copy of the GNU General Public
#		License along with this program; see the file COPYING.  If not,
#		write to the Free Software Foundation, 675 Mass Ave, Cambridge,
#		MA 02139, USA.
#
################################################################################

.EXPORT_ALL_VARIABLES:

################################################################################
# Edit the lines below if nescessary
################################################################################

CC     = gcc
LD     = ld
CFLAGS = -I../include -O6 -m486 -pipe -Wall -fstrict-prototypes -fomit-frame-pointer -funroll-loops
LFLAGS = -L../lib -lmidifile

INSDIR = /usr/local
BINDIR = $(INSDIR)/bin
SYSDIR = $(INSDIR)/sbin
MANDIR = $(INSDIR)/man
LIBDIR = $(INSDIR)/lib
INCDIR = $(INSDIR)/include/midifile
MODDIR = /lib/modules

################################################################################
# Please don't edit below!
################################################################################

SRCDIR = lib driver util
SUBDIR = lib driver util include doc
WRKDIR = mpu401-0.2

RC_FN = /var/lib/mpu401.conf
RC_FILE = \"$(RC_FN)\"
VERSION = 0
SUBVERSION = 2
REVISION = \"0\"

################################################################################

all:
	set -e; for i in $(SRCDIR); do (cd $$i; make -f Makefile); done

lib:	dummy
	make all SRCDIR=lib

driver:	dummy
	make all SRCDIR=driver

util:	dummy
	make all SRCDIR=util

include:dummy
	make all SRCDIR=include

doc:	dummy
	make all SRCDIR=doc

################################################################################

install.lib:	dummy
	cd lib && make -f Makefile install

install.driver:	dummy
	cd driver && make -f Makefile install

install.util:	dummy
	cd util && make -f Makefile install

install.include:dummy
	cd include && make -f Makefile install

install.doc:	dummy
	cd doc && make -f Makefile install

install:
	@if [ `whoami` != "root" ]; then\
	  echo "******************************************************************";\
	  echo;\
	  echo "In order to install this package, you must be logged in as root!   ";\
	  echo;\
	  echo "******************************************************************";\
	  exit 1;\
	fi

	set -e; for i in $(SRCDIR); do (cd $$i; make -f Makefile install); done
	@echo "******************************************************************"
	@echo
	@echo "The package has now been succesfully installed!"
	@echo
	@echo "Now try out smfplay on a couple of MIDI files. If nothing happens,"
	@echo "i.e. no music is plaing,  then you've probably chosen an wrong IRQ"
	@echo "number. Check your hardware setup and run mpuconfig again. You can"
	@echo "find some test songs in the test/ directory.                      "
	@echo
	@echo "The driver and library documentation is not compiled by default.  "
	@echo "To build the dvi and ps files, type 'make doc' now.               "
	@echo
	@echo "If you experience problems of any kind, please email the author at"
	@echo
	@echo "             Kim Burgaard, <burgaard@daimi.aau.dk>                "
	@echo
	@echo "******************************************************************"

uninstall:
	set -e; for i in $(SUBDIR); do (cd $$i; make -f Makefile uninstall); done

clean:	
	@set -e; for i in $(SUBDIR); do (cd $$i; make -f Makefile clean); done

distclean:	clean
	@find . \( -name "*~" -o -name "#*#" \) -print -exec rm -f {} \;
	
dist:	distclean
	cd ../ && tar --exclude RCS --exclude lib++ -cf - $(WRKDIR)|gzip -9c>$(WRKDIR).tar.gz

backup:	distclean
	cd ../ && tar --exclude test -cf - $(WRKDIR)|gzip -9c>$(WRKDIR)-`date +"19%y-%m-%d"`.tar.gz

dummy:

### End of File #################################################################
# Local variables:
#   fill-column: 81
# End:
