-# The order here is tricky. SUBDIRS applies both to compilation and
-# installation. Programs depending on the libs must be built after
-# libust and '.' (that contains the linker script). However, '.'
-# must be installed after libust so it can overwrite libust.so with
-# the linker script.
-SUBDIRS = snprintf liblttng-ust-comm libringbuffer libust include doc tests \
- libustjava
+SUBDIRS = . include snprintf libringbuffer liblttng-ust-comm \
+ liblttng-ust \
+ liblttng-ust-ctl \
+ liblttng-ust-fd \
+ liblttng-ust-fork \
+ liblttng-ust-libc-wrapper \
+ liblttng-ust-cyg-profile \
+ tools
+
+if HAVE_DLINFO
+SUBDIRS += liblttng-ust-dl
+endif
+
+if BUILD_JNI_INTERFACE
+SUBDIRS += liblttng-ust-java
+endif
+
+if BUILD_JAVA_AGENT
+SUBDIRS += liblttng-ust-java-agent
+endif
+
+if BUILD_PYTHON_AGENT
+SUBDIRS += python-lttngust \
+ liblttng-ust-python-agent
+endif
+
+SUBDIRS += tests doc