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