1*49cdfc7eSAndroid Build Coastguard Worker# 2*49cdfc7eSAndroid Build Coastguard Worker# A Makefile with a collection of reusable functions. 3*49cdfc7eSAndroid Build Coastguard Worker# 4*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) Linux Test Project, 2009-2020 5*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) Cisco Systems Inc., 2009 6*49cdfc7eSAndroid Build Coastguard Worker# 7*49cdfc7eSAndroid Build Coastguard Worker# This program is free software; you can redistribute it and/or modify 8*49cdfc7eSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by 9*49cdfc7eSAndroid Build Coastguard Worker# the Free Software Foundation; either version 2 of the License, or 10*49cdfc7eSAndroid Build Coastguard Worker# (at your option) any later version. 11*49cdfc7eSAndroid Build Coastguard Worker# 12*49cdfc7eSAndroid Build Coastguard Worker# This program is distributed in the hope that it will be useful, 13*49cdfc7eSAndroid Build Coastguard Worker# but WITHOUT ANY WARRANTY; without even the implied warranty of 14*49cdfc7eSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*49cdfc7eSAndroid Build Coastguard Worker# GNU General Public License for more details. 16*49cdfc7eSAndroid Build Coastguard Worker# 17*49cdfc7eSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License along 18*49cdfc7eSAndroid Build Coastguard Worker# with this program; if not, write to the Free Software Foundation, Inc., 19*49cdfc7eSAndroid Build Coastguard Worker# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20*49cdfc7eSAndroid Build Coastguard Worker# 21*49cdfc7eSAndroid Build Coastguard Worker# Ngie Cooper, July 2009 22*49cdfc7eSAndroid Build Coastguard Worker# 23*49cdfc7eSAndroid Build Coastguard Worker 24*49cdfc7eSAndroid Build Coastguard Worker# Generate an install rule which also creates the install directory if needed 25*49cdfc7eSAndroid Build Coastguard Worker# to avoid unnecessary bourne shell based for-loops and install errors, as well 26*49cdfc7eSAndroid Build Coastguard Worker# as adhoc install rules. 27*49cdfc7eSAndroid Build Coastguard Worker# 28*49cdfc7eSAndroid Build Coastguard Worker# 1 -> Target basename. 29*49cdfc7eSAndroid Build Coastguard Worker# 2 -> Source directory. 30*49cdfc7eSAndroid Build Coastguard Worker# 3 -> Destination directory. 31*49cdfc7eSAndroid Build Coastguard Worker 32*49cdfc7eSAndroid Build Coastguard Workerdefine generate_install_rule 33*49cdfc7eSAndroid Build Coastguard Worker 34*49cdfc7eSAndroid Build Coastguard WorkerINSTALL_FILES += $$(abspath $$(DESTDIR)/$(3)/$(1)) 35*49cdfc7eSAndroid Build Coastguard Worker 36*49cdfc7eSAndroid Build Coastguard Worker$$(abspath $$(DESTDIR)/$(3)/$(1)): \ 37*49cdfc7eSAndroid Build Coastguard Worker $$(abspath $$(dir $$(DESTDIR)/$(3)/$(1))) 38*49cdfc7eSAndroid Build Coastguard Worker install -m $$(INSTALL_MODE) $(shell test -d "$(2)/$(1)" && echo "-d") $(PARAM) "$(2)/$(1)" $$@ 39*49cdfc7eSAndroid Build Coastguard Worker $(shell test -d "$(2)/$(1)" && echo "install -m "'$$(INSTALL_MODE) $(PARAM)' "$(2)/$(1)/*" -t '$$@') 40*49cdfc7eSAndroid Build Coastguard Workerendef 41*49cdfc7eSAndroid Build Coastguard Worker 42*49cdfc7eSAndroid Build Coastguard Worker# 43*49cdfc7eSAndroid Build Coastguard Worker# Set SUBDIRS to the subdirectories where Makefiles were found. 44*49cdfc7eSAndroid Build Coastguard Worker# 45*49cdfc7eSAndroid Build Coastguard Workerdefine get_make_dirs 46*49cdfc7eSAndroid Build Coastguard WorkerSUBDIRS ?= $$(subst $$(abs_srcdir)/,,$$(patsubst %/Makefile,%,$$(wildcard $$(abs_srcdir)/*/Makefile))) 47*49cdfc7eSAndroid Build Coastguard WorkerSUBDIRS := $$(filter-out $$(FILTER_OUT_DIRS),$$(SUBDIRS)) 48*49cdfc7eSAndroid Build Coastguard Workerendef 49