jdk/makefiles/common/Subdirs.gmk
changeset 13164 72c5d01a857d
parent 13082 9b19b2302c28
child 13167 efec101d7d87
equal deleted inserted replaced
13082:9b19b2302c28 13164:72c5d01a857d
     1 # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
       
     2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     3 #
       
     4 # This code is free software; you can redistribute it and/or modify it
       
     5 # under the terms of the GNU General Public License version 2 only, as
       
     6 # published by the Free Software Foundation.  Oracle designates this
       
     7 # particular file as subject to the "Classpath" exception as provided
       
     8 # by Oracle in the LICENSE file that accompanied this code.
       
     9 #
       
    10 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    13 # version 2 for more details (a copy is included in the LICENSE file that
       
    14 # accompanied this code).
       
    15 #
       
    16 # You should have received a copy of the GNU General Public License version
       
    17 # 2 along with this work; if not, write to the Free Software Foundation,
       
    18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    19 #
       
    20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    21 # or visit www.oracle.com if you need additional information or have any
       
    22 # questions.
       
    23 #
       
    24 
       
    25 #
       
    26 # Generic makefile for building subdirectories.
       
    27 #
       
    28 # SUBDIRS variables to specify the subdirectories to build recursively.
       
    29 # Makefile has to include Subdirs.gmk AFTER all SUBDIRS variables are
       
    30 # defined.
       
    31 #
       
    32 # This file does not contain any rule.
       
    33 #
       
    34 # WARNING: This file is shared with other workspaces.
       
    35 #          So when it includes other files, it must use JDK_TOPDIR.
       
    36 
       
    37 #
       
    38 # SUBDIRS          subdirs for the base module always get built
       
    39 # SUBDIRS_<group>  subdirs for the named group
       
    40 #
       
    41 # By default, subdirs specified in the SUBDIRS and all SUBDIRS_* 
       
    42 # variables will be built.
       
    43 #
       
    44 # Variables of the currently supported groups are:
       
    45 #  SUBDIRS_desktop    
       
    46 #  SUBDIRS_management
       
    47 #  SUBDIRS_enterprise
       
    48 #  SUBDIRS_misc
       
    49 #  SUBDIRS_tools
       
    50 # 
       
    51 # Change to the above list also need to update 
       
    52 # make/common/shared/Sanity.gmk.  NOTE: this list is subject
       
    53 # to change.
       
    54 # 
       
    55 # Eventually we want to restructure the make directory
       
    56 # according to these grouping (e.g. make/desktop/...) and
       
    57 # the SUBDIRS_<group> variables would not be needed.
       
    58 # 
       
    59 
       
    60 # Iterate the subdirectories specified in $1.
       
    61 # - cd into each subdir and make them
       
    62 
       
    63 # Given a SUBDIRS* list (first argument), cd into them and make them
       
    64 #   SUBDIRS_MAKEFLAGS      Make settings for a subdir make
       
    65 #   SUBDIRS_MAKEFLAGS-$@   Make settings specific to this target
       
    66 #
       
    67 define subdirs-group-loop
       
    68 $(ECHO) "Begin Processing SUBDIRS: $($1)"
       
    69 for i in DUMMY $($1) ; do \
       
    70   if [ "$$i" != "DUMMY" ] ; then \
       
    71     $(MAKE) -C $$i $@ $(SUBDIRS_MAKEFLAGS) $(SUBDIRS_MAKEFLAGS-$@) \
       
    72             FULL_VERSION=$(FULL_VERSION) RELEASE=$(RELEASE) || exit 1; \
       
    73   fi ; \
       
    74 done
       
    75 $(ECHO) "Done Processing SUBDIRS: $($1)"
       
    76 endef
       
    77 
       
    78 # Given a OTHERSUBDIRS list, cd into them and make them (extra loop define)
       
    79 #   OTHERSUBDIRS_MAKEFLAGS      Make settings for a subdir make
       
    80 define OTHERSUBDIRS-loop
       
    81 $(ECHO) "Begin Processing OTHERSUBDIRS: $(OTHERSUBDIRS)"
       
    82 for i in DUMMY $(OTHERSUBDIRS) ; do \
       
    83   if [ "$$i" != "DUMMY" ] ; then \
       
    84     $(MAKE) -C $$i $@ $(OTHERSUBDIRS_MAKEFLAGS) \
       
    85             FULL_VERSION=$(FULL_VERSION) RELEASE=$(RELEASE) || exit 1; \
       
    86   fi ; \
       
    87 done
       
    88 $(ECHO) "Done Processing OTHERSUBDIRS: $(OTHERSUBDIRS)"
       
    89 endef
       
    90 
       
    91 #
       
    92 # Iterate the list specified in SUBDIRS_<group> only if
       
    93 # SUBDIRS_<group> is set.
       
    94 #
       
    95 ifdef SUBDIRS_desktop 
       
    96   define subdirs-desktop-loop
       
    97       $(call subdirs-group-loop,SUBDIRS_desktop)
       
    98   endef
       
    99 else   
       
   100   define subdirs-desktop-loop
       
   101   endef
       
   102 endif   # SUBDIRS_desktop 
       
   103 
       
   104 ifdef SUBDIRS_enterprise 
       
   105   define subdirs-enterprise-loop
       
   106       $(call subdirs-group-loop,SUBDIRS_enterprise)
       
   107   endef
       
   108 else   
       
   109 define subdirs-enterprise-loop
       
   110 endef
       
   111 endif   # SUBDIRS_enterprise 
       
   112 
       
   113 ifdef SUBDIRS_management 
       
   114   define subdirs-management-loop
       
   115       $(call subdirs-group-loop,SUBDIRS_management)
       
   116   endef
       
   117 else   
       
   118   define subdirs-management-loop
       
   119   endef
       
   120 endif   # SUBDIRS_management 
       
   121 
       
   122 ifdef SUBDIRS_misc 
       
   123   define subdirs-misc-loop
       
   124       $(call subdirs-group-loop,SUBDIRS_misc)
       
   125   endef
       
   126 else   
       
   127   define subdirs-misc-loop
       
   128   endef
       
   129 endif   # SUBDIRS_misc 
       
   130 
       
   131 ifdef SUBDIRS_tools 
       
   132   define subdirs-tools-loop
       
   133       $(call subdirs-group-loop,SUBDIRS_tools)
       
   134   endef
       
   135 else   
       
   136   define subdirs-tools-loop
       
   137   endef
       
   138 endif   # SUBDIRS_tools 
       
   139 
       
   140 #
       
   141 # If BUILD_MODULES is not set or it's set to "all",
       
   142 # iterate all groups.
       
   143 SUBDIRS_all = $(SUBDIRS) $(SUBDIRS_desktop) $(SUBDIRS_enterprise) \
       
   144 	      $(SUBDIRS_management) $(SUBDIRS_misc) $(SUBDIRS_tools)
       
   145 
       
   146 define SUBDIRS-loop
       
   147   $(call subdirs-group-loop,SUBDIRS_all)
       
   148 endef