summaryrefslogtreecommitdiff
path: root/make/subdir.mk
blob: 3aea16c735f7fd7a592dc32bf4519e8bb5d7592b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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