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

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


all:
	$(MAKE) -C kernel
	$(MAKE) -C lowlevel
	$(MAKE) -C cards
	$(MAKE) -C detect
	@echo
	@echo "ALSA modules were sucessfully compiled."
	@echo

insert:
	sync		# for sure - debug versions may hang
	/sbin/insmod -m modules/snd.o > snd.map
	/sbin/insmod -m modules/snd-mixer.o >> snd.map
	/sbin/insmod -m modules/snd-pcm.o >> snd.map
	/sbin/insmod -m modules/snd-pcm-oss.o >> snd.map
	/sbin/insmod -m modules/snd-cs4231.o >> snd.map
	/sbin/insmod -m modules/snd-gus.o >> snd.map
	/sbin/insmod -m modules/snd-interwave.o snd_dma1=5 snd_dma2=6 >> snd.map
#	/sbin/insmod -m modules/snd-interwave.o >> snd.map

insert2:
	sync		# for sure - debug versions may hang
	/sbin/insmod -m modules/snd.o > snd.map
	/sbin/insmod -m modules/snd-mixer.o >> snd.map
	/sbin/insmod -m modules/snd-pcm.o >> snd.map
	/sbin/insmod -m modules/snd-pcm-oss.o >> snd.map
	/sbin/insmod -m modules/snd-es1688.o >> snd.map
	/sbin/insmod -m modules/snd-audiodrive1688.o >> snd.map

remove:
	sync		# for sure - debug versions may hang
	- /sbin/rmmod snd-audiodrive1688
	- /sbin/rmmod snd-interwave
	- /sbin/rmmod snd-gus
	- /sbin/rmmod snd-es1688
	- /sbin/rmmod snd-cs4231
	- /sbin/rmmod snd-pcm-oss
	- /sbin/rmmod snd-pcm
	- /sbin/rmmod snd-mixer
	- /sbin/rmmod snd-detect
	- /sbin/rmmod snd

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


clean:
	make -C include clean
	make -C kernel clean
	make -C lowlevel clean
	make -C cards clean
	make -C detect clean
	make -C test clean
	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/ultra/publish alsadriver-$(SND_VERSION).tar.gz
