--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/common/Subdirs.gmk Tue Apr 10 08:22:03 2012 -0700
@@ -0,0 +1,148 @@
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Generic makefile for building subdirectories.
+#
+# SUBDIRS variables to specify the subdirectories to build recursively.
+# Makefile has to include Subdirs.gmk AFTER all SUBDIRS variables are
+# defined.
+#
+# This file does not contain any rule.
+#
+# WARNING: This file is shared with other workspaces.
+# So when it includes other files, it must use JDK_TOPDIR.
+
+#
+# SUBDIRS subdirs for the base module always get built
+# SUBDIRS_<group> subdirs for the named group
+#
+# By default, subdirs specified in the SUBDIRS and all SUBDIRS_*
+# variables will be built.
+#
+# Variables of the currently supported groups are:
+# SUBDIRS_desktop
+# SUBDIRS_management
+# SUBDIRS_enterprise
+# SUBDIRS_misc
+# SUBDIRS_tools
+#
+# Change to the above list also need to update
+# make/common/shared/Sanity.gmk. NOTE: this list is subject
+# to change.
+#
+# Eventually we want to restructure the make directory
+# according to these grouping (e.g. make/desktop/...) and
+# the SUBDIRS_<group> variables would not be needed.
+#
+
+# Iterate the subdirectories specified in $1.
+# - cd into each subdir and make them
+
+# Given a SUBDIRS* list (first argument), cd into them and make them
+# SUBDIRS_MAKEFLAGS Make settings for a subdir make
+# SUBDIRS_MAKEFLAGS-$@ Make settings specific to this target
+#
+define subdirs-group-loop
+$(ECHO) "Begin Processing SUBDIRS: $($1)"
+for i in DUMMY $($1) ; do \
+ if [ "$$i" != "DUMMY" ] ; then \
+ $(MAKE) -C $$i $@ $(SUBDIRS_MAKEFLAGS) $(SUBDIRS_MAKEFLAGS-$@) \
+ FULL_VERSION=$(FULL_VERSION) RELEASE=$(RELEASE) || exit 1; \
+ fi ; \
+done
+$(ECHO) "Done Processing SUBDIRS: $($1)"
+endef
+
+# Given a OTHERSUBDIRS list, cd into them and make them (extra loop define)
+# OTHERSUBDIRS_MAKEFLAGS Make settings for a subdir make
+define OTHERSUBDIRS-loop
+$(ECHO) "Begin Processing OTHERSUBDIRS: $(OTHERSUBDIRS)"
+for i in DUMMY $(OTHERSUBDIRS) ; do \
+ if [ "$$i" != "DUMMY" ] ; then \
+ $(MAKE) -C $$i $@ $(OTHERSUBDIRS_MAKEFLAGS) \
+ FULL_VERSION=$(FULL_VERSION) RELEASE=$(RELEASE) || exit 1; \
+ fi ; \
+done
+$(ECHO) "Done Processing OTHERSUBDIRS: $(OTHERSUBDIRS)"
+endef
+
+#
+# Iterate the list specified in SUBDIRS_<group> only if
+# SUBDIRS_<group> is set.
+#
+ifdef SUBDIRS_desktop
+ define subdirs-desktop-loop
+ $(call subdirs-group-loop,SUBDIRS_desktop)
+ endef
+else
+ define subdirs-desktop-loop
+ endef
+endif # SUBDIRS_desktop
+
+ifdef SUBDIRS_enterprise
+ define subdirs-enterprise-loop
+ $(call subdirs-group-loop,SUBDIRS_enterprise)
+ endef
+else
+define subdirs-enterprise-loop
+endef
+endif # SUBDIRS_enterprise
+
+ifdef SUBDIRS_management
+ define subdirs-management-loop
+ $(call subdirs-group-loop,SUBDIRS_management)
+ endef
+else
+ define subdirs-management-loop
+ endef
+endif # SUBDIRS_management
+
+ifdef SUBDIRS_misc
+ define subdirs-misc-loop
+ $(call subdirs-group-loop,SUBDIRS_misc)
+ endef
+else
+ define subdirs-misc-loop
+ endef
+endif # SUBDIRS_misc
+
+ifdef SUBDIRS_tools
+ define subdirs-tools-loop
+ $(call subdirs-group-loop,SUBDIRS_tools)
+ endef
+else
+ define subdirs-tools-loop
+ endef
+endif # SUBDIRS_tools
+
+#
+# If BUILD_MODULES is not set or it's set to "all",
+# iterate all groups.
+SUBDIRS_all = $(SUBDIRS) $(SUBDIRS_desktop) $(SUBDIRS_enterprise) \
+ $(SUBDIRS_management) $(SUBDIRS_misc) $(SUBDIRS_tools)
+
+define SUBDIRS-loop
+ $(call subdirs-group-loop,SUBDIRS_all)
+endef