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