21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
22 # CA 95054 USA or visit www.sun.com if you need additional information or |
22 # CA 95054 USA or visit www.sun.com if you need additional information or |
23 # have any questions. |
23 # have any questions. |
24 # |
24 # |
25 |
25 |
26 # Makefile for jaxp: wrapper around Ant build.xml file |
26 # Makefile wrapper around Ant build.xml file |
27 |
27 |
28 # |
28 # |
29 # On Solaris, the 'make' utility from Sun will not work with these makefiles. |
29 # On Solaris, the 'make' utility from Sun will not work with these makefiles. |
30 # This little rule is only understood by Sun's make, and is harmless |
30 # This little rule is only understood by Sun's make, and is harmless |
31 # when seen by the GNU make tool. If using Sun's make, this causes the |
31 # when seen by the GNU make tool. If using Sun's make, this causes the |
39 |
39 |
40 ifdef VERBOSE |
40 ifdef VERBOSE |
41 ANT_OPTIONS += -verbose |
41 ANT_OPTIONS += -verbose |
42 endif |
42 endif |
43 |
43 |
44 ifdef JDK_VERSION |
44 ifeq ($(VARIANT), OPT) |
45 ANT_OPTIONS += -Djdk.version=$(JDK_VERSION) |
45 ifneq ($(DEBUG_CLASSFILES), true) |
46 endif |
|
47 |
|
48 ifdef FULL_VERSION |
|
49 ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces |
|
50 endif |
|
51 |
|
52 ifdef MILESTONE |
|
53 ANT_OPTIONS += -Dmilestone=$(MILESTONE) |
|
54 endif |
|
55 |
|
56 ifdef BUILD_NUMBER |
|
57 ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER) |
|
58 else |
|
59 ifdef JDK_BUILD_NUMBER |
|
60 ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER) |
|
61 endif |
|
62 endif |
|
63 |
|
64 ifeq ($(VARIANT), DBG) |
|
65 ANT_OPTIONS += -Djavac.debug=true |
|
66 else |
|
67 ifeq ($(VARIANT), OPT) |
|
68 ANT_OPTIONS += -Djavac.debug=false |
46 ANT_OPTIONS += -Djavac.debug=false |
69 endif |
47 endif |
70 endif |
|
71 |
|
72 ifeq ($(DEBUG_CLASSFILES), true) |
|
73 ANT_OPTIONS += -Djavac.debug=true |
|
74 endif |
48 endif |
75 |
49 |
76 # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN) |
50 # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN) |
77 # and the somewhat misnamed CLASS_VERSION (-target NN) |
51 # and the somewhat misnamed CLASS_VERSION (-target NN) |
78 ifdef TARGET_CLASS_VERSION |
52 ifdef TARGET_CLASS_VERSION |
79 ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION) |
53 ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION) |
80 else |
54 else |
81 ifdef JAVAC_TARGET_ARG |
55 ifdef JAVAC_TARGET_ARG |
82 ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG) |
56 ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG) |
83 endif |
57 endif |
84 endif |
58 endif |
85 |
59 |
86 ifdef SOURCE_LANGUAGE_VERSION |
60 ifdef SOURCE_LANGUAGE_VERSION |
87 ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION) |
61 ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION) |
88 else |
62 else |
89 ifdef JAVAC_SOURCE_ARG |
63 ifdef JAVAC_SOURCE_ARG |
90 ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG) |
64 ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG) |
91 endif |
65 endif |
92 endif |
66 endif |
93 |
67 |
94 ifdef ALT_BOOTDIR |
68 # Figure out the platform we are using |
95 ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR) |
69 _SYSTEM_UNAME := $(shell uname) |
|
70 _PLATFORM_KIND = unix |
|
71 ifeq ($(_SYSTEM_UNAME), Windows_NT) |
|
72 _PLATFORM_KIND = windows |
96 endif |
73 endif |
|
74 ifneq (,$(findstring CYGWIN,$(_SYSTEM_UNAME))) |
|
75 _PLATFORM_KIND = windows |
|
76 endif |
|
77 |
|
78 # Where is /java in case we need it |
|
79 ifdef ALT_SLASH_JAVA |
|
80 _SLASHJAVA = $(ALT_SLASH_JAVA) |
|
81 else |
|
82 ifeq ($(_PLATFORM_KIND), windows) |
|
83 _SLASHJAVA=J:/ |
|
84 else |
|
85 _SLASHJAVA=/java |
|
86 endif |
|
87 endif |
|
88 |
|
89 # Where is /java/devtools in case we need it |
|
90 ifdef ALT_JDK_DEVTOOLS_DIR |
|
91 _DEVTOOLS = $(ALT_JDK_DEVTOOLS_DIR) |
|
92 else |
|
93 _DEVTOOLS = $(_SLASHJAVA)/devtools |
|
94 endif |
|
95 |
|
96 # Add in path to devtools |
|
97 ANT_OPTIONS += -Ddevtools=$(_DEVTOOLS) |
97 |
98 |
98 ifdef ALT_OUTPUTDIR |
99 ifdef ALT_OUTPUTDIR |
99 OUTPUTDIR = $(ALT_OUTPUTDIR) |
100 OUTPUTDIR = $(ALT_OUTPUTDIR) |
100 ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build |
101 ANT_OPTIONS += -Doutput.dir=$(ALT_OUTPUTDIR) |
101 ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist |
|
102 else |
102 else |
103 OUTPUTDIR = .. |
103 OUTPUTDIR = .. |
104 endif |
104 endif |
105 |
105 |
106 ifdef ALT_LANGTOOLS_DIST |
106 ifdef ALT_LANGTOOLS_DIST |
|
107 ifdef ALT_BOOTDIR |
|
108 ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR) |
|
109 endif |
107 ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap |
110 ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap |
108 endif |
111 else |
109 |
112 ifdef ALT_JDK_IMPORT_PATH |
110 ifdef FINDBUGS_HOME |
113 ANT_JAVA_HOME = JAVA_HOME=$(ALT_JDK_IMPORT_PATH) |
111 ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME) |
114 endif |
112 endif |
115 endif |
113 |
116 |
114 ifdef ANT_HOME |
117 ifdef ANT_HOME |
115 ANT = $(ANT_HOME)/bin/ant |
118 ANT = $(ANT_HOME)/bin/ant |
116 ifneq ($(shell test -x $(ANT); echo $$?), 0) |
119 ifneq ($(shell test -x $(ANT); echo $$?), 0) |
122 $(error "\"ant\" not found; please set ANT_HOME or put \"ant\" on your PATH") |
125 $(error "\"ant\" not found; please set ANT_HOME or put \"ant\" on your PATH") |
123 endif |
126 endif |
124 endif |
127 endif |
125 |
128 |
126 # Default target and expected 'do everything' target |
129 # Default target and expected 'do everything' target |
127 all: build |
130 default: all |
128 |
|
129 # Standard make clobber target |
|
130 clobber: clean |
|
131 |
131 |
132 # All ant targets of interest |
132 # All ant targets of interest |
133 ANT_TARGETS = build clean sanity # for now |
133 ANT_TARGETS = all source build dist clobber clean sanity |
134 |
134 |
135 # Create a make target for each |
135 # Create a make target for each |
136 $(ANT_TARGETS): |
136 $(ANT_TARGETS): |
137 $(ANT_JAVA_HOME) $(ANT) -version |
137 cd .. && $(ANT_JAVA_HOME) $(ANT) -version |
138 $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@ |
138 cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@ |
|
139 |
|
140 # Help target |
|
141 define helpenvline |
|
142 @echo " $1";echo " $2" |
|
143 endef |
|
144 help: |
|
145 @echo "----------------------------------------------------------" |
|
146 @echo " " |
|
147 @echo "Help information for this Makefile:" |
|
148 @echo " " |
|
149 @echo " Targets (see ant project information for descriptions):" |
|
150 @echo " $(ANT_TARGETS)" |
|
151 @echo " " |
|
152 @echo " Environment or command line variables (all optional):" |
|
153 $(call helpenvline, ALT_BOOTDIR,\ |
|
154 "JAVA_HOME to use when running ant") |
|
155 $(call helpenvline, ALT_LANGTOOLS_DIST,\ |
|
156 "path to langtools repository dist directory") |
|
157 $(call helpenvline, ALT_OUTPUTDIR,\ |
|
158 "path to root of output") |
|
159 $(call helpenvline, DEBUG_CLASSFILES,\ |
|
160 "if set makes sure ant property javac.debug is true") |
|
161 $(call helpenvline, JAVAC_SOURCE_ARG,\ |
|
162 "if SOURCE_LANGUAGE_VERSION not set uses this to set ant property javac.source") |
|
163 $(call helpenvline, JAVAC_TARGET_ARG,\ |
|
164 "if TARGET_CLASS_VERSION not set uses this to set ant property javac.target") |
|
165 $(call helpenvline, SOURCE_LANGUAGE_VERSION,\ |
|
166 "if set uses this to set ant property javac.source") |
|
167 $(call helpenvline, QUIET,\ |
|
168 "if set will pass -quiet to ant") |
|
169 $(call helpenvline, TARGET_CLASS_VERSION,\ |
|
170 "JAVA_HOME to use when running ant") |
|
171 $(call helpenvline, VARIANT,\ |
|
172 "if set to OPT means optimized build will set javac.debug to false") |
|
173 $(call helpenvline, VERBOSE,\ |
|
174 "if set will pass -verbose to ant") |
|
175 @echo " " |
|
176 @echo "----------------------------------------------------------" |
|
177 @echo " " |
|
178 @echo "Ant project file help information:" |
|
179 @echo " " |
|
180 @$(ANT_JAVA_HOME) cd .. && $(ANT) $(ANT_OPTIONS) -p |
|
181 @echo " " |
|
182 @echo "----------------------------------------------------------" |
139 |
183 |
140 # Targets for Sun's internal JPRT build system |
184 # Targets for Sun's internal JPRT build system |
141 JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip |
185 JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip |
142 jprt_build_product jprt_build_debug jprt_build_fastdebug: all |
186 jprt_build_product jprt_build_debug jprt_build_fastdebug: all |
143 $(RM) $(JPRT_ARCHIVE_BUNDLE) |
187 $(RM) $(JPRT_ARCHIVE_BUNDLE) |
144 ( cd $(OUTPUTDIR)/dist && \ |
188 ( cd $(OUTPUTDIR)/dist && \ |
145 zip -q -r $(JPRT_ARCHIVE_BUNDLE) . ) |
189 zip -q -r $(JPRT_ARCHIVE_BUNDLE) . ) |
146 |
190 |
147 # Declare these phony (not filenames) |
191 # Declare these phony (not filenames) |
148 .PHONY: $(ANT_TARGETS) all clobber \ |
192 .PHONY: $(ANT_TARGETS) \ |
149 jprt_build_product jprt_build_debug jprt_build_fastdebug |
193 jprt_build_product jprt_build_debug jprt_build_fastdebug |