+ifeq ($(MAKECMDGOALS),install-clang)
+ DIRS := tools/clang/tools/driver tools/clang/lib/Headers \
+ tools/clang/runtime tools/clang/docs \
+ tools/lto runtime
+ OPTIONAL_DIRS :=
+ NO_INSTALL = 1
+endif
+
+ifeq ($(MAKECMDGOALS),install-clang-c)
+ DIRS := tools/clang/tools/driver tools/clang/lib/Headers \
+ tools/clang/tools/libclang tools/clang/tools/c-index-test \
+ tools/clang/include/clang-c
+ OPTIONAL_DIRS :=
+ NO_INSTALL = 1
+endif
+
+ifeq ($(MAKECMDGOALS),clang-only)
+ DIRS := $(filter-out tools docs unittests, $(DIRS)) \
+ tools/clang tools/lto
+ OPTIONAL_DIRS :=
+endif
+
+ifeq ($(MAKECMDGOALS),unittests)
+ DIRS := $(filter-out tools runtime docs, $(DIRS)) utils unittests
+ OPTIONAL_DIRS :=
+endif
+
+# Use NO_INSTALL define of the Makefile of each directory for deciding
+# if the directory is installed or not