summaryrefslogtreecommitdiff
path: root/make/subdir.mk
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-26 16:47:03 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-26 16:47:03 +0000
commitb3a6901e66f55b35aa9e01bcb24134e6a65ea004 (patch)
tree4d57d73575ea3f7e30bf430920d6e96fa2a369c1 /make/subdir.mk
parent8cbe163cba77c772621f89ddb33793ac170b1fa2 (diff)
Initial import of compiler-rt.
- git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@74292 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'make/subdir.mk')
-rw-r--r--make/subdir.mk43
1 files changed, 43 insertions, 0 deletions
diff --git a/make/subdir.mk b/make/subdir.mk
new file mode 100644
index 000000000..3aea16c73
--- /dev/null
+++ b/make/subdir.mk
@@ -0,0 +1,43 @@
+# This file is intended to be included from each subdirectory
+# makefile.
+
+ifeq ($(Dir),)
+ $(error "No Dir variable defined.")
+endif
+
+ifeq ($(DebugMake),1)
+ $(info MAKE: $(Dir): Processing subdirectory)
+endif
+
+# Expand template for each configuration and architecture.
+# FIXME: This level of logic should be in primary Makefile?
+ifeq ($(OnlyConfigs),)
+ ConfigsToTraverse := $(Configs)
+else
+ ConfigsToTraverse := $(OnlyConfigs)
+endif
+
+ifeq ($(OnlyArchs),)
+ ArchsToTraverse := $(Archs)
+else
+ ArchsToTraverse := $(OnlyArchs)
+endif
+
+$(foreach config,$(ConfigsToTraverse), \
+ $(foreach arch,$(ArchsToTraverse), \
+ $(eval $(call CNA_subdir_template,$(config),$(arch),$(Dir)))))
+
+###
+# Include child makefile fragments
+
+# Evaluate this now so we do not have to worry about order of
+# evaluation.
+SubDirsList := $(SubDirs:%=$(Dir)/%)
+ifeq ($(SubDirsList),)
+else
+ ifeq ($(DebugMake),1)
+ $(info MAKE: Descending into subdirs: $(SubDirsList))
+ endif
+ $(foreach subdir,$(SubDirsList),$(eval include $(subdir)/Makefile.mk))
+endif
+