883 <h3 id="developing-the-build-system-itself">Developing the Build System Itself</h3> |
883 <h3 id="developing-the-build-system-itself">Developing the Build System Itself</h3> |
884 <p>This section contains a few remarks about how to develop for the build system itself. It is not relevant if you are only making changes in the product source code.</p> |
884 <p>This section contains a few remarks about how to develop for the build system itself. It is not relevant if you are only making changes in the product source code.</p> |
885 <p>While technically using <code>make</code>, the make source files of the OpenJDK does not resemble most other Makefiles. Instead of listing specific targets and actions (perhaps using patterns), the basic modus operandi is to call a high-level function (or properly, macro) from the API in <code>make/common</code>. For instance, to compile all classes in the <code>jdk.internal.foo</code> package in the <code>jdk.foo</code> module, a call like this would be made:</p> |
885 <p>While technically using <code>make</code>, the make source files of the OpenJDK does not resemble most other Makefiles. Instead of listing specific targets and actions (perhaps using patterns), the basic modus operandi is to call a high-level function (or properly, macro) from the API in <code>make/common</code>. For instance, to compile all classes in the <code>jdk.internal.foo</code> package in the <code>jdk.foo</code> module, a call like this would be made:</p> |
886 <pre><code>$(eval $(call SetupJavaCompilation, BUILD_FOO_CLASSES, \ |
886 <pre><code>$(eval $(call SetupJavaCompilation, BUILD_FOO_CLASSES, \ |
887 SETUP := GENERATE_OLDBYTECODE, \ |
887 SETUP := GENERATE_OLDBYTECODE, \ |
888 SRC := $(JDK_TOPDIR)/src/jkd.foo/share/classes, \ |
888 SRC := $(TOPDIR)/src/jkd.foo/share/classes, \ |
889 INCLUDES := jdk/internal/foo, \ |
889 INCLUDES := jdk/internal/foo, \ |
890 BIN := $(SUPPORT_OUTPUTDIR)/foo_classes, \ |
890 BIN := $(SUPPORT_OUTPUTDIR)/foo_classes, \ |
891 ))</code></pre> |
891 ))</code></pre> |
892 <p>By encapsulating and expressing the high-level knowledge of <em>what</em> should be done, rather than <em>how</em> it should be done (as is normal in Makefiles), we can build a much more powerful and flexible build system.</p> |
892 <p>By encapsulating and expressing the high-level knowledge of <em>what</em> should be done, rather than <em>how</em> it should be done (as is normal in Makefiles), we can build a much more powerful and flexible build system.</p> |
893 <p>Correct dependency tracking is paramount. Sloppy dependency tracking will lead to improper parallelization, or worse, race conditions.</p> |
893 <p>Correct dependency tracking is paramount. Sloppy dependency tracking will lead to improper parallelization, or worse, race conditions.</p> |