41 |
52 |
42 # ... and then we can include our helper functions |
53 # ... and then we can include our helper functions |
43 include $(dir $(makefile_path))/MakeHelpers.gmk |
54 include $(dir $(makefile_path))/MakeHelpers.gmk |
44 |
55 |
45 $(eval $(call ParseLogLevel)) |
56 $(eval $(call ParseLogLevel)) |
46 $(eval $(call SetupLogging)) |
|
47 $(eval $(call ParseConfAndSpec)) |
57 $(eval $(call ParseConfAndSpec)) |
48 |
58 |
49 ifneq ($(words $(SPEC)),1) |
59 # Now determine if we have zero, one or several configurations to build. |
50 ### We have multiple configurations to build, call make repeatedly |
60 ifeq ($(SPEC),) |
51 all clean dist-clean: |
61 # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. |
52 langtools corba jaxp jaxws hotspot jdk images overlay-images install: |
62 else |
53 langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only: |
63 ifeq ($(words $(SPEC)),1) |
54 clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images: |
64 # We are building a single configuration. This is the normal case. Execute the Main.gmk file. |
|
65 include $(dir $(makefile_path))/Main.gmk |
|
66 else |
|
67 # We are building multiple configurations. |
|
68 # First, find out the valid targets |
|
69 # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find |
|
70 # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. |
|
71 all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \ |
|
72 $(MAKE) -p -q -f $(makefile_path) SPEC=$(firstword $(SPEC)) | \ |
|
73 grep ^.PHONY: | head -n 1 | cut -d " " -f 2-))) |
|
74 |
|
75 $(all_phony_targets): |
55 @$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true |
76 @$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true |
56 |
77 |
57 .PHONY: all clean dist-clean |
|
58 .PHONY: langtools corba jaxp jaxws hotspot jdk images overlay-images install |
|
59 .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only overlay-images-only install-only |
|
60 .PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images |
|
61 |
|
62 else |
|
63 ### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file. |
|
64 |
|
65 # Now load the spec |
|
66 include $(SPEC) |
|
67 |
|
68 # Load the vital tools for all the makefiles. |
|
69 include $(SRC_ROOT)/common/makefiles/MakeBase.gmk |
|
70 |
|
71 ### Clean up from previous run |
|
72 |
|
73 # Remove any build.log from a previous run, if they exist |
|
74 ifneq (,$(BUILD_LOG)) |
|
75 ifneq (,$(BUILD_LOG_PREVIOUS)) |
|
76 # Rotate old log |
|
77 $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null) |
|
78 $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null) |
|
79 else |
|
80 $(shell $(RM) $(BUILD_LOG) 2> /dev/null) |
|
81 endif |
78 endif |
82 endif |
|
83 # Remove any javac server logs and port files. This |
|
84 # prevents a new make run to reuse the previous servers. |
|
85 ifneq (,$(SJAVAC_SERVER_DIR)) |
|
86 $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*) |
|
87 endif |
|
88 # Clean out any notifications from the previous build. |
|
89 $(shell $(FIND) $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE)) |
|
90 |
|
91 # Reset the build timers. |
|
92 $(eval $(call ResetTimers)) |
|
93 |
|
94 # Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line, |
|
95 # hence this workaround. |
|
96 ifeq ($(JOBS),) |
|
97 JOBS=$(NUM_CORES) |
|
98 endif |
|
99 MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS) |
|
100 |
|
101 ### Main targets |
|
102 |
|
103 all: jdk |
|
104 @$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port) |
|
105 @$(call AtRootMakeEnd) |
|
106 .PHONY: all |
|
107 |
|
108 langtools: start-make langtools-only |
|
109 langtools-only: |
|
110 @$(call MakeStart,langtools,all) |
|
111 @($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS)) |
|
112 @$(call MakeFinish,langtools,all) |
|
113 |
|
114 corba: langtools corba-only |
|
115 corba-only: |
|
116 @$(call MakeStart,corba,all) |
|
117 @($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS)) |
|
118 @$(call MakeFinish,corba,all) |
|
119 |
|
120 jaxp: langtools jaxp-only |
|
121 jaxp-only: |
|
122 @$(call MakeStart,jaxp,all) |
|
123 @($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS)) |
|
124 @$(call MakeFinish,jaxp,all) |
|
125 |
|
126 jaxws: langtools jaxp jaxws-only |
|
127 jaxws-only: |
|
128 @$(call MakeStart,jaxws,all) |
|
129 @($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS)) |
|
130 @$(call MakeFinish,jaxws,all) |
|
131 |
|
132 hotspot: langtools hotspot-only |
|
133 hotspot-only: |
|
134 @$(call MakeStart,hotspot,all) |
|
135 @($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk) |
|
136 @$(call MakeFinish,hotspot,all) |
|
137 |
|
138 jdk: langtools corba jaxp jaxws hotspot jdk-only |
|
139 jdk-only: |
|
140 @$(call MakeStart,jdk,all) |
|
141 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(JDK_TARGET)) |
|
142 @$(call MakeFinish,jdk,all) |
|
143 |
|
144 images: source-tips start-make jdk langtools corba jaxp jaxws hotspot images-only |
|
145 images-only: |
|
146 @$(call MakeStart,jdk-images,$@) |
|
147 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) images) |
|
148 @$(call MakeFinish,jdk-images,$@) |
|
149 @$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port) |
|
150 @$(call AtRootMakeEnd) |
|
151 |
|
152 overlay-images: source-tips start-make jdk langtools corba jaxp jaxws hotspot overlay-images-only |
|
153 overlay-images-only: |
|
154 @$(call MakeStart,jdk-overlay-images,$@) |
|
155 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) overlay-images) |
|
156 @$(call MakeFinish,jdk-overlay-images,$@) |
|
157 @$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port) |
|
158 @$(call AtRootMakeEnd) |
|
159 |
|
160 install: source-tips start-make jdk langtools corba jaxp jaxws hotspot install-only |
|
161 install-only: |
|
162 @$(call MakeStart,jdk-images,$@) |
|
163 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) install) |
|
164 @$(call MakeFinish,jdk-images,$@) |
|
165 @$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port) |
|
166 @$(call AtRootMakeEnd) |
|
167 |
|
168 docs: start-make jdk docs-only |
|
169 docs-only: |
|
170 @$(call MakeStart,docs,$@) |
|
171 @($(CD) $(SRC_ROOT)/common/makefiles/javadoc && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs) |
|
172 @$(call MakeFinish,docs,$@) |
|
173 @$(if $(SJAVAC_SERVER_DIR),$(RM) -rf $(SJAVAC_SERVER_DIR)/*.port) |
|
174 @$(call AtRootMakeEnd) |
|
175 |
|
176 |
|
177 .PHONY: langtools corba jaxp jaxws hotspot jdk images install |
|
178 .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only images-only install-only |
|
179 |
|
180 start-make: |
|
181 @$(call AtRootMakeStart) |
|
182 .PHONY: start-make |
|
183 |
|
184 bootcycle-images: |
|
185 @$(ECHO) Boot cycle build step 1: Building the JDK image normally |
|
186 @($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(SPEC) images) |
|
187 @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image |
|
188 @($(CD) $(SRC_ROOT)/common/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images) |
|
189 |
|
190 test: start-make |
|
191 @$(call MakeStart,test,$(if $(TEST),$(TEST),all)) |
|
192 @($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) MAKEFLAGS= -j1 PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true |
|
193 @$(call MakeFinish,test,$(if $(TEST),$(TEST),all)) |
|
194 @$(call AtRootMakeEnd) |
|
195 .PHONY: test |
|
196 |
|
197 |
|
198 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be |
|
199 # used to track the exact sources used to build that image. |
|
200 source-tips: $(OUTPUT_ROOT)/source_tips |
|
201 $(OUTPUT_ROOT)/source_tips: FRC |
|
202 @$(MKDIR) -p $(@D) |
|
203 @$(RM) $@ |
|
204 @$(call GetSourceTips) |
|
205 |
|
206 |
|
207 # Remove everything, except the output from configure. |
|
208 clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images clean-bootcycle-build |
|
209 @($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log*) |
|
210 @$(ECHO) Cleaned everything except the build configuration. |
|
211 .PHONY: clean |
|
212 |
|
213 # Remove everything, you have to rerun configure. |
|
214 dist-clean: |
|
215 @$(RM) -r $(OUTPUT_ROOT) |
|
216 @$(ECHO) Cleaned everything, you will have to re-run configure. |
|
217 .PHONY: dist-clean |
|
218 |
|
219 clean-langtools: |
|
220 $(call CleanComponent,langtools) |
|
221 clean-corba: |
|
222 $(call CleanComponent,corba) |
|
223 clean-jaxp: |
|
224 $(call CleanComponent,jaxp) |
|
225 clean-jaxws: |
|
226 $(call CleanComponent,jaxws) |
|
227 clean-hotspot: |
|
228 $(call CleanComponent,hotspot) |
|
229 clean-jdk: |
|
230 $(call CleanComponent,jdk) |
|
231 clean-images: |
|
232 $(call CleanComponent,images) |
|
233 clean-bootcycle-build: |
|
234 $(call CleanComponent,bootcycle-build) |
|
235 |
|
236 .PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-images |
|
237 |
|
238 endif |
79 endif |
239 |
80 |
240 # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. |
81 # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. |
241 # If you addd more global targets, please update the fatal-error macro. |
82 # If you addd more global targets, please update the variable global_targets in MakeHelpers. |
242 |
83 |
243 help: |
84 help: |
244 $(info ) |
85 $(info ) |
245 $(info OpenJDK Makefile help) |
86 $(info OpenJDK Makefile help) |
246 $(info =====================) |
87 $(info =====================) |