Makefile.subdirs revision 1003
1265N/A# -*- Makefile -*- rules commonly shared among X consolidation open source dirs
1578N/A# Makefile.subdirs has rules for recursively iterating through module subdirs
1265N/A#
1265N/A# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
1578N/A#
1578N/A# Permission is hereby granted, free of charge, to any person obtaining a
98N/A# copy of this software and associated documentation files (the "Software"),
1577N/A# to deal in the Software without restriction, including without limitation
98N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
98N/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
919N/A# paragraph) shall be included in all copies or substantial portions of the
919N/A# Software.
98N/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
98N/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
919N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
919N/A# DEALINGS IN THE SOFTWARE.
919N/A#
919N/A#
919N/A
919N/A# MACH will be either "sparc" or "i386"
919N/AMACH=$(TARGET_ARCH:-%=%)
1578N/ASTART_CMD_ECHO = PS4="" ; set -x
98N/A
1578N/AOS_SUBDIRS=$(OS_SUBDIRS_$(MACH))
1124N/A
98N/A# Variables to always pass down to subdirs
98N/APASSDOWN_VARS = V="$(V)" TOP="$(TOP)" CDEBUGFLAGS="$(CDEBUGFLAGS)"
98N/A
1124N/A.DEFAULT:
851N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=$@
98N/A
98N/AWorld: clean all
98N/A
98N/Aclean: clean-subdirs clean-obsolete-subdirs
98N/A
1124N/Aclean-subdirs:
742N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=clean
742N/A
98N/Asubdirs: $(OS_SUBDIRS)
98N/A
98N/A$(OS_SUBDIRS): ALWAYS_RUN
1124N/A @case '${MAKEFLAGS}' in *[ik]*) set +e;; esac; \
1124N/A cd $@ ; \
1003N/A print "## making" $(OS_TARGET) "in open-src/$(DIRNAME)$@..."; \
1577N/A $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) $(OS_TARGET)
668N/A
98N/Aclean-obsolete-subdirs:
98N/A @ set +e; \
98N/A if [[ ! -z "$(OBSOLETE_SUBDIRS)" ]] ; then \
1578N/A for i in $(OBSOLETE_SUBDIRS) ; do \
1124N/A if [[ -d $$i ]] ; then \
1124N/A if [[ -f $$i/Makefile ]] ; then \
1124N/A $(MAKE) $(MAKEFLAGS) subdirs OS_TARGET=clean OS_SUBDIRS=$$i ; \
1578N/A else ; \
1124N/A print "## removing obsolete build directories in open-src/$(DIRNAME)$$i..."; \
1578N/A ($(START_CMD_ECHO) ; cd $$i && rm -rf build* ) ; \
1578N/A ($(START_CMD_ECHO) ; rmdir $$i ) ; \
1578N/A fi ; \
1578N/A fi ; \
1578N/A done ; \
1578N/A fi ; \
1202N/A return 0
1202N/A
1578N/A# Dummy target to force another target to always be run, even if a file
1578N/A# or directory with the same name already exists (as it will for subdirs)
98N/AALWAYS_RUN:
1578N/A
851N/A# Tell dmake it can build subdirs in parallel
851N/A.PARALLEL: $(OS_SUBDIRS)
98N/A