+EXTRA_DIST = README
-SUBDIRS = instantiate memchunk muxing sched threadstate seeking # bufspeed
+# Build misc unless both --disable-examples and --disable-benchmarks were passed
-if !GST_DISABLE_TRACE
-noinst_PROGRAMS = lat
+if BUILD_BENCHMARKS
+SUBDIRS_BENCHMARKS = benchmarks
+SUBDIRS_MISC = misc
+else
+SUBDIRS_BENCHMARKS =
+endif
-lat_CFLAGS = $(GST_OBJ_CFLAGS)
-lat_LDFLAGS = $(GST_OBJ_LIBS)
+if BUILD_TESTS
+## SUBDIRS_TESTS = tests testsuite
+## FIXME: write tests from scratch
+SUBDIRS_TESTS =
+if HAVE_CHECK
+SUBDIRS_CHECK = check
+else
+SUBDIRS_CHECK =
+endif
+else
+SUBDIRS_TESTS =
+SUBDIRS_CHECK =
endif
-EXTRA_DIST = README
-DIST_SUBDIRS= bufspeed instantiate memchunk muxing sched threadstate seeking
+if BUILD_EXAMPLES
+SUBDIRS_EXAMPLES = examples
+SUBDIRS_MISC = misc
+else
+SUBDIRS_EXAMPLES =
+endif
+
+SUBDIRS = \
+ $(SUBDIRS_BENCHMARKS) \
+ $(SUBDIRS_CHECK) \
+ $(SUBDIRS_MISC) \
+ $(SUBDIRS_TESTS) \
+ $(SUBDIRS_EXAMPLES)
+
+# These are all the possible subdirs
+DIST_SUBDIRS = \
+ benchmarks \
+ check \
+ examples \
+ misc