DIRS = qlib2 libslink libslutils libslplugin seedlink plugins slarchive \
       slinktool slqplot tek2gif utils doc

ACQ_DIRS = qlib2 libslink libslutils libslplugin seedlink plugins slarchive \
           slinktool utils

ACQ_RBIN = slinktool trylock run_with_lock

ACQ_BIN = chain_plugin ewexport_plugin load_timetable mseedscan_plugin \
          naqs_plugin nrts_plugin q330_plugin reftek_plugin scream_plugin \
          seedlink serial_plugin slarchive sock_plugin timeout win_plugin

QPLOT_DIRS = qlib2 libslink slqplot tek2gif

QPLOT_BIN = slqplot tek2gif

all: $(DIRS)

install: $(ACQ_DIRS)
	install -s -m 755 $(ACQ_RBIN:%=bin/%) ../../bin
	install -s -m 755 $(ACQ_BIN:%=bin/%) ../bin

install_qplot: $(QPLOT_DIRS)
	install -s -m 755 $(QPLOT_BIN:%=bin/%) ../../qplot/bin

.PHONY: $(DIRS) $(DIRS:%=depend_%) $(DIRS:%=clean_%) all install install_qplot depend clean veryclean

depend: $(DIRS:%=depend_%)

clean: $(DIRS:%=clean_%)

veryclean: clean
	$(RM) bin/*

$(DIRS):
	$(MAKE) -C $@

$(DIRS:%=depend_%):
	-$(MAKE) -C $(@:depend_%=%) depend

$(DIRS:%=clean_%):
	-$(MAKE) -C $(@:clean_%=%) clean

