1 #
2 # Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
98
99 #----- locations and deliverables
100
101 TOPDIR = ..
102 SRC_BIN_DIR = $(TOPDIR)/src/share/bin
103 SRC_CLASSES_DIR = $(TOPDIR)/src/share/classes
104
105 BUILD_DIR = $(TOPDIR)/build
106
107 CLASSES_DIR = $(BUILD_DIR)/classes
108 GENSRC_DIR = $(BUILD_DIR)/gensrc
109
110 DIST_DIR = $(TOPDIR)/dist
111 BIN_DIR = $(DIST_DIR)/bin
112 LIB_DIR = $(DIST_DIR)/lib
113
114 JAVAC_JAR = $(LIB_DIR)/javac.jar
115 JAVADOC_JAR = $(LIB_DIR)/javadoc.jar
116 JAVAH_JAR = $(LIB_DIR)/javah.jar
117 JAVAP_JAR = $(LIB_DIR)/javap.jar
118 APT_JAR = $(LIB_DIR)/apt.jar
119
120 CLASSES_JAR = $(DIST_DIR)/classes.jar
121 SRC_ZIP = $(DIST_DIR)/src.zip
122
123 BUILDTOOLSRC_DIR = tools
124 BUILDTOOLCLASSES_DIR = $(BUILD_DIR)/toolclasses
125
126 #-----
127
128 ifndef JDK_MAJOR_VERSION
129 JDK_MAJOR_VERSION = 1
130 endif
131
132 ifndef JDK_MINOR_VERSION
133 JDK_MINOR_VERSION = 7
134 endif
135
136 ifndef JDK_MICRO_VERSION
137 JDK_MICRO_VERSION = 0
138 endif
146 endif
147
148 # RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set
149 ifneq ($(MILESTONE),fcs)
150 RELEASE = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE)
151 else
152 RELEASE = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE)
153 endif
154
155 # FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set
156 ifdef BUILD_NUMBER
157 FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER)
158 else
159 BUILD_NUMBER = b00
160 USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`)
161 FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER)
162 endif
163
164 #----- useful macros
165
166 TOOLS = javac javadoc javah javap apt
167
168 SOURCE_LEVEL = 5
169 BOOTSTRAP_TARGET_LEVEL = 5
170 TARGET_LEVEL = 6
171
172 ifndef TARGET_JAVA
173 TARGET_JAVA = java
174 endif
175
176 NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true
177
178 SELF = $(lastword $(MAKEFILE_LIST))
179
180 #-----
181
182 # the default is to generate the following:
183 # dist/{bin,lib}:
184 # lang tools compiled to run on the target JDK
185
186 default:
302
303 #----- javap
304
305 JAVAP_DIRS = \
306 sun/tools/javap
307
308 JAVAP_RESOURCE_FILES = \
309 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAP_DIRS)) -name SCCS -prune -o -name \*.properties -print )
310
311 JAVAP_JAVA_FILES = \
312 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAP_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
313 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAP_RESOURCE_FILES))
314
315 $(JAVAP_JAR): $(JAVAP_JAVA_FILES) \
316 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAP_RESOURCE_FILES))
317 $(MKDIR) -p $(CLASSES_DIR)
318 $(BOOT_JAVAC) -sourcepath "" -classpath $(CLASSES_DIR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(JAVAP_JAVA_FILES)
319 ( $(ECHO) Main-Class: sun.tools.javap.Main ) > $(BUILD_DIR)/javap.mf
320 $(BOOTJAR) -cfm $@ $(BUILD_DIR)/javap.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVAP_DIRS))
321
322 #----- apt
323
324 APT_DIRS = \
325 com/sun/mirror \
326 com/sun/tools/apt
327
328 APT_RESOURCE_FILES = \
329 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(APT_DIRS)) -name SCCS -prune -o -name \*.properties -print )
330
331 APT_JAVA_FILES = \
332 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(APT_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
333 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(APT_RESOURCE_FILES))
334
335 $(APT_JAR): $(APT_JAVA_FILES) $(JAVAC_JAR) \
336 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(APT_RESOURCE_FILES))
337 $(MKDIR) -p $(CLASSES_DIR) $(@D)
338 $(BOOT_JAVAC) -sourcepath "" -classpath $(CLASSES_DIR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(NO_PROPRIETARY_API_WARNINGS) \
339 $(APT_JAVA_FILES) \
340 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(APT_RESOURCE_FILES))
341 ( $(ECHO) Main-Class: com.sun.tools.apt.Main ; $(ECHO) Class-Path: javac.jar ) > $(BUILD_DIR)/apt.mf
342 $(BOOTJAR) -cfm $@ $(BUILD_DIR)/apt.mf $(patsubst %,-C $(CLASSES_DIR) %, $(APT_DIRS))
343
344 #-----
345
346 build-tools: $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
347
348 $(GENSRC_DIR)/%.java: $(SRC_CLASSES_DIR)/%.properties $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
349 $(MKDIR) -p $(@D)
350 $(BOOT_JAVA) -cp $(BUILDTOOLCLASSES_DIR)/CompileProperties CompileProperties $< $(patsubst $(CLASSES_DIR)/%.class,$(GENSRC_DIR)/%.java,$@)
351
352 $(GENSRC_DIR)/%.java: $(GENSRC_DIR)/%.properties $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
353 $(MKDIR) -p $(@D)
354 $(BOOT_JAVA) -cp $(BUILDTOOLCLASSES_DIR)/CompileProperties CompileProperties $< $(patsubst $(CLASSES_DIR)/%.class,$(GENSRC_DIR)/%.java,$@)
355
356 $(GENSRC_DIR)/%.properties: $(SRC_CLASSES_DIR)/%.properties-template
357 $(MKDIR) -p $(@D)
358 $(SED) -e 's/$$(JDK_VERSION)/$(JDK_VERSION)/' \
359 -e 's/$$(FULL_VERSION)/$(FULL_VERSION)/' \
360 -e 's/$$(RELEASE)/$(RELEASE)/' \
361 < $< > $@
362
363 $(BUILDTOOLCLASSES_DIR)/%.class : $(BUILDTOOLSRC_DIR)/%.java
364 $(MKDIR) -p $(@D)
365 $(BOOT_JAVAC) -d $(@D) $<
366
367 #----- all classes
368
369 $(DIST_DIR)/%/classes.jar: $(JAVAC_JAR) $(JAVADOC_JAR) $(JAVAH_JAR) $(JAVAP_JAR) $(APT_JAR)
370 $(MKDIR) -p $(@D)
371 $(BOOTJAR) -cf $@ -C $(CLASSES_DIR) .
372
373 #----- src.zip
374
375 SRC_ZIP_FILES = $(shell $(FIND) $(SRC_CLASSES_DIR) \( -name SCCS -o -name \*-template \) -prune -o -type f -print )
376
377 $(DIST_DIR)/%/src.zip: $(SRC_ZIP_FILES)
378 abs_src_zip=`cd $(@D) ; pwd`/$(@F) ; \
379 ( cd $(SRC_CLASSES_DIR) ; $(FIND) . \( -name SCCS -o -name \*-template \) -prune -o -type f -print | $(ZIP) -q $$abs_src_zip -@ ) ; \
380 ( cd $(SRC_CLASSES_DIR) ; $(FIND) . -name SCCS -prune -o -name \*-template -print | $(SED) -e 's/-template//' ) | ( cd $(GENSRC_DIR) ; $(ZIP) -q $$abs_src_zip -@ )
381
382 #----- bin files
383
384 $(BIN_DIR)/%: $(SRC_BIN_DIR)/launcher.sh-template
385 $(MKDIR) -p $(@D)
386 $(SED) -e 's|#PROGRAM#|$(@F)|' -e 's|#TARGET_JAVA#|$(TARGET_JAVA)|' $< > $@
387 $(CHMOD) +x $@
388
389 #-----
390
391 findbugs: $(BUILD_DIR)/findbugs.txt
392
393 $(BUILD_DIR)/findbugs.txt: $(CLASSES_JAR)
394 $(MKDIR) -p $(@D)
395 $(FINDBUGS) -textui -javahome $(BOOT_JAVA_HOME) -high -emacs -outputFile $@ $<
396
397 #-----
398
399 quick-check: $(patsubst %, $(DIST_LIB_DIR)/%.jar, $(TOOLS))
400 $(TESTJAVA) -jar $(JAVAC_JAR) -version
401 - $(TESTJAVA) -jar $(JAVADOC_JAR) -version
402 $(TESTJAVA) -jar $(JAVAH_JAR) -version
403 - $(TESTJAVA) -jar $(JAVAP_JAR) -version
404 $(TESTJAVA) -jar $(APT_JAR) -version
405
406 #-----
407
408 .PHONY: \
409 all \
410 build \
411 build-tools \
412 clean \
413 default \
414 findbugs \
415 jprt_product_build \
416 jprt_debug_build \
417 jprt_fastdebug_build \
418 tools
419
|
1 #
2 # Copyright (c) 2007, 2012 Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
98
99 #----- locations and deliverables
100
101 TOPDIR = ..
102 SRC_BIN_DIR = $(TOPDIR)/src/share/bin
103 SRC_CLASSES_DIR = $(TOPDIR)/src/share/classes
104
105 BUILD_DIR = $(TOPDIR)/build
106
107 CLASSES_DIR = $(BUILD_DIR)/classes
108 GENSRC_DIR = $(BUILD_DIR)/gensrc
109
110 DIST_DIR = $(TOPDIR)/dist
111 BIN_DIR = $(DIST_DIR)/bin
112 LIB_DIR = $(DIST_DIR)/lib
113
114 JAVAC_JAR = $(LIB_DIR)/javac.jar
115 JAVADOC_JAR = $(LIB_DIR)/javadoc.jar
116 JAVAH_JAR = $(LIB_DIR)/javah.jar
117 JAVAP_JAR = $(LIB_DIR)/javap.jar
118
119 CLASSES_JAR = $(DIST_DIR)/classes.jar
120 SRC_ZIP = $(DIST_DIR)/src.zip
121
122 BUILDTOOLSRC_DIR = tools
123 BUILDTOOLCLASSES_DIR = $(BUILD_DIR)/toolclasses
124
125 #-----
126
127 ifndef JDK_MAJOR_VERSION
128 JDK_MAJOR_VERSION = 1
129 endif
130
131 ifndef JDK_MINOR_VERSION
132 JDK_MINOR_VERSION = 7
133 endif
134
135 ifndef JDK_MICRO_VERSION
136 JDK_MICRO_VERSION = 0
137 endif
145 endif
146
147 # RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set
148 ifneq ($(MILESTONE),fcs)
149 RELEASE = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE)
150 else
151 RELEASE = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE)
152 endif
153
154 # FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set
155 ifdef BUILD_NUMBER
156 FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER)
157 else
158 BUILD_NUMBER = b00
159 USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`)
160 FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER)
161 endif
162
163 #----- useful macros
164
165 TOOLS = javac javadoc javah javap
166
167 SOURCE_LEVEL = 5
168 BOOTSTRAP_TARGET_LEVEL = 5
169 TARGET_LEVEL = 6
170
171 ifndef TARGET_JAVA
172 TARGET_JAVA = java
173 endif
174
175 NO_PROPRIETARY_API_WARNINGS = -XDignore.symbol.file=true
176
177 SELF = $(lastword $(MAKEFILE_LIST))
178
179 #-----
180
181 # the default is to generate the following:
182 # dist/{bin,lib}:
183 # lang tools compiled to run on the target JDK
184
185 default:
301
302 #----- javap
303
304 JAVAP_DIRS = \
305 sun/tools/javap
306
307 JAVAP_RESOURCE_FILES = \
308 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAP_DIRS)) -name SCCS -prune -o -name \*.properties -print )
309
310 JAVAP_JAVA_FILES = \
311 $(shell find $(patsubst %,$(SRC_CLASSES_DIR)/%,$(JAVAP_DIRS)) -name SCCS -prune -o -name \*.java -print ) \
312 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAP_RESOURCE_FILES))
313
314 $(JAVAP_JAR): $(JAVAP_JAVA_FILES) \
315 $(patsubst $(SRC_CLASSES_DIR)/%.properties,$(GENSRC_DIR)/%.java,$(JAVAP_RESOURCE_FILES))
316 $(MKDIR) -p $(CLASSES_DIR)
317 $(BOOT_JAVAC) -sourcepath "" -classpath $(CLASSES_DIR) -d $(CLASSES_DIR) -target $(TARGET_LEVEL) $(JAVAP_JAVA_FILES)
318 ( $(ECHO) Main-Class: sun.tools.javap.Main ) > $(BUILD_DIR)/javap.mf
319 $(BOOTJAR) -cfm $@ $(BUILD_DIR)/javap.mf $(patsubst %,-C $(CLASSES_DIR) %, $(JAVAP_DIRS))
320
321 #-----
322
323 build-tools: $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
324
325 $(GENSRC_DIR)/%.java: $(SRC_CLASSES_DIR)/%.properties $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
326 $(MKDIR) -p $(@D)
327 $(BOOT_JAVA) -cp $(BUILDTOOLCLASSES_DIR)/CompileProperties CompileProperties $< $(patsubst $(CLASSES_DIR)/%.class,$(GENSRC_DIR)/%.java,$@)
328
329 $(GENSRC_DIR)/%.java: $(GENSRC_DIR)/%.properties $(BUILDTOOLCLASSES_DIR)/CompileProperties/CompileProperties.class
330 $(MKDIR) -p $(@D)
331 $(BOOT_JAVA) -cp $(BUILDTOOLCLASSES_DIR)/CompileProperties CompileProperties $< $(patsubst $(CLASSES_DIR)/%.class,$(GENSRC_DIR)/%.java,$@)
332
333 $(GENSRC_DIR)/%.properties: $(SRC_CLASSES_DIR)/%.properties-template
334 $(MKDIR) -p $(@D)
335 $(SED) -e 's/$$(JDK_VERSION)/$(JDK_VERSION)/' \
336 -e 's/$$(FULL_VERSION)/$(FULL_VERSION)/' \
337 -e 's/$$(RELEASE)/$(RELEASE)/' \
338 < $< > $@
339
340 $(BUILDTOOLCLASSES_DIR)/%.class : $(BUILDTOOLSRC_DIR)/%.java
341 $(MKDIR) -p $(@D)
342 $(BOOT_JAVAC) -d $(@D) $<
343
344 #----- all classes
345
346 $(DIST_DIR)/%/classes.jar: $(JAVAC_JAR) $(JAVADOC_JAR) $(JAVAH_JAR) $(JAVAP_JAR)
347 $(MKDIR) -p $(@D)
348 $(BOOTJAR) -cf $@ -C $(CLASSES_DIR) .
349
350 #----- src.zip
351
352 SRC_ZIP_FILES = $(shell $(FIND) $(SRC_CLASSES_DIR) \( -name SCCS -o -name \*-template \) -prune -o -type f -print )
353
354 $(DIST_DIR)/%/src.zip: $(SRC_ZIP_FILES)
355 abs_src_zip=`cd $(@D) ; pwd`/$(@F) ; \
356 ( cd $(SRC_CLASSES_DIR) ; $(FIND) . \( -name SCCS -o -name \*-template \) -prune -o -type f -print | $(ZIP) -q $$abs_src_zip -@ ) ; \
357 ( cd $(SRC_CLASSES_DIR) ; $(FIND) . -name SCCS -prune -o -name \*-template -print | $(SED) -e 's/-template//' ) | ( cd $(GENSRC_DIR) ; $(ZIP) -q $$abs_src_zip -@ )
358
359 #----- bin files
360
361 $(BIN_DIR)/%: $(SRC_BIN_DIR)/launcher.sh-template
362 $(MKDIR) -p $(@D)
363 $(SED) -e 's|#PROGRAM#|$(@F)|' -e 's|#TARGET_JAVA#|$(TARGET_JAVA)|' $< > $@
364 $(CHMOD) +x $@
365
366 #-----
367
368 findbugs: $(BUILD_DIR)/findbugs.txt
369
370 $(BUILD_DIR)/findbugs.txt: $(CLASSES_JAR)
371 $(MKDIR) -p $(@D)
372 $(FINDBUGS) -textui -javahome $(BOOT_JAVA_HOME) -high -emacs -outputFile $@ $<
373
374 #-----
375
376 quick-check: $(patsubst %, $(DIST_LIB_DIR)/%.jar, $(TOOLS))
377 $(TESTJAVA) -jar $(JAVAC_JAR) -version
378 - $(TESTJAVA) -jar $(JAVADOC_JAR) -version
379 $(TESTJAVA) -jar $(JAVAH_JAR) -version
380 - $(TESTJAVA) -jar $(JAVAP_JAR) -version
381
382 #-----
383
384 .PHONY: \
385 all \
386 build \
387 build-tools \
388 clean \
389 default \
390 findbugs \
391 jprt_product_build \
392 jprt_debug_build \
393 jprt_fastdebug_build \
394 tools
395
|