[ef7725]: include / mk / generic_trunk_target.inc  Maximize  Restore  History

Download this file

95 lines (80 with data), 2.9 kB

 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
#
# Generic trunk rules include Makefile.
#
# Copyright (C) 2009, Cisco Systems Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Garrett Cooper, July 2009
#
#
# generic_trunk_target
#
# Generate a set of recursive targets to apply over a trunk directory (has
# directories) -- optionally with a set of trunk-based files.
#
# All variables in this canned define are essentially the same as
# generic_leaf_target, with the exception that the install flow for local
# targets is:
#
# $(INSTALL_FILES) -> trunk-install -> install (recursive)
#
# All recursive targets are traverse SUBDIRS as defined by the user, or if
# undefined, defaults to any subdirectories where Makefile's are contained
# within.
#
# generic_trunk_target specific variables are:
#
# RECURSIVE_TARGETS : a list of targets to apply over an entire
# directory tree. This defaults to
# `all install'.
#
# See generic_leaf_target, generic_target_env_setup, and get_make_dirs for
# more details and design notes.
#
include $(top_srcdir)/include/mk/functions.mk
RECURSIVE_TARGETS ?= all install
$(eval $(get_make_dirs))
.PHONY: $(RECURSIVE_TARGETS) $(addprefix trunk-,$(RECURSIVE_TARGETS))
$(SUBDIRS): %:
mkdir -m 00755 -p "$@"
trunk-all: $(MAKE_TARGETS)
trunk-clean:: | $(SUBDIRS)
$(if $(strip $(CLEAN_TARGETS)),$(RM) -f $(CLEAN_TARGETS))
trunk-install: $(INSTALL_FILES)
# Avoid creating duplicate .PHONY references to all, clean, and install. IIRC,
# I've seen some indeterministic behavior when one does this in the past with
# GNU Make...
.PHONY: $(filter-out $(RECURSIVE_TARGETS),all clean install)
all: trunk-all
clean:: trunk-clean
set -e; for dir in $(SUBDIRS); do \
$(MAKE) -C "$$dir" -f "$(abs_srcdir)/$$dir/Makefile" $@; \
done
ifneq ($(abs_builddir),$(abs_srcdir))
$(RM) -Rf $(SUBDIRS)
endif
install: trunk-install
# Print out CURDIR to check for a recursion issue.
ifeq ($(strip $(SUBDIRS)),)
$(warning CURDIR is: $(CURDIR))
$(error SUBDIRS empty -- did you want generic_leaf_target instead?)
else
$(RECURSIVE_TARGETS): %: | $(SUBDIRS)
@set -e; for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir -f "$(abs_srcdir)/$$dir/Makefile" $@; \
done
endif
# vim: syntax=make

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks