Makefile.subdirs revision 1422
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# -*- Makefile -*- rules commonly shared among X consolidation open source dirs
229ea4644b3a7d9c7fdaa43888e7f55ba01e2ee3Automatic Updater# Makefile.subdirs has rules for recursively iterating through module subdirs
1167fc7904c5f0a472f8df207ac46dd52c7f1ec8Automatic Updater# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
46da3117812814a29432a8d9a9ccf8acdbfdadceAutomatic Updater# Permission is hereby granted, free of charge, to any person obtaining a
2bb3422dc683c013db7042f5736240de6b86f182Automatic Updater# copy of this software and associated documentation files (the "Software"),
cd0aa2d941d1438fabb5337f1f38c49478edf71dAutomatic Updater# to deal in the Software without restriction, including without limitation
90ff38a0d8deaf5f9c2aa5916d99b2e572d28738Automatic Updater# the rights to use, copy, modify, merge, publish, distribute, sublicense,
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# and/or sell copies of the Software, and to permit persons to whom the
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# Software is furnished to do so, subject to the following conditions:
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# The above copyright notice and this permission notice (including the next
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater# paragraph) shall be included in all copies or substantial portions of the
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58be84825d7f5de30e50eb7206b37227ecd8055bAutomatic Updater# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3cc98b8ecedcbc8465f1cf2740b966b315662430Automatic Updater# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
e171a4137c6ba348957e61b7c4c3541493c0da02Automatic Updater# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
831f79c4310a7d38fc3475ccfff531b2b2535641Automatic Updater# DEALINGS IN THE SOFTWARE.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater# MACH will be either "sparc" or "i386"
91216cff91b34c9ff6e846dc23f248219cafe660Andreas GustafssonMACH=$(TARGET_ARCH:-%=%)
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic UpdaterSTART_CMD_ECHO = PS4="" ; set -x
91216cff91b34c9ff6e846dc23f248219cafe660Andreas GustafssonOS_SUBDIRS=$(OS_SUBDIRS_$(MACH))
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# Variables to always pass down to subdirs
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic UpdaterPASSDOWN_VARS = V="$(V)" TOP="$(TOP)" CDEBUGFLAGS="$(CDEBUGFLAGS)"
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=$@
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic UpdaterWorld: clobber all
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterclean: clean-subdirs clean-obsolete-subdirs
2d2dc37599979c83495510f8af8d1756753aa2c5Automatic Updater $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) subdirs OS_TARGET=clean
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updatersubdirs: $(OS_SUBDIRS)
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater$(OS_SUBDIRS): ALWAYS_RUN
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater @case '${MAKEFLAGS}' in *[ik]*) set +e;; esac; \
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater print "## making" $(OS_TARGET) "in open-src/$(DIRNAME)$@..."; \
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater $(MAKE) $(MAKEFLAGS) $(PASSDOWN_VARS) $(OS_TARGET)
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updaterclean-obsolete-subdirs:
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater if [[ ! -z "$(OBSOLETE_SUBDIRS)" ]] ; then \
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews for i in $(OBSOLETE_SUBDIRS) ; do \
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews if [[ -d $$i ]] ; then \
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews if [[ -f $$i/Makefile ]] ; then \
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington $(MAKE) $(MAKEFLAGS) subdirs OS_TARGET=clean OS_SUBDIRS=$$i ; \
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews print "## removing obsolete build directories in open-src/$(DIRNAME)$$i..."; \
129090f0f6f91753b4a085ab635e28549fd018adAutomatic Updater ($(START_CMD_ECHO) ; cd $$i && rm -rf unpacked-src build* .checksum* ) ; \
129090f0f6f91753b4a085ab635e28549fd018adAutomatic Updater ($(START_CMD_ECHO) ; rmdir $$i ) ; \
1a06700908f5a1d9f4a8d51285a0fd971e2f9117Automatic Updater# Dummy target to force another target to always be run, even if a file
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# or directory with the same name already exists (as it will for subdirs)
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Tell dmake it can build subdirs in parallel
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater.PARALLEL: $(OS_SUBDIRS)