|
1 # Copyright 2010 Sun Microsystems, Inc. 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. Sun designates this |
|
7 # particular file as subject to the "Classpath" exception as provided |
|
8 # by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
21 # CA 95054 USA or visit www.sun.com if you need additional information or |
|
22 # have any 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 # BUILD_MODULES variable can be used to specify one or more groups |
|
45 # to be built (BUILD_MODULES=all will build all groups). |
|
46 # |
|
47 # Variables of the currently supported groups are: |
|
48 # SUBDIRS_desktop |
|
49 # SUBDIRS_management |
|
50 # SUBDIRS_enterprise |
|
51 # SUBDIRS_misc |
|
52 # SUBDIRS_tools |
|
53 # |
|
54 # Change to the above list also need to update |
|
55 # make/common/shared/Sanity.gmk. NOTE: this list is subject |
|
56 # to change till the JDK 7 SE profiles/modules are finalized. |
|
57 # |
|
58 # Eventually we want to restructure the make directory |
|
59 # according to these grouping (e.g. make/desktop/...) and |
|
60 # the SUBDIRS_<group> variables would not be needed. |
|
61 # |
|
62 # To build the desktop and tools groups only, you can do: |
|
63 # gnumake BUILD_MODULES="desktop tools" ... |
|
64 # |
|
65 |
|
66 # Iterate the subdirectories specified in $1. |
|
67 # - cd into each subdir and make them |
|
68 |
|
69 # Given a SUBDIRS* list (first argument), cd into them and make them |
|
70 # SUBDIRS_MAKEFLAGS Make settings for a subdir make |
|
71 # SUBDIRS_MAKEFLAGS-$@ Make settings specific to this target |
|
72 # |
|
73 define subdirs-group-loop |
|
74 @$(ECHO) "Begin Processing SUBDIRS: $($1)" |
|
75 @for i in DUMMY $($1) ; do \ |
|
76 if [ "$$i" != "DUMMY" ] ; then \ |
|
77 $(MAKE) -C $$i $@ $(SUBDIRS_MAKEFLAGS) $(SUBDIRS_MAKEFLAGS-$@) \ |
|
78 FULL_VERSION=$(FULL_VERSION) RELEASE=$(RELEASE) || exit 1; \ |
|
79 fi ; \ |
|
80 done |
|
81 @$(ECHO) "Done Processing SUBDIRS: $($1)" |
|
82 endef |
|
83 |
|
84 # Given a OTHERSUBDIRS list, cd into them and make them (extra loop define) |
|
85 # OTHERSUBDIRS_MAKEFLAGS Make settings for a subdir make |
|
86 define OTHERSUBDIRS-loop |
|
87 @$(ECHO) "Begin Processing OTHERSUBDIRS: $(OTHERSUBDIRS)" |
|
88 @for i in DUMMY $(OTHERSUBDIRS) ; do \ |
|
89 if [ "$$i" != "DUMMY" ] ; then \ |
|
90 $(MAKE) -C $$i $@ $(OTHERSUBDIRS_MAKEFLAGS) \ |
|
91 FULL_VERSION=$(FULL_VERSION) RELEASE=$(RELEASE) || exit 1; \ |
|
92 fi ; \ |
|
93 done |
|
94 @$(ECHO) "Done Processing OTHERSUBDIRS: $(OTHERSUBDIRS)" |
|
95 endef |
|
96 |
|
97 # |
|
98 # Iterate the list specified in SUBDIRS_<group> only if |
|
99 # SUBDIRS_<group> is set and <group> or "all" is specified |
|
100 # in the BUILD_MODULES variable |
|
101 # |
|
102 ifdef SUBDIRS_desktop |
|
103 ifneq (,$(findstring desktop, $(BUILD_MODULES))) |
|
104 define subdirs-desktop-loop |
|
105 @$(call subdirs-group-loop,SUBDIRS_desktop) |
|
106 endef |
|
107 else |
|
108 define subdirs-desktop-loop |
|
109 endef |
|
110 endif |
|
111 else |
|
112 define subdirs-desktop-loop |
|
113 endef |
|
114 endif # SUBDIRS_desktop |
|
115 |
|
116 ifdef SUBDIRS_enterprise |
|
117 ifneq (,$(findstring enterprise, $(BUILD_MODULES))) |
|
118 define subdirs-enterprise-loop |
|
119 @$(call subdirs-group-loop,SUBDIRS_enterprise) |
|
120 endef |
|
121 else |
|
122 define subdirs-enterprise-loop |
|
123 endef |
|
124 endif |
|
125 else |
|
126 define subdirs-enterprise-loop |
|
127 endef |
|
128 endif # SUBDIRS_enterprise |
|
129 |
|
130 ifdef SUBDIRS_management |
|
131 ifneq (,$(findstring management, $(BUILD_MODULES))) |
|
132 define subdirs-management-loop |
|
133 @$(call subdirs-group-loop,SUBDIRS_management) |
|
134 endef |
|
135 else |
|
136 define subdirs-management-loop |
|
137 endef |
|
138 endif |
|
139 else |
|
140 define subdirs-management-loop |
|
141 endef |
|
142 endif # SUBDIRS_management |
|
143 |
|
144 ifdef SUBDIRS_misc |
|
145 ifneq (,$(findstring misc, $(BUILD_MODULES))) |
|
146 define subdirs-misc-loop |
|
147 @$(call subdirs-group-loop,SUBDIRS_misc) |
|
148 endef |
|
149 else |
|
150 define subdirs-misc-loop |
|
151 endef |
|
152 endif |
|
153 else |
|
154 define subdirs-misc-loop |
|
155 endef |
|
156 endif # SUBDIRS_misc |
|
157 |
|
158 ifdef SUBDIRS_tools |
|
159 ifneq (,$(findstring tools, $(BUILD_MODULES))) |
|
160 define subdirs-tools-loop |
|
161 @$(call subdirs-group-loop,SUBDIRS_tools) |
|
162 endef |
|
163 else |
|
164 define subdirs-tools-loop |
|
165 endef |
|
166 endif |
|
167 else |
|
168 define subdirs-tools-loop |
|
169 endef |
|
170 endif # SUBDIRS_tools |
|
171 |
|
172 # |
|
173 # If BUILD_MODULES is not set or it's set to "all", |
|
174 # iterate all groups. |
|
175 SUBDIRS_all = $(SUBDIRS) $(SUBDIRS_desktop) $(SUBDIRS_enterprise) \ |
|
176 $(SUBDIRS_management) $(SUBDIRS_misc) $(SUBDIRS_tools) |
|
177 |
|
178 ifndef BUILD_MODULES |
|
179 define SUBDIRS-loop |
|
180 @$(call subdirs-group-loop,SUBDIRS_all) |
|
181 endef |
|
182 |
|
183 else |
|
184 |
|
185 ifneq (,$(findstring all, $(BUILD_MODULES))) |
|
186 define SUBDIRS-loop |
|
187 @$(call subdirs-group-loop,SUBDIRS_all) |
|
188 endef |
|
189 |
|
190 else # BUILD_MODULES set |
|
191 # |
|
192 # Iterate SUBDIRS and the groups specified in BUILD_MODULES |
|
193 # |
|
194 define SUBDIRS-loop |
|
195 @$(call subdirs-group-loop,SUBDIRS) |
|
196 @$(subdirs-desktop-loop) |
|
197 @$(subdirs-enterprise-loop) |
|
198 @$(subdirs-management-loop) |
|
199 @$(subdirs-misc-loop) |
|
200 @$(subdirs-tools-loop) |
|
201 endef |
|
202 |
|
203 endif |
|
204 endif # BUILD_MODULES |