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