1 | #
|
---|
2 | # Copyright (c) 1995, 2010, 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 | #
|
---|
27 | # Generic makefile for building executables.
|
---|
28 | #
|
---|
29 |
|
---|
30 | # WARNING: This file is shared with other workspaces.
|
---|
31 | # So when it includes other files, it must use JDK_TOPDIR.
|
---|
32 | #
|
---|
33 |
|
---|
34 | #
|
---|
35 | # If building programs, use a normal compile approach
|
---|
36 | #
|
---|
37 | ifeq ($(COMPILE_APPROACH),batch)
|
---|
38 | override COMPILE_APPROACH = normal
|
---|
39 | endif
|
---|
40 |
|
---|
41 | ifndef LAUNCHER_PLATFORM_SRC
|
---|
42 | LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)
|
---|
43 | endif
|
---|
44 |
|
---|
45 | ifndef LAUNCHER_SHARE_SRC
|
---|
46 | LAUNCHER_SHARE_SRC = $(SHARE_SRC)
|
---|
47 | endif
|
---|
48 |
|
---|
49 | ACTUAL_PROGRAM_NAME = $(PROGRAM)$(EXE_SUFFIX)
|
---|
50 | ACTUAL_PROGRAM_DIR = $(BINDIR)
|
---|
51 | ACTUAL_PROGRAM = $(ACTUAL_PROGRAM_DIR)/$(ACTUAL_PROGRAM_NAME)
|
---|
52 |
|
---|
53 | JVMCFG = $(LIBDIR)/$(LIBARCH)/jvm.cfg
|
---|
54 |
|
---|
55 | # Make sure the default rule is all
|
---|
56 | program_default_rule: all
|
---|
57 |
|
---|
58 | program: $(ACTUAL_PROGRAM)
|
---|
59 |
|
---|
60 | include $(JDK_TOPDIR)/make/common/Rules.gmk
|
---|
61 |
|
---|
62 | ifdef NEVER_ACT_AS_SERVER_CLASS_MACHINE
|
---|
63 | SERVERCLASS=-DNEVER_ACT_AS_SERVER_CLASS_MACHINE
|
---|
64 | endif
|
---|
65 |
|
---|
66 | #
|
---|
67 | # Create a dependency on libjli (Java Launcher Infrastructure)
|
---|
68 | #
|
---|
69 | # On UNIX, this is a relative dependency using $ORIGIN. Unfortunately, to
|
---|
70 | # do this reliably on Linux takes a different syntax than Solaris.
|
---|
71 | #
|
---|
72 | # On Windows, this is done by using the same directory as the executable
|
---|
73 | # itself, as with all the Windows libraries.
|
---|
74 | #
|
---|
75 | ifneq (,$(findstring $(PLATFORM), linux solaris)) # UNIX systems
|
---|
76 | LDFLAGS += -L $(LIBDIR)/$(LIBARCH)/jli
|
---|
77 | OTHER_LDLIBS += -ljli
|
---|
78 | ifeq ($(PLATFORM), solaris)
|
---|
79 | ifeq ($(ARCH_DATA_MODEL), 32)
|
---|
80 | LDFLAGS += -R \$$ORIGIN/../lib/$(LIBARCH)/jli
|
---|
81 | LDFLAGS += -R \$$ORIGIN/../jre/lib/$(LIBARCH)/jli
|
---|
82 | else
|
---|
83 | LDFLAGS += -R \$$ORIGIN/../../lib/$(LIBARCH)/jli
|
---|
84 | LDFLAGS += -R \$$ORIGIN/../../jre/lib/$(LIBARCH)/jli
|
---|
85 | endif
|
---|
86 | endif
|
---|
87 | ifeq ($(PLATFORM), linux)
|
---|
88 | LDFLAGS += -Wl,-z -Wl,origin
|
---|
89 | LDFLAGS += -Wl,--allow-shlib-undefined
|
---|
90 | LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../lib/$(LIBARCH)/jli
|
---|
91 | LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../jre/lib/$(LIBARCH)/jli
|
---|
92 | endif
|
---|
93 | endif
|
---|
94 | ifeq ($(PLATFORM), windows)
|
---|
95 | ifdef STATIC_JLI
|
---|
96 | LDFLAGS += -libpath:$(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static
|
---|
97 | else
|
---|
98 | LDFLAGS += -libpath:$(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)
|
---|
99 | endif
|
---|
100 | OTHER_LDLIBS += jli.lib
|
---|
101 | endif
|
---|
102 | ifeq ($(PLATFORM), os2)
|
---|
103 | ifdef STATIC_JLI
|
---|
104 | LDFLAGS += -L$(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static
|
---|
105 | else
|
---|
106 | LDFLAGS += -L$(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)
|
---|
107 | endif
|
---|
108 | OTHER_LDLIBS += -ljli.lib
|
---|
109 | endif
|
---|
110 |
|
---|
111 | #
|
---|
112 | # Launcher specific files.
|
---|
113 | #
|
---|
114 | FILES_o = \
|
---|
115 | $(OBJDIR)/$(PROGRAM).$(OBJECT_SUFFIX) \
|
---|
116 | $(OBJDIR)/$(PROGRAM)_md.$(OBJECT_SUFFIX) \
|
---|
117 | $(OBJDIR)/splashscreen_stubs.$(OBJECT_SUFFIX)
|
---|
118 |
|
---|
119 | $(ACTUAL_PROGRAM):: classes $(JVMCFG) $(INIT)
|
---|
120 |
|
---|
121 | #
|
---|
122 | # Windows only
|
---|
123 | #
|
---|
124 | ifeq ($(PLATFORM), windows)
|
---|
125 |
|
---|
126 | # J2SE name required here
|
---|
127 | RC_FLAGS += /D "J2SE_FNAME=$(PROGRAM)$(EXE_SUFFIX)" \
|
---|
128 | /D "J2SE_INTERNAL_NAME=$(PROGRAM)" \
|
---|
129 | /D "J2SE_FTYPE=0x1L"
|
---|
130 |
|
---|
131 | $(OBJDIR)/$(PROGRAM).res: $(VERSIONINFO_RESOURCE)
|
---|
132 | @$(prep-target)
|
---|
133 | ifndef LOCAL_RESOURCE_FILE
|
---|
134 | $(RC) $(RC_FLAGS) $(CC_OBJECT_OUTPUT_FLAG)$(@) $(VERSIONINFO_RESOURCE)
|
---|
135 | endif
|
---|
136 |
|
---|
137 | $(OBJDIR)/$(PROGRAM).lcf: $(OBJDIR)/$(PROGRAM).res $(FILES_o)
|
---|
138 | @$(prep-target)
|
---|
139 | @$(ECHO) $(FILES_o) > $@
|
---|
140 | ifndef LOCAL_RESOURCE_FILE
|
---|
141 | @$(ECHO) $(OBJDIR)/$(PROGRAM).res >> $@
|
---|
142 | endif
|
---|
143 | @$(ECHO) setargv.obj >> $@
|
---|
144 | @$(ECHO) Created $@
|
---|
145 |
|
---|
146 | $(ACTUAL_PROGRAM):: $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX)
|
---|
147 | @$(install-file)
|
---|
148 |
|
---|
149 | ifeq ($(ARCH_DATA_MODEL), 32)
|
---|
150 | STACK_SIZE=327680
|
---|
151 | else
|
---|
152 | # We need more Stack for Windows 64bit
|
---|
153 | STACK_SIZE=1048576
|
---|
154 | endif
|
---|
155 |
|
---|
156 | $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o)
|
---|
157 | @$(prep-target)
|
---|
158 | @set -- $?; \
|
---|
159 | $(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...};
|
---|
160 | $(LINK) -out:$@ /STACK:$(STACK_SIZE) \
|
---|
161 | -map:$(OBJDIR)/$(PROGRAM).map $(LFLAGS) $(LDFLAGS) \
|
---|
162 | @$(OBJDIR)/$(PROGRAM).lcf $(LDLIBS)
|
---|
163 |
|
---|
164 | else # PLATFORM == windows
|
---|
165 |
|
---|
166 | ifeq ($(PLATFORM), os2)
|
---|
167 |
|
---|
168 | $(ACTUAL_PROGRAM):: $(FILES_o)
|
---|
169 | @$(prep-target)
|
---|
170 | @set -- $?; \
|
---|
171 | $(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...};
|
---|
172 | $(LINK) $(LDFLAGS) -Zstack 0x2000 -o $@ $(FILES_o) $(LDLIBS)
|
---|
173 |
|
---|
174 | else # PLATFORM == os2
|
---|
175 |
|
---|
176 | #
|
---|
177 | # Note that we have to link -lthread even when USE_PTHREADS is true.
|
---|
178 | # This is becuase checkForCorrectLibthread() croaks otherwise.
|
---|
179 | #
|
---|
180 | LIBTHREAD = -lthread
|
---|
181 | ifeq ($(USE_PTHREADS),true)
|
---|
182 | THREADLIBS = -lpthread $(LIBTHREAD)
|
---|
183 | else # USE_PTHREADS
|
---|
184 | THREADLIBS = $(LIBTHREAD)
|
---|
185 | endif # USE_PTHREADS
|
---|
186 |
|
---|
187 | #
|
---|
188 | # This rule only applies on unix. It supports quantify and its ilk.
|
---|
189 | #
|
---|
190 | $(ACTUAL_PROGRAM):: $(FILES_o)
|
---|
191 | @$(prep-target)
|
---|
192 | @set -- $?; \
|
---|
193 | $(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...};
|
---|
194 | @$(MKDIR) -p $(TEMPDIR)
|
---|
195 | $(LINK_PRE_CMD) $(CC) $(SERVERCLASS) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \
|
---|
196 | $(FILES_o) $(THREADLIBS) $(LDLIBS)
|
---|
197 |
|
---|
198 | endif # PLATFORM == os2
|
---|
199 |
|
---|
200 | endif # PLATFORM == windows
|
---|
201 |
|
---|
202 | clean::
|
---|
203 | ifeq ($(PLATFORM), windows)
|
---|
204 | $(RM) $(OBJDIR)/$(PROGRAM).rc
|
---|
205 | $(RM) $(OBJDIR)/$(PROGRAM).ico
|
---|
206 | $(RM) $(OBJDIR)/$(PROGRAM).lcf
|
---|
207 | $(RM) $(OBJDIR)/$(PROGRAM).map
|
---|
208 | $(RM) $(OBJDIR)/$(PROGRAM).exp
|
---|
209 | $(RM) $(OBJDIR)/$(PROGRAM).lib
|
---|
210 | $(RM) $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX)
|
---|
211 | $(RM) $(OBJDIR)/$(PROGRAM).ilk
|
---|
212 | $(RM) *.pdb
|
---|
213 | endif
|
---|
214 | ifeq ($(PLATFORM), os2)
|
---|
215 | $(RM) $(OBJDIR)/$(PROGRAM).rc
|
---|
216 | $(RM) $(OBJDIR)/$(PROGRAM).ico
|
---|
217 | $(RM) $(OBJDIR)/$(PROGRAM).map
|
---|
218 | $(RM) $(OBJDIR)/$(PROGRAM).lib
|
---|
219 | $(RM) $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX)
|
---|
220 | endif
|
---|
221 |
|
---|
222 |
|
---|
223 | clobber::
|
---|
224 | $(RM) $(ACTUAL_PROGRAM)
|
---|
225 |
|
---|
226 | #
|
---|
227 | # Now include make dependencies (created during compilation, see Rules.gmk)
|
---|
228 | #
|
---|
229 | ifeq ($(INCREMENTAL_BUILD),true)
|
---|
230 | # Workaround: gnumake sometimes says files is empty when it shouldn't
|
---|
231 | # was: files := $(foreach file, $(wildcard */$(ARCH)/*.$(DEPEND_SUFFIX)), $(file))
|
---|
232 | files := $(shell $(LS) $(OBJDIR)/*.$(DEPEND_SUFFIX) 2>/dev/null)
|
---|
233 | ifneq ($(strip $(files)),)
|
---|
234 | include $(files)
|
---|
235 | endif # files
|
---|
236 | endif # INCREMENTAL_BUILD
|
---|
237 |
|
---|
238 | ifdef JAVA_ARGS
|
---|
239 | OTHER_CPPFLAGS += -DJAVA_ARGS='$(JAVA_ARGS)'
|
---|
240 | OTHER_CPPFLAGS += -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"'
|
---|
241 | endif
|
---|
242 |
|
---|
243 | ifeq ($(filter-out windows os2, $(PLATFORM)),)
|
---|
244 | ifdef RELEASE
|
---|
245 | OTHER_CPPFLAGS += -DVERSION='"$(RELEASE)"'
|
---|
246 | endif
|
---|
247 | endif
|
---|
248 |
|
---|
249 |
|
---|
250 | ifneq ($(filter-out windows os2, $(PLATFORM)),)
|
---|
251 | HAVE_GETHRTIME=true
|
---|
252 | endif
|
---|
253 |
|
---|
254 | ifeq ($(HAVE_GETHRTIME),true)
|
---|
255 | OTHER_CPPFLAGS += -DHAVE_GETHRTIME
|
---|
256 | endif
|
---|
257 |
|
---|
258 | OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)/bin -I$(LAUNCHER_PLATFORM_SRC)/bin
|
---|
259 | OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3
|
---|
260 |
|
---|
261 | OTHER_CPPFLAGS += -DPROGNAME='"$(PROGRAM)"'
|
---|
262 | VERSION_DEFINES += -DFULL_VERSION='"$(FULL_VERSION)"'
|
---|
263 |
|
---|
264 | VERSION_DEFINES += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
|
---|
265 | -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"'
|
---|
266 |
|
---|
267 | # Names of arch directories
|
---|
268 | LIBARCH_DEFINES = -DLIBARCHNAME='"$(LIBARCH)"'
|
---|
269 | ifeq ($(PLATFORM), solaris)
|
---|
270 | LIBARCH_DEFINES += -DLIBARCH32NAME='"$(LIBARCH32)"'
|
---|
271 | LIBARCH_DEFINES += -DLIBARCH64NAME='"$(LIBARCH64)"'
|
---|
272 | endif
|
---|
273 |
|
---|
274 | $(OBJDIR)/$(PROGRAM).$(OBJECT_SUFFIX): $(LAUNCHER_SHARE_SRC)/bin/java.c
|
---|
275 | @$(prep-target)
|
---|
276 | $(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $(VERSION_DEFINES) $<
|
---|
277 |
|
---|
278 | $(OBJDIR)/$(PROGRAM)_md.$(OBJECT_SUFFIX): $(LAUNCHER_PLATFORM_SRC)/bin/java_md.c
|
---|
279 | @$(prep-target)
|
---|
280 | $(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LIBARCH_DEFINES) \
|
---|
281 | $(VERSION_DEFINES) $(SERVERCLASS) $<
|
---|
282 |
|
---|
283 | $(OBJDIR)/%.$(OBJECT_SUFFIX): $(LAUNCHER_SHARE_SRC)/bin/%.c
|
---|
284 | @$(prep-target)
|
---|
285 | $(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$@ $(VERSION_DEFINES) $<
|
---|
286 |
|
---|
287 | #
|
---|
288 | # How to install jvm.cfg.
|
---|
289 | #
|
---|
290 | ifeq ($(ZERO_BUILD), true)
|
---|
291 | JVMCFG_ARCH = zero
|
---|
292 | else
|
---|
293 | JVMCFG_ARCH = $(ARCH)
|
---|
294 | endif
|
---|
295 |
|
---|
296 | $(JVMCFG): $(LAUNCHER_PLATFORM_SRC)/bin/$(JVMCFG_ARCH)/jvm.cfg
|
---|
297 | $(install-file)
|
---|
298 |
|
---|
299 | #
|
---|
300 | # Default dependencies
|
---|
301 | #
|
---|
302 |
|
---|
303 | all: build
|
---|
304 |
|
---|
305 | build: program
|
---|
306 |
|
---|
307 | debug:
|
---|
308 | $(MAKE) VARIANT=DBG build
|
---|
309 |
|
---|
310 | fastdebug:
|
---|
311 | $(MAKE) VARIANT=DBG FASTDEBUG=true build
|
---|
312 |
|
---|
313 | .PHONY: all build program clean clobber debug fastdebug
|
---|