26 default: all |
26 default: all |
27 |
27 |
28 include $(SPEC) |
28 include $(SPEC) |
29 include MakeBase.gmk |
29 include MakeBase.gmk |
30 include JavaCompilation.gmk |
30 include JavaCompilation.gmk |
|
31 include Modules.gmk |
|
32 |
|
33 SRC_ZIP_WORK_DIR := $(SUPPORT_OUTPUTDIR)/src |
31 |
34 |
32 # Hook to include the corresponding custom file, if present. |
35 # Hook to include the corresponding custom file, if present. |
33 $(eval $(call IncludeCustomExtension, , ZipSource.gmk)) |
36 $(eval $(call IncludeCustomExtension, , ZipSource.gmk)) |
34 |
37 |
35 ################################################################################ |
38 ################################################################################ |
|
39 # Create the directory structure for src.zip using symlinks. |
|
40 # <module>/<package>/<file>.java |
36 |
41 |
37 # Use ?= to enable override in custom makefile |
42 # Find extra source dirs for a module that are not part of normal compilation |
38 SRC_ZIP_INCLUDES ?= \ |
43 # but should be included in src.zip. |
39 com \ |
44 # $1: Module to find dirs for |
40 java \ |
45 ExtraSrcDirs = \ |
41 javax \ |
46 $(wildcard $(SUPPORT_OUTPUTDIR)/rmic/$(strip $1)) |
42 jdk \ |
|
43 org \ |
|
44 sun \ |
|
45 # |
|
46 |
47 |
47 SRC_ZIP_EXCLUDES ?= |
48 ALL_MODULES := $(FindAllModules) |
48 |
49 |
49 SRC_ZIP_SRCS += $(wildcard \ |
50 # Generate the src dirs in the first make invocation and then call this makefile |
50 $(JDK_TOPDIR)/src/*/share/classes \ |
51 # again to create src.zip. |
51 $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \ |
52 $(foreach m, $(ALL_MODULES), \ |
52 $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \ |
53 $(foreach d, $(call FindModuleSrcDirs, $m) $(call ExtraSrcDirs, $m), \ |
53 $(LANGTOOLS_TOPDIR)/src/*/share/classes \ |
54 $(eval $d_TARGET := $(SRC_ZIP_WORK_DIR)/$(patsubst $(TOPDIR)/%,%,$d)/$m) \ |
54 $(CORBA_TOPDIR)/src/*/share/classes \ |
55 $(if $(SRC_GENERATED), , \ |
55 $(JAXP_TOPDIR)/src/*/share/classes \ |
56 $(eval $$($d_TARGET): $d ; \ |
56 $(JAXWS_TOPDIR)/src/*/share/classes \ |
57 $$(if $(filter $(TOPDIR)/%, $d), $$(link-file-relative), $$(link-file-absolute)) \ |
57 $(SUPPORT_OUTPUTDIR)/gensrc/j* \ |
58 ) \ |
58 $(SUPPORT_OUTPUTDIR)/rmic/j* \ |
|
59 ) \ |
59 ) \ |
60 # |
60 $(eval SRC_ZIP_SRCS += $$($d_TARGET)) \ |
|
61 $(eval SRC_ZIP_SRCS_$m += $$($d_TARGET)) \ |
|
62 ) \ |
|
63 ) |
61 |
64 |
62 # Need to copy launcher src files into desired directory structure |
65 TARGETS += $(SRC_ZIP_SRCS) |
63 # before zipping the sources. |
|
64 $(eval $(call SetupCopyFiles,COPY_LAUNCHER_SRC, \ |
|
65 SRC := $(JDK_TOPDIR)/src/java.base, \ |
|
66 DEST := $(SUPPORT_OUTPUTDIR)/src/launcher, \ |
|
67 FLATTEN := true, \ |
|
68 FILES := $(wildcard \ |
|
69 $(JDK_TOPDIR)/src/java.base/share/native/launcher/* \ |
|
70 $(JDK_TOPDIR)/src/java.base/share/native/libjli/* \ |
|
71 $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/java_md*))) |
|
72 |
66 |
73 # This dir needs to exist before macro is evaluated to avoid warning from find. |
67 ################################################################################ |
74 $(call MakeDir, $(SUPPORT_OUTPUTDIR)/src) |
68 # Only evaluate the creation of src.zip in a sub make call when the symlinked |
75 $(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \ |
69 # src directory structure has been generated. |
76 SRC := $(SRC_ZIP_SRCS) $(SUPPORT_OUTPUTDIR)/src, \ |
70 ifeq ($(SRC_GENERATED), true) |
77 INCLUDES := $(SRC_ZIP_INCLUDES) launcher, \ |
71 $(eval $(call SetupZipArchive, BUILD_SRC_ZIP, \ |
78 EXCLUDES := $(SRC_ZIP_EXCLUDES), \ |
72 SRC := $(dir $(SRC_ZIP_SRCS)), \ |
79 EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \ |
73 INCLUDES := $(SRC_ZIP_INCLUDES), \ |
80 SUFFIXES := .java .c .h, \ |
74 INCLUDE_FILES := $(SRC_ZIP_INCLUDE_FILES), \ |
81 ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \ |
75 EXCLUDES := $(SRC_ZIP_EXCLUDES), \ |
82 EXTRA_DEPS := $(COPY_LAUNCHER_SRC))) |
76 EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \ |
|
77 SUFFIXES := .java, \ |
|
78 ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \ |
|
79 )) |
|
80 |
|
81 do-zip: $(BUILD_SRC_ZIP) |
|
82 |
|
83 .PHONY: do-zip |
|
84 endif |
|
85 |
|
86 zip: $(SRC_ZIP_SRCS) |
|
87 +$(MAKE) $(MAKE_ARGS) -f ZipSource.gmk do-zip SRC_GENERATED=true |
|
88 |
|
89 TARGETS += zip |
83 |
90 |
84 ################################################################################ |
91 ################################################################################ |
85 |
92 |
86 all: $(BUILD_SRC_ZIP) |
93 all: $(TARGETS) |
87 |
94 |
88 .PHONY: default all |
95 .PHONY: default all zip |