#
# 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
SYMFILES=
ifeq (1,$(CONFIG_SND_SEQ_MIDI))
TARGETS += $(TOPDIR)/modules/snd-seq-midi.o
SYMFILES += seq_midi_export.c
endif
ifeq (1,$(CONFIG_SND_SEQ_MIDI_EMUL))
TARGETS += $(TOPDIR)/modules/snd-seq-midi-emul.o
SYMFILES += seq_midi_emul_export.c
endif
ifeq (1,$(CONFIG_SND_SEQ_INSTR))
TARGETS += $(TOPDIR)/modules/snd-seq-instr.o
SYMFILES += seq_instr_export.c
endif
OBJECTS = seq.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_export.o \
          seq_info.o
MIDI    = seq_midi.o seq_midi_export.o
MIDIEMUL= seq_midi_emul.o seq_midi_emul_export.o
INSTR	= seq_instr.o seq_instr_export.o

include $(TOPDIR)/Rules.make

all: $(TARGETS)
ifneq (,$(SUBDIRS))
	@for d in $(SUBDIRS); do if ! $(MAKE) -C $$d; then exit 1; fi; done
endif
	@echo
	@echo "ALSA sequencer modules were sucessfully compiled."
	@echo

include $(TOPDIR)/Rules1.make

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

$(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
