common/makefiles/Jprt.gmk

changeset 559
ef6adbf511cc
child 564
befbad2e4d87
equal deleted inserted replaced
558:d5f3a6f60d51 559:ef6adbf511cc
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 #
25
26 # This file is included by the root NewerMakefile and contains targets
27 # and utilities needed by JPRT.
28
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
42
43 BUILD_DIR_ROOT:=$(root_dir)/build
44
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.
48
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)
54
55 # Bridge from old Makefile ALT settings to configure options
56 bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
57 bash ./configure $(strip $(shell $(CAT) $<))
58
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) $< $@
63
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_SLASH_JAVA
101 @$(ECHO) " --with-java-devtools=$(call UnixPath,$(ALT_SLASH_JAVA)/devtools) " >> $@.tmp
102 endif
103 @if [ -f $@ ] ; then \
104 if ! $(CMP) $@ $@.tmp > /dev/null ; then \
105 $(CP) $@.tmp $@ ; \
106 fi ; \
107 else \
108 $(CP) $@.tmp $@ ; \
109 fi
110 $(RM) $@.tmp
111
112 PHONY_LIST += bridge2configure bridgeBuild
113
114 ###########################################################################
115 # JPRT targets
116
117 ifndef JPRT_ARCHIVE_BUNDLE
118 JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
119 endif
120
121 # These targets execute in a SPEC free context, before calling bridgeBuild
122 # to generate the SPEC.
123 jprt_build_product: DEBUG_LEVEL=release
124 jprt_build_product: BUILD_DIRNAME=*-release
125 jprt_build_product: jprt_build_generic
126
127 jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
128 jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
129 jprt_build_fastdebug: jprt_build_generic
130
131 jprt_build_debug: DEBUG_LEVEL=slowdebug
132 jprt_build_debug: BUILD_DIRNAME=*-debug
133 jprt_build_debug: jprt_build_generic
134
135 jprt_build_generic: BRIDGE_TARGETS+=jprt_bundle
136 jprt_build_generic: bridgeBuild
137
138 # This target must be called in the context of a SPEC file
139 jprt_bundle: $(JPRT_ARCHIVE_BUNDLE)
140 @$(call CheckIfMakeAtEnd)
141
142 # This target must be called in the context of a SPEC file
143 $(JPRT_ARCHIVE_BUNDLE): bundles
144 $(MKDIR) -p $(@D)
145 $(RM) $@
146 $(CP) $(BUILD_OUTPUT)/bundles/j2sdk-image.zip $@
147
148 # This target must be called in the context of a SPEC file
149 bundles: all
150 @$(call TargetEnter)
151 $(MKDIR) -p $(BUILD_OUTPUT)/bundles
152 $(CD) $(IMAGES_OUTPUTDIR)/j2sdk-image && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2sdk-image.zip .
153 $(CD) $(IMAGES_OUTPUTDIR)/j2re-image && $(ZIP) -q -r $(BUILD_OUTPUT)/bundles/j2re-image.zip .
154 @$(call TargetExit)
155
156 # Keep track of phony targets
157 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
158 jprt_build_generic bundles jprt_bundle
159
160 ###########################################################################
161 # Phony targets
162 .PHONY: $(PHONY_LIST)
163
164 # Force target
165 FRC:

mercurial