Fri, 04 Jan 2013 16:56:37 +0100
8005692: build-infra: Target "all" should do the right thing
Reviewed-by: tbell
1 #
2 # Copyright (c) 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
23 # questions.
24 #
26 # This file is included by the root NewerMakefile and contains targets
27 # and utilities needed by JPRT.
29 # Utilities used in this Makefile
30 CAT=cat
31 CMP=cmp
32 CP=cp
33 ECHO=echo
34 MKDIR=mkdir
35 PRINTF=printf
36 PWD=pwd
37 # Insure we have a path that looks like it came from pwd
38 # (This is mostly for Windows sake and drive letters)
39 define UnixPath # path
40 $(shell (cd "$1" && $(PWD)))
41 endef
43 BUILD_DIR_ROOT:=$(root_dir)/build
45 ###########################################################################
46 # To help in adoption of the new configure&&make build process, a bridge
47 # build will use the old settings to run configure and do the build.
49 # Build with the configure bridge. After running configure, restart make
50 # to parse the new spec file.
51 BRIDGE_TARGETS := all
52 bridgeBuild: bridge2configure
53 @cd $(root_dir) && $(MAKE) -f NewMakefile.gmk $(BRIDGE_TARGETS)
55 # Bridge from old Makefile ALT settings to configure options
56 bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
57 bash ./configure $(strip $(shell $(CAT) $<))
59 # Create a file with configure options created from old Makefile mechanisms.
60 $(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
61 $(RM) $@
62 $(CP) $< $@
64 # Use this file to only change when obvious things have changed
65 $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
66 $(RM) $@.tmp
67 $(MKDIR) -p $(BUILD_DIR_ROOT)
68 @$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
69 ifdef ARCH_DATA_MODEL
70 @$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
71 endif
72 ifeq ($(ARCH_DATA_MODEL),32)
73 @$(ECHO) " --with-jvm-variants=client,server " >> $@.tmp
74 endif
75 ifdef ALT_PARALLEL_COMPILE_JOBS
76 @$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
77 endif
78 ifdef ALT_BOOTDIR
79 @$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
80 endif
81 ifdef ALT_CUPS_HEADERS_PATH
82 @$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
83 endif
84 ifdef ALT_FREETYPE_HEADERS_PATH
85 @$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
86 endif
87 ifdef OPENJDK
88 @$(ECHO) " --enable-openjdk-only " >> $@.tmp
89 endif
90 # Todo: move to closed?
91 ifdef ALT_MOZILLA_HEADERS_PATH
92 @$(ECHO) " --with-mozilla-headers=$(call UnixPath,$(ALT_MOZILLA_HEADERS_PATH)) " >> $@.tmp
93 endif
94 ifdef ALT_JUNIT_DIR
95 @$(ECHO) " --with-junit-dir=$(call UnixPath,$(ALT_JUNIT_DIR)) " >> $@.tmp
96 endif
97 ifdef ANT_HOME
98 @$(ECHO) " --with-ant-home=$(call UnixPath,$(ANT_HOME)) " >> $@.tmp
99 endif
100 ifdef ALT_JAVAFX_ZIP_DIR
101 @$(ECHO) " --with-javafx-zip-dir=$(call UnixPath,$(ALT_JAVAFX_ZIP_DIR)) " >> $@.tmp
102 endif
103 ifdef ALT_WIXDIR
104 @$(ECHO) " --with-wix=$(call UnixPath,$(ALT_WIXDIR)) " >> $@.tmp
105 endif
106 ifdef ALT_CCSS_SIGNING_DIR
107 @$(ECHO) " --with-ccss-signing=$(call UnixPath,$(ALT_CCSS_SIGNING_DIR)) " >> $@.tmp
108 endif
109 ifdef ALT_SLASH_JAVA
110 @$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp
111 endif
112 @if [ -f $@ ] ; then \
113 if ! $(CMP) $@ $@.tmp > /dev/null ; then \
114 $(CP) $@.tmp $@ ; \
115 fi ; \
116 else \
117 $(CP) $@.tmp $@ ; \
118 fi
119 $(RM) $@.tmp
121 PHONY_LIST += bridge2configure bridgeBuild
123 ###########################################################################
124 # JPRT targets
126 ifndef JPRT_ARCHIVE_BUNDLE
127 JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
128 endif
130 # These targets execute in a SPEC free context, before calling bridgeBuild
131 # to generate the SPEC.
132 jprt_build_product: DEBUG_LEVEL=release
133 jprt_build_product: BUILD_DIRNAME=*-release
134 jprt_build_product: jprt_build_generic
136 jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
137 jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
138 jprt_build_fastdebug: jprt_build_generic
140 jprt_build_debug: DEBUG_LEVEL=slowdebug
141 jprt_build_debug: BUILD_DIRNAME=*-debug
142 jprt_build_debug: jprt_build_generic
144 jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle
145 jprt_build_generic: bridgeBuild
147 # This target must be called in the context of a SPEC file
148 jprt_bundle: $(JPRT_ARCHIVE_BUNDLE)
149 @$(call CheckIfMakeAtEnd)
151 # This target must be called in the context of a SPEC file
152 $(JPRT_ARCHIVE_BUNDLE): bundles
153 $(MKDIR) -p $(@D)
154 $(RM) $@
155 $(CP) $(BUILD_OUTPUT)/bundles/j2sdk-image.zip $@
157 # This target must be called in the context of a SPEC file
158 bundles: all
159 @$(call TargetEnter)
160 $(MKDIR) -p $(BUILD_OUTPUT)/bundles
161 $(CD) $(IMAGES_OUTPUTDIR)/j2sdk-image && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2sdk-image.zip .
162 $(CD) $(IMAGES_OUTPUTDIR)/j2re-image && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2re-image.zip .
163 @$(call TargetExit)
165 # Keep track of phony targets
166 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
167 jprt_build_generic bundles jprt_bundle
169 ###########################################################################
170 # Phony targets
171 .PHONY: $(PHONY_LIST)
173 # Force target
174 FRC: