#
# Makefile for ALSA driver
# Copyright (c) 1994-98 by Jaroslav Kysela <perex@jcu.cz>
#

SUBDIRS = kernel lowlevel cards detect
CSUBDIRS = include test utils

ifeq (Makefile.conf,$(wildcard Makefile.conf))
include Makefile.conf
else
dummy:
	@echo
	@echo "Please, run configure script as first..."
	@echo
endif


all:
	@for d in $(SUBDIRS); do if ! $(MAKE) -C $$d; then exit 1; fi; done
	@echo
	@echo "ALSA modules were sucessfully compiled."
	@echo

map:
	awk "{ if ( length( $$1 ) != 0 ) print $$1 }" snd.map | sort -o snd.map1
	mv -f snd.map1 snd.map

install:
	mkdir -p $(moddir)
	rm -f $(moddir)/snd*.o
	cp modules/* $(moddir)
	install -m 644 include/sound.h /usr/include/linux
	install -m 644 include/sounddetect.h /usr/include/linux

clean:
	@for d in $(SUBDIRS); do if ! $(MAKE) -C $$d clean; then exit 1; fi; done
	@for d in $(CSUBDIRS); do if ! $(MAKE) -C $$d clean; then exit 1; fi; done
	rm -f core .depend *.o *.orig snd.map snd.map? *~
	rm -f `find . -name "out.txt"`
	rm -f modules/*.o
	rm -f doc/*~

pack: clean
	rm -f config.cache config.log config.status Makefile.conf
	chown -R root.root ../alsadriver
	tar cvz -C .. -f ../alsadriver-$(SND_VERSION).tar.gz alsadriver

publish: pack
	cat ../alsadriver-$(SND_VERSION).tar.gz | \
          ssh -l root zarquon.jcu.cz /home/alsa/publish alsadriver-$(SND_VERSION).tar.gz
