#
# 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

TARGETS = $(SNDVERSIONS)
ifeq (1,$(CONFIG_SND_S3_86C617))
TARGETS += $(TOPDIR)/modules/snd-s3-86c617.o
SYMFILES += s3_86c617_export.c
endif
ifeq (1,$(CONFIG_SND_ENS1370))
TARGETS += $(TOPDIR)/modules/snd-ens1370.o
SYMFILES += ens1370_export.c
endif
ifeq (1,$(CONFIG_SND_ENS1371))
TARGETS += $(TOPDIR)/modules/snd-ens1371.o
SYMFILES += ens1371_export.c
endif
ifeq (1,$(CONFIG_SND_ES1938))
TARGETS += $(TOPDIR)/modules/snd-es1938.o
SYMFILES += ess_solo1_export.c
endif
ifeq (1,$(CONFIG_SND_TRIDENT_DX_NX))
TARGETS += $(TOPDIR)/modules/snd-trident_dx_nx.o
SYMFILES += trident_dx_nx_export.c
endif
ifeq (1,$(CONFIG_SND_CS461X))
TARGETS += $(TOPDIR)/modules/snd-cs461x.o
SYMFILES += cs461x_export.c
endif
ifeq (1,$(CONFIG_SND_FM801))
TARGETS += $(TOPDIR)/modules/snd-fm801.o
SYMFILES += fm801_export.c
endif

SONICVIBES = s3_86c617.o s3_86c617_export.o
AUDIOPCI1370 = ens1370.o ens1370_export.o
AUDIOPCI1371 = ens1371.o ens1371_export.o
ESSSOLO1 = ess_solo1.o ess_solo1_export.o
TRID4DWAVE = trident_dx_nx.o trident_dx_nx_export.o
CS461X = cs461x.o cs461x_export.o
FM801 = fm801.o fm801_export.o

include  $(TOPDIR)/Rules.make

all: $(TARGETS)
	@echo
	@echo "ALSA lowlevel modules were sucessfully compiled."
	@echo

include  $(TOPDIR)/Rules1.make

$(TOPDIR)/modules/snd-s3-86c617.o: .depend $(SNDVERSIONS) $(SONICVIBES)
	$(LINKER) -o $@ $(SONICVIBES)

ens1370.o: .depend ens137x.c
	$(CC) $(COPTS) $(INCLUDE) -DCHIP1370 -c -o ens1370.o ens137x.c 

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

ens1371.o: .depend ens137x.c
	$(CC) $(COPTS) $(INCLUDE) -DCHIP1371 -c -o ens1371.o ens137x.c 

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

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

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

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

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

gcompile: $(TARGETS)

clean:
	rm -f .depend *.o *.orig snd.map snd.map? *~
	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
