Makefile.subdirs revision 1466
246N/A# -*- Makefile -*- rules commonly shared among X consolidation open source dirs
246N/A# Makefile.subdirs has rules for recursively iterating through module subdirs
246N/A#
246N/A# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
246N/A#
246N/A# Permission is hereby granted, free of charge, to any person obtaining a
246N/A# copy of this software and associated documentation files (the "Software"),
246N/A# to deal in the Software without restriction, including without limitation
246N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
246N/A# and/or sell copies of the Software, and to permit persons to whom the
246N/A# Software is furnished to do so, subject to the following conditions:
246N/A#
246N/A# The above copyright notice and this permission notice (including the next
246N/A# paragraph) shall be included in all copies or substantial portions of the
246N/A# Software.
246N/A#
246N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
246N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
246N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
246N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
246N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
246N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
246N/A# DEALINGS IN THE SOFTWARE.
246N/A#
246N/A#
246N/A
246N/A# MACH will be either "sparc" or "i386"
246N/AMACH=$(TARGET_ARCH:-%=%)
246N/ASTART_CMD_ECHO = PS4="" ; set -x
246N/A
313N/AOS_SUBDIRS=$(OS_SUBDIRS_$(MACH))
246N/A
246N/A# Variables to always pass down to subdirs
246N/APASSDOWN_VARS = V="$(V)" TOP="$(TOP)" CDEBUGFLAGS="$(CDEBUGFLAGS)"
246N/A
246N/A.DEFAULT:
246N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=$@
246N/A
246N/AWorld: clobber all
246N/A
246N/Aclean: clean-subdirs clean-obsolete-subdirs
246N/A
246N/Aclean-subdirs:
246N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=clean
246N/A
246N/Asubdirs: $(OS_SUBDIRS)
246N/A
246N/A$(OS_SUBDIRS): ALWAYS_RUN
246N/A @case '${MAKEFLAGS}' in *[ik]*) set +e;; esac; \
246N/A cd $@ ; \
246N/A print "## making" $(OS_TARGET) "in open-src/$(DIRNAME)$@..."; \
246N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) $(OS_TARGET)
246N/A
246N/Aclean-obsolete-subdirs:
246N/A @ set +e; \
246N/A if [[ ! -z "$(OBSOLETE_SUBDIRS)" ]] ; then \
246N/A for i in $(OBSOLETE_SUBDIRS) ; do \
246N/A if [[ -d $$i ]] ; then \
246N/A if [[ -f $$i/Makefile ]] ; then \
246N/A $(MAKE) $(MAKEFLAGS) subdirs OS_TARGET=clean OS_SUBDIRS=$$i ; \
246N/A else ; \
246N/A print "## removing obsolete build directories in open-src/$(DIRNAME)$$i..."; \
246N/A ($(START_CMD_ECHO) ; cd $$i && rm -rf unpacked-src build* .checksum* ) ; \
246N/A ($(START_CMD_ECHO) ; rmdir $$i ) ; \
246N/A fi ; \
246N/A fi ; \
246N/A done ; \
249N/A fi ; \
246N/A return 0
246N/A
246N/A# Dummy target to force another target to always be run, even if a file
246N/A# or directory with the same name already exists (as it will for subdirs)
246N/AALWAYS_RUN:
378N/A
378N/A# Tell dmake it can build subdirs in parallel
378N/A.PARALLEL: $(OS_SUBDIRS)
378N/A