+DIST_SUBDIRS =
+SUBDIRS = include portals conf scripts ldlm
+
+# ldiskfs creates headers that the ldiskfs fsfilt will need
+if MODULES
+if LDISKFS
+SUBDIRS += ldiskfs
+else
+DIST_SUBDIRS += ldiskfs
+endif
+else
+DIST_SUBDIRS += ldiskfs
+endif
+
+# directories shared by the liblustre and modules builds
+CORE_SUBDIRS = lvfs obdclass lov ptlrpc obdecho osc mdc
+if LIBLUSTRE
+SUBDIRS += $(CORE_SUBDIRS)
+else
+if MODULES
+SUBDIRS += $(CORE_SUBDIRS)
+else
+DIST_SUBDIRS += $(CORE_SUBDIRS)
+endif
+endif
+
+# directories only built in the modules build
+MODULES_SUBDIRS = mds obdfilter ost llite cobd
+MODULES_DIST_SUBDIRS =
+