File: RULES_DIRS

package info (click to toggle)
epics-base 7.0.8.1%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 22,512 kB
  • sloc: cpp: 130,870; ansic: 115,274; perl: 10,647; makefile: 3,476; yacc: 1,307; python: 594; lex: 236; sh: 108; csh: 36
file content (102 lines) | stat: -rw-r--r-- 3,821 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#*************************************************************************
# Copyright (c) 2006 UChicago Argonne LLC, as Operator of Argonne
#     National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
#     Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in the file LICENSE that is included with this distribution.
#*************************************************************************

ARCHS += $(BUILD_ARCHS)
ACTIONS += inc build install buildInstall clean realclean archclean
ACTIONS += runtests tapfiles clean-tests test-results junitfiles

dirActionArchTargets = $(foreach dir, $(DIRS), \
    $(foreach action, $(ACTIONS), \
        $(foreach arch, $(ARCHS), \
            $(dir)$(DIVIDER)$(action)$(DIVIDER)$(arch))))
dirArchTargets += $(foreach dir, $(DIRS), \
    $(foreach arch, $(ARCHS), \
        $(dir)$(DIVIDER)$(arch)))
dirActionTargets += $(foreach dir, $(DIRS), \
    $(foreach action, $(ACTIONS), \
        $(dir)$(DIVIDER)$(action)))
actionArchTargets = $(foreach action, $(ACTIONS), \
    $(foreach arch, $(ARCHS), \
        $(action)$(DIVIDER)$(arch)))

all: install
host: install$(DIVIDER)$(EPICS_HOST_ARCH)

# Include <top>/cfg/DIR_RULES* files from tops defined in RELEASE* files
# Do this here so they can add ACTIONS
#
RELEASE_CFG_DIR_RULES = $(foreach top, $(RELEASE_TOPS), \
    $(wildcard $($(top))/cfg/DIR_RULES*))
ifneq ($(RELEASE_CFG_DIR_RULES),)
  include $(RELEASE_CFG_DIR_RULES)
endif

# Allows rebuild to work with parallel builds option, -j.
ifeq (rebuild,$(filter rebuild,$(MAKECMDGOALS)))
$(foreach dir, $(DIRS), $(dir)$(DIVIDER)install): \
    $(foreach dir, $(DIRS), $(dir)$(DIVIDER)clean)
rebuild: $(foreach dir, $(DIRS), $(dir)$(DIVIDER)install)
endif

# Create directory dependancies lines for GNU make -j option
# Only works with GNU make 3.81 or later (uses eval function)
define DEP_template1
$(1): $$($(1)_DEPEND_DIRS)
endef
$(foreach dir, $(DIRS), \
    $(eval $(call DEP_template1,$(dir))))

define DEP_template2
$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \
    $$(addsuffix $$(DIVIDER)$(2),$$(ddir))) | before-$(2)
endef
$(foreach action, $(ACTIONS), \
    $(foreach dir, $(DIRS), \
        $(eval $(call DEP_template2,$(dir),$(action)))))

define DEP_template3
$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \
    $$(addsuffix $$(DIVIDER)$(2),$$(ddir)))
endef
$(foreach arch, $(ARCHS), \
    $(foreach dir, $(DIRS), \
        $(eval $(call DEP_template3,$(dir),$(arch)))))

define DEP_template4
$(1)$$(DIVIDER)$(2)$$(DIVIDER)$(3) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \
    $$(addsuffix $$(DIVIDER)$(2)$$(DIVIDER)$(3),$$(ddir)))
endef
$(foreach arch, $(ARCHS), \
    $(foreach action, $(ACTIONS), \
        $(foreach dir, $(DIRS), \
            $(eval $(call DEP_template4,$(dir),$(action),$(arch))))))

dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@))))
actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$(notdir $@))), \
   $(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@)))))

$(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets):
	$(MAKE) -C $(dirPart) $(actionArchPart)

# before-action rules are run once prior to recursing through the
# list of subdirectories and running the action rule in each one.
# See DEP_template2 above for how that rule ordering is achieved.
beforeActions = $(addprefix before-,$(ACTIONS))
$(beforeActions):

$(ARCHS) $(ACTIONS) $(actionArchTargets) :%: \
    $(foreach dir, $(DIRS), $(dir)$(DIVIDER)%)

.PHONY : $(DIRS) all host rebuild
.PHONY : $(ARCHS) $(ACTIONS) $(beforeActions)
.PHONY : $(dirActionTargets) $(dirArchTargets)
.PHONY : $(dirActionArchTargets)
.PHONY : $(actionArchTargets)

include $(CONFIG)/RULES_COMMON