#
# Makefile for ALSA
# Copyright (c) 1999 by Jaroslav Kysela <perex@suse.cz>
#

EXTRA_CFLAGS := -I../include

SUB_DIRS     :=
MOD_SUB_DIRS :=
ALL_SUB_DIRS := pcm1 seq

L_TARGET     := snd.a
M_OBJS	     :=
L_OBJS       :=
LX_OBJS      :=
MIX_OBJS     :=

SOUNDX	     := sound.o
SOUND1       := init.o isadma.o memory.o info.o switch.o control.o misc.o
ifeq ($(CONFIG_SND_OSSEMUL),y)
  SOUND1 += sound_oss.o info_oss.o
endif
MIXERX	     := mixer.o
MIXER1       := mixer_lib.o
PCMX         := pcm.o
PCM1         := pcm_proc.o ulaw.o
MIDIX        := midi.o
MIDI1        := rawmidi.o

ifeq ($(CONFIG_SND_PCM1),y)
  SUB_DIRS += pcm1
else
  ifeq ($(CONFIG_SND_PCM1),m)
    MOD_SUB_DIRS += pcm1
  endif
endif

ifeq ($(CONFIG_SND_SEQUENCER),y)
  ifeq ($(CONFIG_SND),y)
    SUB_DIRS += seq
  else
    ifeq ($(CONFIG_SND),m)
      MOD_SUB_DIRS += seq
    endif
  endif
endif

ifeq ($(CONFIG_PERSIST),y)
  LX_OBJS += persist.o
else
  ifeq ($(CONFIG_PERSIST),m)
    MX_OBJS += persist.o
  endif
endif

ifeq ($(CONFIG_SND),y)
  LX_OBJS += $(SOUNDX)
  L_OBJS += $(SOUND1)
else
  ifeq ($(CONFIG_SND),m)
    M_OBJS += snd.o
    MIX_OBJS += $(SOUNDX)
  endif
endif

ifeq ($(CONFIG_SND_MIXER),y)
  LX_OBJS += $(MIXERX)
  L_OBJS += $(MIXER1)
else
  ifeq ($(CONFIG_SND_MIXER),m)
    M_OBJS += snd-mixer.o
    MIX_OBJS += $(MIXERX)
  endif
endif

ifeq ($(CONFIG_SND_PCM),y)
  LX_OBJS += $(PCMX)
  L_OBJS += $(PCM1)
else
  ifeq ($(CONFIG_SND_PCM),m)
    M_OBJS += snd-pcm.o
    MIX_OBJS += $(PCMX)
  endif
endif

ifeq ($(CONFIG_SND_MIDI),y)
  LX_OBJS += $(MIDIX)
  L_OBJS += $(MIDI1)
else
  ifeq ($(CONFIG_SND_MIDI),m)
    M_OBJS += snd-midi.o
    MIX_OBJS += $(MIDIX)
  endif
endif

ifeq ($(CONFIG_SND_TIMER),y)
  LX_OBJS += timer.o
else
  ifeq ($(CONFIG_SND_TIMER),m)
    M_OBJS += snd-timer.o
    MIX_OBJS += timer.o
  endif
endif

ifeq ($(CONFIG_SND_HWDEP),y)
  LX_OBJS += hwdep.o
else
  ifeq ($(CONFIG_SND_HWDEP),m)
    M_OBJS += snd-hwdep.o
    MIX_OBJS += hwdep.o
  endif
endif

ifeq ($(CONFIG_SND_OSSEMUL),y)
  ifeq ($(CONFIG_SND_MIXER),y)
    L_OBJS += mixer_oss.o
  else
    ifeq ($(CONFIG_SND_MIXER),m)
      M_OBJS += snd-mixer-oss.o
    endif
  endif
endif

include $(TOPDIR)/Rules.make

snd.o: $(SOUNDX) $(SOUND1)
	$(LD) $(LD_RFLAG) -r -o $@ $(SOUNDX) $(SOUND1)

snd-mixer.o: $(MIXERX) $(MIXER1)
	$(LD) $(LD_RFLAG) -r -o $@ $(MIXERX) $(MIXER1)

snd-pcm.o: $(PCMX) $(PCM1)
	$(LD) $(LD_RFLAG) -r -o $@ $(PCMX) $(PCM1)

snd-midi.o: $(MIDIX) $(MIDI1)
	$(LD) $(LD_RFLAG) -r -o $@ $(MIDIX) $(MIDI1)

snd-timer.o: timer.o
	$(LD) $(LD_RFLAG) -r -o $@ timer.o

snd-hwdep.o: hwdep.o
	$(LD) $(LD_RFLAG) -r -o $@ hwdep.o

snd-mixer-oss.o: mixer_oss.o
	$(LD) $(LD_RFLAG) -r -o $@ mixer_oss.o
