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