#
# Makefile for ALSA low level driver (Linux version)
# Copyright (c) 1994-98 by Jaroslav Kysela <perex@suse.cz>
#

TOPDIR  = ..

include $(TOPDIR)/Makefile.conf
include $(TOPDIR)/cards.config

SUBDIRS =
ifeq (1,$(CONFIG_SND_PCM1))
SUBDIRS += pcm1
endif
ifeq (1,$(CONFIG_SND_SEQUENCER))
SUBDIRS += seq
endif
TARGETS = $(SNDVERSIONS)
ifeq (1,$(CONFIG_PERSIST))
TARGETS += $(TOPDIR)/modules/persist.o
EXPORTS += persist.o
endif
ifeq (1,$(CONFIG_SND))
TARGETS += $(TOPDIR)/modules/snd.o
EXPORTS += sound.o
endif
ifeq (1,$(CONFIG_SND_MIXER))
TARGETS += $(TOPDIR)/modules/snd-mixer.o
EXPORTS += mixer.o
endif
ifeq (1,$(CONFIG_SND_PCM))
TARGETS += $(TOPDIR)/modules/snd-pcm.o
EXPORTS += pcm.o
endif
ifeq (1,$(CONFIG_SND_MIDI))
TARGETS += $(TOPDIR)/modules/snd-midi.o
EXPORTS += midi.o
endif
ifeq (1,$(CONFIG_SND_TIMER))
TARGETS += $(TOPDIR)/modules/snd-timer.o
EXPORTS += timer.o
endif
ifeq (1,$(CONFIG_SND_HWDEP))
TARGETS += $(TOPDIR)/modules/snd-hwdep.o
EXPORTS += hwdep.o
endif
ifeq (1,$(CONFIG_SND_OSSEMUL))
TARGETS += $(TOPDIR)/modules/snd-mixer-oss.o
endif

PERSIST = persist.o
OBJECTS = sound.o init.o isadma.o memory.o \
          info.o switch.o control.o misc.o
ifeq (1,$(CONFIG_SND_OSSEMUL))
OBJECTS += sound_oss.o info_oss.o
endif
MIXER   = mixer.o mixer_lib.o
OMIXER	= mixer_oss.o
PCM	= pcm.o pcm_proc.o ulaw.o
MIDI    = midi.o rawmidi.o
TIMER	= timer.o
HWDEP   = hwdep.o

include $(TOPDIR)/Rules.make

all: $(TARGETS)
	@for d in $(SUBDIRS); do if ! $(MAKE) -C $$d; then exit 1; fi; done

include $(TOPDIR)/Rules1.make

$(TOPDIR)/modules/persist.o: .depend $(SNDVERSIONS) $(PERSIST)
	$(LINKER) -o $@ $(PERSIST)

$(TOPDIR)/modules/snd.o: .depend $(SNDVERSIONS) $(OBJECTS)
	$(LINKER) -o $@ $(OBJECTS)

$(TOPDIR)/modules/snd-control.o: .depend $(SNDVERSIONS) $(CONTROL)
	$(LINKER) -o $@ $(CONTROL)

$(TOPDIR)/modules/snd-mixer.o: .depend $(SNDVERSIONS) $(MIXER)
	$(LINKER) -o $@ $(MIXER)

$(TOPDIR)/modules/snd-mixer-oss.o: .depend $(SNDVERSIONS) $(OMIXER)
	$(LINKER) -o $@ $(OMIXER)

$(TOPDIR)/modules/snd-pcm.o: .depend $(SNDVERSIONS) $(PCM)
	$(LINKER) -o $@ $(PCM)

$(TOPDIR)/modules/snd-midi.o: .depend $(SNDVERSIONS) $(MIDI)
	$(LINKER) -o $@ $(MIDI)

$(TOPDIR)/modules/snd-timer.o: .depend $(SNDVERSIONS) $(TIMER)
	$(LINKER) -o $@ $(TIMER)

$(TOPDIR)/modules/snd-hwdep.o: .depend $(SNDVERSIONS) $(HWDEP)
	$(LINKER) -o $@ $(HWDEP)

gcompile: $(TARGETS)

clean:
	$(MAKE) -C seq clean
	@for d in $(SUBDIRS); do if ! $(MAKE) -C $$d clean; then exit 1; fi; done
	rm -f .depend *.o *.orig snd.map snd.map? *.old *~
	rm -f core $(SNDVERSIONS) $(SYMFILES)

.depend: $(SYMFILES)
	$(CPP) $(COPTS) $(INCLUDE) *.c > .depend

dep:	.depend

dummy:

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
