# Makefile for main VPB driver source

srcdir       := @srcdir@
top_srcdir   := @top_srcdir@
top_builddir := @top_builddir@

include $(top_builddir)/Makefile.common

subdirs = libtoneg libvpb utils
ifeq ($(HOST_OS),linux)
subdirs += $(srcdir)/vtcore $(srcdir)/vpb
endif

all: JBS = $(NJOBS)
all install: $(top_srcdir)/Version
	@set -e; for d in $(subdirs); do $(MAKE) $(JBS) -C $$d $@; done

ifneq ($(top_srcdir),$(top_builddir))
# We create this one in the top source dir to keep the kernel makefiles happy,
# they don't use autoconf and won't know when they are building from a subdir.
$(top_srcdir)/Version: $(top_builddir)/Version ; cp $< $@
endif


# Don't quit early on errors while doing clean
clean:
	@for d in $(subdirs); do $(MAKE) -C $$d $@; done

distclean:
	@for d in $(subdirs); do $(MAKE) -C $$d $@; done
	$(RM) Makefile

.PHONY: all install clean distclean

