#
# Makefile for ALSA Sequencer
# Copyright (c) 1998 by Frank van de Pol <frank@vande-pol.demon.nl>
#

TOPDIR  = ../..

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

SUBDIRS = instr
ifeq (1,$(CONFIG_SND_OSSEMUL))
SUBDIRS += oss
endif

TARGETS = $(SNDVERSIONS) \
	  $(TOPDIR)/modules/snd-seq.o
EXPORTS = seq.o
TARGETS += $(TOPDIR)/modules/snd-seq-device.o
EXPORTS += seq_device.o
ifeq (1,$(CONFIG_SND_SEQ_MIDI))
TARGETS += $(TOPDIR)/modules/snd-seq-midi.o
EXPORTS += seq_midi.o
endif
ifeq (1,$(CONFIG_SND_SEQ_MIDI_EMUL))
TARGETS += $(TOPDIR)/modules/snd-seq-midi-emul.o
EXPORTS += seq_midi_emul.o
endif
ifeq (1,$(CONFIG_SND_SEQ_INSTR))
TARGETS += $(TOPDIR)/modules/snd-seq-instr.o
EXPORTS += seq_instr.o
endif
OBJECTS = seq.o seq_lock.o seq_clientmgr.o seq_memory.o seq_queue.o \
          seq_fifo.o seq_prioq.o seq_timer.o \
          seq_system.o seq_ports.o seq_info.o
DEVOBJS	= seq_device.o
MIDI    = seq_midi.o
MIDIEMUL= seq_midi_emul.o
INSTR	= seq_instr.o

include $(TOPDIR)/Rules.make

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

include $(TOPDIR)/Rules1.make

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

$(TOPDIR)/modules/snd-seq-device.o: .depend $(SNDVERSIONS) $(DEVOBJS)
	$(LINKER) -o $@ $(DEVOBJS)

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

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

$(TOPDIR)/modules/snd-seq-instr.o: .depend $(SNDVERSIONS) $(INSTR)
	$(LINKER) -o $@ $(INSTR)

gcompile: $(TARGETS)

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
