- Build environment:
Archlinux,4.4.15-1-lts,x86_64g++ 6.1.1,openjdk-7
hotspot: contains the source code and tools to build the
openjdk hotspot virtual machine
langtools: contains the source code and tools to build
javacand thelanguage tools
corba: contains the build for
openjdk corba
jaxws
jaxp
The top level builds the whole openjdk.
jaxp and jaxws do not contain source code; these tools can be obtained from the web. A complete jdk image needs JAXP and JAX-WS — they are part of the jdk.
After a successful build, the result is in the build/j2sdk-image folder by default.
ALT_BOOTDIR: directory of the Bootstrap JDK
ALT_OUTPUTDIR: output path (absolute path)
ALT_COMPILE_PATH: compiler path
I mainly studied hotspot; the hotspot directory structure looks like this:
The hotspot directory
1 | . |
The entry Makefile
In the Makefile:
1 | all: all_product all_fastdebug |
From the targets above we can see that generating
all_productandall_fastdebugjust means generatingproduct,product1,docs,export,fastdebug,fastdebug1— so we have to prepare the builds one by one.
Then there are a few statements that basically express everything this
Makefiledoes. First it gets$(GAMMADIR), which is thehotspotdirectory, and$(GAMMADIR)/makerefers to the current folder. Things get much clearer now: these statements all call theMakefilethey live in.
This also suggests a way of writing
Makefiles: when you have some dependencies to build and don’t want to pass all variables down, you can use this approach to pass parameters selectively. (My own take — please point it out if it’s unreasonable.)
1 | $(C1_VM_TARGETS): |
generic_build2
Now we have a direction:
the Makefile first calls generic_build2, probably because the product dependency comes first.
1 | generic_build2: |
Since I mainly work on linux, this calls make/linux/Makefile and passes a number of parameters — there are many, so I won’t paste them here; you can print them yourself.