56 |
56 |
57 # Now determine if we have zero, one or several configurations to build. |
57 # Now determine if we have zero, one or several configurations to build. |
58 ifeq ($(SPEC),) |
58 ifeq ($(SPEC),) |
59 # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. |
59 # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. |
60 else |
60 else |
61 ifeq ($(words $(SPEC)),1) |
61 # In Cygwin, the MAKE variable gets messed up if the make executable is called with |
62 # We are building a single configuration. This is the normal case. Execute the Main.gmk file. |
62 # a Windows mixed path (c:/cygwin/bin/make.exe). If that's the case, fix it by removing |
63 include $(root_dir)/make/Main.gmk |
63 # the prepended root_dir. |
64 else |
64 ifneq ($(findstring :, $(MAKE)), ) |
65 # We are building multiple configurations. |
65 MAKE := $(patsubst $(root_dir)%, %, $(MAKE)) |
66 # First, find out the valid targets |
66 endif |
67 # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find |
|
68 # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. |
|
69 all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \ |
|
70 cd $(root_dir) && $(MAKE) -p -q FRC SPEC=$(firstword $(SPEC)) | \ |
|
71 grep ^.PHONY: | head -n 1 | cut -d " " -f 2-))) |
|
72 |
67 |
73 $(all_phony_targets): |
68 # We are potentially building multiple configurations. |
74 @$(foreach spec,$(SPEC),(cd $(root_dir) && $(MAKE) SPEC=$(spec) \ |
69 # First, find out the valid targets |
75 $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true |
70 # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find |
|
71 # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. |
|
72 all_phony_targets := $(sort $(filter-out $(global_targets), $(strip $(shell \ |
|
73 cd $(root_dir)/make && $(MAKE) -f Main.gmk -p -q FRC SPEC=$(firstword $(SPEC)) | \ |
|
74 grep "^.PHONY:" | head -n 1 | cut -d " " -f 2-)))) |
76 |
75 |
77 .PHONY: $(all_phony_targets) |
76 # Loop through the configurations and call the main-wrapper for each one. The wrapper |
|
77 # target will execute with a single configuration loaded. |
|
78 $(all_phony_targets): |
|
79 @$(if $(TARGET_RUN),,\ |
|
80 $(foreach spec,$(SPEC),\ |
|
81 (cd $(root_dir) && $(MAKE) SPEC=$(spec) MAIN_TARGETS="$(call GetRealTarget)" \ |
|
82 $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) main-wrapper) &&) true) |
|
83 @echo > /dev/null |
|
84 $(eval TARGET_RUN=true) |
78 |
85 |
79 endif |
86 .PHONY: $(all_phony_targets) |
|
87 |
|
88 ifneq ($(MAIN_TARGETS), ) |
|
89 # The wrapper target was called so we now have a single configuration. Load the spec file |
|
90 # and call the real Main.gmk. |
|
91 include $(SPEC) |
|
92 |
|
93 ### Clean up from previous run |
|
94 # Remove any build.log from a previous run, if they exist |
|
95 ifneq (,$(BUILD_LOG)) |
|
96 ifneq (,$(BUILD_LOG_PREVIOUS)) |
|
97 # Rotate old log |
|
98 $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null) |
|
99 $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null) |
|
100 else |
|
101 $(shell $(RM) $(BUILD_LOG) 2> /dev/null) |
|
102 endif |
|
103 $(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null) |
|
104 endif |
|
105 # Remove any javac server logs and port files. This |
|
106 # prevents a new make run to reuse the previous servers. |
|
107 ifneq (,$(SJAVAC_SERVER_DIR)) |
|
108 $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*) |
|
109 endif |
|
110 |
|
111 main-wrapper: |
|
112 @$(if $(findstring clean, $(MAIN_TARGETS)), , $(call AtMakeStart)) |
|
113 (cd $(root_dir)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -f Main.gmk SPEC=$(SPEC) -j $(JOBS) \ |
|
114 $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(MAIN_TARGETS) \ |
|
115 $(if $(filter true, $(OUTPUT_SYNC_SUPPORTED)), -O$(OUTPUT_SYNC))) |
|
116 @$(if $(findstring clean, $(MAIN_TARGETS)), , $(call AtMakeEnd)) |
|
117 |
|
118 .PHONY: main-wrapper |
|
119 |
|
120 endif |
80 endif |
121 endif |
81 |
122 |
82 # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. |
123 # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. |
83 # If you addd more global targets, please update the variable global_targets in MakeHelpers. |
124 # If you add more global targets, please update the variable global_targets in MakeHelpers. |
84 |
125 |
85 help: |
126 help: |
86 $(info ) |
127 $(info ) |
87 $(info OpenJDK Makefile help) |
128 $(info OpenJDK Makefile help) |
88 $(info =====================) |
129 $(info =====================) |
89 $(info ) |
130 $(info ) |
90 $(info Common make targets) |
131 $(info Common make targets) |
91 $(info . make [default] # Compile all product in langtools, hotspot, jaxp, jaxws,) |
132 $(info . make [default] # Compile all modules in langtools, hotspot, jaxp, jaxws,) |
92 $(info . # corba and jdk) |
133 $(info . # corba and jdk and create a runnable "exploded" image) |
93 $(info . make all # Compile everything, all repos and images) |
134 $(info . make all # Compile everything, all repos, docs and images) |
94 $(info . make images # Create complete j2sdk and j2re images) |
135 $(info . make images # Create complete j2sdk and j2re images) |
95 $(info . make docs # Create javadocs) |
136 $(info . make docs # Create all docs) |
96 $(info . make overlay-images # Create limited images for sparc 64 bit platforms) |
137 $(info . make docs-javadoc # Create just javadocs, depends on less than full docs) |
97 $(info . make profiles # Create complete j2re compact profile images) |
138 $(info . make profiles # Create complete j2re compact profile images) |
98 $(info . make bootcycle-images # Build images twice, second time with newly build JDK) |
139 $(info . make bootcycle-images # Build images twice, second time with newly build JDK) |
99 $(info . make install # Install the generated images locally) |
140 $(info . make install # Install the generated images locally) |
100 $(info . make clean # Remove all files generated by make, but not those) |
141 $(info . make clean # Remove all files generated by make, but not those) |
101 $(info . # generated by configure) |
142 $(info . # generated by configure) |
102 $(info . make dist-clean # Remove all files, including configuration) |
143 $(info . make dist-clean # Remove all files, including configuration) |
103 $(info . make help # Give some help on using make) |
144 $(info . make help # Give some help on using make) |
104 $(info . make test # Run tests, default is all tests (see TEST below)) |
145 $(info . make test # Run tests, default is all tests (see TEST below)) |
105 $(info ) |
146 $(info ) |
106 $(info Targets for specific components) |
147 $(info Targets for specific modules) |
107 $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test)) |
148 $(info . make <module> # Build <module> and everything it depends on. ) |
108 $(info . make <component> # Build <component> and everything it depends on. ) |
149 $(info . make <module>-only # Build <module> only, without dependencies. This) |
109 $(info . make <component>-only # Build <component> only, without dependencies. This) |
|
110 $(info . # is faster but can result in incorrect build results!) |
150 $(info . # is faster but can result in incorrect build results!) |
111 $(info . make clean-<component> # Remove files generated by make for <component>) |
151 $(info . make <module>-java # Compile java classes for <module> and everything it) |
|
152 $(info . # depends on) |
|
153 $(info . make <module>-libs # Build native libraries for <module> and everything it) |
|
154 $(info . # depends on) |
|
155 $(info . make <module>-launchers# Build native executables for <module> and everything it) |
|
156 $(info . # depends on) |
|
157 $(info . make <module>-gensrc # Execute the gensrc step for <module> and everything it) |
|
158 $(info . # depends on) |
112 $(info ) |
159 $(info ) |
113 $(info Useful make variables) |
160 $(info Useful make variables) |
114 $(info . make CONF= # Build all configurations (note, assignment is empty)) |
161 $(info . make CONF= # Build all configurations (note, assignment is empty)) |
115 $(info . make CONF=<substring> # Build the configuration(s) with a name matching) |
162 $(info . make CONF=<substring> # Build the configuration(s) with a name matching) |
116 $(info . # <substring>) |
163 $(info . # <substring>) |