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