author | chegar |
Mon, 12 Jul 2010 18:13:40 +0100 | |
changeset 6002 | 4df5b9bcf842 |
parent 5506 | 202f599c92aa |
child 7666 | 7b994e3dd41d |
permissions | -rw-r--r-- |
2 | 1 |
# |
5506 | 2 |
# Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
# published by the Free Software Foundation. Oracle designates this |
2 | 8 |
# particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
# by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
# |
|
5506 | 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. |
|
2 | 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 |
# Make sure the default rule is all |
|
54 |
program_default_rule: all |
|
55 |
||
56 |
program: $(ACTUAL_PROGRAM) |
|
57 |
||
58 |
include $(JDK_TOPDIR)/make/common/Rules.gmk |
|
59 |
||
60 |
ifdef NEVER_ACT_AS_SERVER_CLASS_MACHINE |
|
61 |
OTHER_CPPFLAGS += -DNEVER_ACT_AS_SERVER_CLASS_MACHINE |
|
62 |
endif |
|
63 |
||
64 |
# |
|
65 |
# Create a dependency on libjli (Java Launcher Infrastructure) |
|
66 |
# |
|
67 |
# On UNIX, this is a relative dependency using $ORIGIN. Unfortunately, to |
|
68 |
# do this reliably on Linux takes a different syntax than Solaris. |
|
69 |
# |
|
70 |
# On Windows, this is done by using the same directory as the executable |
|
71 |
# itself, as with all the Windows libraries. |
|
72 |
# |
|
73 |
ifneq (,$(findstring $(PLATFORM), linux solaris)) # UNIX systems |
|
74 |
LDFLAGS += -L $(LIBDIR)/$(LIBARCH)/jli |
|
75 |
OTHER_LDLIBS += -ljli |
|
76 |
ifeq ($(PLATFORM), solaris) |
|
77 |
ifeq ($(ARCH_DATA_MODEL), 32) |
|
78 |
LDFLAGS += -R \$$ORIGIN/../lib/$(LIBARCH)/jli |
|
79 |
LDFLAGS += -R \$$ORIGIN/../jre/lib/$(LIBARCH)/jli |
|
80 |
else |
|
81 |
LDFLAGS += -R \$$ORIGIN/../../lib/$(LIBARCH)/jli |
|
82 |
LDFLAGS += -R \$$ORIGIN/../../jre/lib/$(LIBARCH)/jli |
|
83 |
endif |
|
84 |
endif |
|
85 |
ifeq ($(PLATFORM), linux) |
|
4111
ffc9c33335f4
6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
3111
diff
changeset
|
86 |
LDFLAGS += -Wl,-z -Wl,origin |
2 | 87 |
LDFLAGS += -Wl,--allow-shlib-undefined |
88 |
LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../lib/$(LIBARCH)/jli |
|
89 |
LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../jre/lib/$(LIBARCH)/jli |
|
90 |
endif |
|
91 |
endif |
|
92 |
ifeq ($(PLATFORM), windows) |
|
93 |
JLI_LCF = $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/jli.lcf |
|
94 |
ifdef STATIC_JLI |
|
95 |
LDFLAGS += -libpath:$(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static |
|
96 |
else |
|
97 |
LDFLAGS += -libpath:$(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME) |
|
98 |
endif |
|
99 |
OTHER_LDLIBS += jli.lib |
|
100 |
endif |
|
101 |
||
102 |
# |
|
103 |
# Launcher specific files. |
|
104 |
# |
|
105 |
FILES_o = \ |
|
106 |
$(OBJDIR)/main.$(OBJECT_SUFFIX) |
|
107 |
||
108 |
# We either need to import (copy) binaries in, or build them |
|
109 |
ifneq ($(IMPORT_NATIVE_BINARIES),true) |
|
110 |
COMPILE_IT=true |
|
111 |
else |
|
112 |
COMPILE_IT=false |
|
113 |
endif |
|
114 |
||
115 |
ifeq ($(COMPILE_IT),true) |
|
116 |
||
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4116
diff
changeset
|
117 |
$(ACTUAL_PROGRAM):: classes $(INIT) |
2 | 118 |
|
119 |
# |
|
120 |
# Windows only |
|
121 |
# |
|
122 |
ifeq ($(PLATFORM), windows) |
|
123 |
||
3111
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
124 |
# JDK name required here |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
125 |
RC_FLAGS += /D "JDK_FNAME=$(PROGRAM)$(EXE_SUFFIX)" \ |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
126 |
/D "JDK_INTERNAL_NAME=$(PROGRAM)" \ |
fefdeafb7ab9
6797688: Umbrella: Merge all JDK 6u4 - 6u12 deployment code into JDK7
herrick
parents:
1776
diff
changeset
|
127 |
/D "JDK_FTYPE=0x1L" |
2 | 128 |
|
129 |
$(OBJDIR)/$(PROGRAM).res: $(VERSIONINFO_RESOURCE) |
|
130 |
@$(prep-target) |
|
131 |
ifndef LOCAL_RESOURCE_FILE |
|
132 |
$(RC) $(RC_FLAGS) $(CC_OBJECT_OUTPUT_FLAG)$(@) $(VERSIONINFO_RESOURCE) |
|
133 |
endif |
|
134 |
||
135 |
$(OBJDIR)/$(PROGRAM).lcf: $(OBJDIR)/$(PROGRAM).res $(FILES_o) |
|
136 |
@$(prep-target) |
|
137 |
@$(ECHO) $(FILES_o) > $@ |
|
138 |
ifndef LOCAL_RESOURCE_FILE |
|
139 |
@$(ECHO) $(OBJDIR)/$(PROGRAM).res >> $@ |
|
140 |
endif |
|
141 |
@$(ECHO) setargv.obj >> $@ |
|
142 |
@$(ECHO) Created $@ |
|
143 |
||
144 |
$(ACTUAL_PROGRAM):: $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX) |
|
145 |
@$(install-file) |
|
146 |
||
147 |
ifeq ($(ARCH_DATA_MODEL), 32) |
|
148 |
STACK_SIZE=327680 |
|
149 |
else |
|
150 |
# We need more Stack for Windows 64bit |
|
151 |
STACK_SIZE=1048576 |
|
152 |
endif |
|
153 |
||
1776
33e9405ab91b
6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents:
2
diff
changeset
|
154 |
# In VS2005 or VS2008 the link command creates a .manifest file that we want |
33e9405ab91b
6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents:
2
diff
changeset
|
155 |
# to insert into the linked artifact so we do not need to track it separately. |
33e9405ab91b
6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents:
2
diff
changeset
|
156 |
# Use ";#2" for .dll and ";#1" for .exe in the MT command below: |
2 | 157 |
$(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF) |
158 |
@$(prep-target) |
|
159 |
@set -- $?; \ |
|
160 |
$(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...}; |
|
161 |
$(LINK) -out:$@ /STACK:$(STACK_SIZE) \ |
|
162 |
-map:$(OBJDIR)/$(PROGRAM).map $(LFLAGS) $(LDFLAGS) \ |
|
163 |
@$(OBJDIR)/$(PROGRAM).lcf $(LDLIBS) |
|
1776
33e9405ab91b
6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents:
2
diff
changeset
|
164 |
ifdef MT |
33e9405ab91b
6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents:
2
diff
changeset
|
165 |
$(MT) /manifest $(OBJDIR)/$(PROGRAM).exe.manifest /outputresource:$@;#1 |
33e9405ab91b
6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll
tbell
parents:
2
diff
changeset
|
166 |
endif |
2 | 167 |
|
168 |
else # PLATFORM |
|
169 |
||
170 |
# |
|
171 |
# Note that we have to link -lthread even when USE_PTHREADS is true. |
|
172 |
# This is becuase checkForCorrectLibthread() croaks otherwise. |
|
173 |
# |
|
174 |
LIBTHREAD = -lthread |
|
175 |
ifeq ($(USE_PTHREADS),true) |
|
176 |
THREADLIBS = -lpthread $(LIBTHREAD) |
|
177 |
else # USE_PTHREADS |
|
178 |
THREADLIBS = $(LIBTHREAD) |
|
179 |
endif # USE_PTHREADS |
|
180 |
||
181 |
# |
|
182 |
# This rule only applies on unix. It supports quantify and its ilk. |
|
183 |
# |
|
184 |
$(ACTUAL_PROGRAM):: $(FILES_o) |
|
185 |
@$(prep-target) |
|
186 |
@set -- $?; \ |
|
187 |
$(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...}; |
|
188 |
@$(MKDIR) -p $(TEMPDIR) |
|
189 |
$(LINK_PRE_CMD) $(CC) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \ |
|
190 |
$(FILES_o) $(THREADLIBS) $(LDLIBS) |
|
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4116
diff
changeset
|
191 |
$(install-module-file) |
2 | 192 |
|
193 |
endif # PLATFORM |
|
194 |
||
195 |
else # COMPILE_IT |
|
196 |
||
4665
d14dc3d9e1fa
6911737: Module build: generate modules with native libraries and any other files not in jar
mchung
parents:
4116
diff
changeset
|
197 |
$(ACTUAL_PROGRAM):: |
2 | 198 |
|
199 |
# Copies in the file from the JDK_IMPORT_PATH area |
|
200 |
$(ACTUAL_PROGRAM_DIR)/%: $(JDK_IMPORT_PATH)/jre/bin/% |
|
201 |
@$(install-import-file) |
|
202 |
$(ACTUAL_PROGRAM_DIR)/%: $(JDK_IMPORT_PATH)/bin/% |
|
203 |
@$(install-import-file) |
|
204 |
||
205 |
endif # COMPILE_IT |
|
206 |
||
207 |
||
208 |
clean:: |
|
209 |
ifeq ($(PLATFORM), windows) |
|
210 |
$(RM) $(OBJDIR)/$(PROGRAM).rc |
|
211 |
$(RM) $(OBJDIR)/$(PROGRAM).ico |
|
212 |
$(RM) $(OBJDIR)/$(PROGRAM).lcf |
|
213 |
$(RM) $(OBJDIR)/$(PROGRAM).map |
|
214 |
$(RM) $(OBJDIR)/$(PROGRAM).exp |
|
215 |
$(RM) $(OBJDIR)/$(PROGRAM).lib |
|
216 |
$(RM) $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX) |
|
217 |
$(RM) $(OBJDIR)/$(PROGRAM).ilk |
|
218 |
$(RM) *.pdb |
|
219 |
endif |
|
220 |
||
221 |
||
222 |
clobber:: |
|
223 |
$(RM) $(ACTUAL_PROGRAM) |
|
224 |
||
225 |
# |
|
226 |
# Now include make dependencies (created during compilation, see Rules.gmk) |
|
227 |
# |
|
228 |
ifeq ($(INCREMENTAL_BUILD),true) |
|
229 |
# Workaround: gnumake sometimes says files is empty when it shouldn't |
|
230 |
# was: files := $(foreach file, $(wildcard */$(ARCH)/*.$(DEPEND_SUFFIX)), $(file)) |
|
231 |
files := $(shell $(LS) $(OBJDIR)/*.$(DEPEND_SUFFIX) 2>/dev/null) |
|
232 |
ifneq ($(strip $(files)),) |
|
233 |
include $(files) |
|
234 |
endif # files |
|
235 |
endif # INCREMENTAL_BUILD |
|
236 |
||
237 |
ifdef JAVA_ARGS |
|
4116
54b55d640d9a
6888709: Change use of -DX=\""Y\"" to -DX='"Y"', consistently for all platforms
ohair
parents:
4111
diff
changeset
|
238 |
OTHER_CPPFLAGS += -DJAVA_ARGS='$(JAVA_ARGS)' |
54b55d640d9a
6888709: Change use of -DX=\""Y\"" to -DX='"Y"', consistently for all platforms
ohair
parents:
4111
diff
changeset
|
239 |
OTHER_CPPFLAGS += -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' |
2 | 240 |
endif |
241 |
||
242 |
ifeq ($(PLATFORM), windows) |
|
243 |
ifdef RELEASE |
|
4116
54b55d640d9a
6888709: Change use of -DX=\""Y\"" to -DX='"Y"', consistently for all platforms
ohair
parents:
4111
diff
changeset
|
244 |
OTHER_CPPFLAGS += -DVERSION='"$(RELEASE)"' |
2 | 245 |
endif |
246 |
endif |
|
247 |
||
248 |
||
249 |
ifneq ($(PLATFORM), windows) |
|
250 |
HAVE_GETHRTIME=true |
|
251 |
endif |
|
252 |
||
253 |
ifeq ($(HAVE_GETHRTIME),true) |
|
254 |
OTHER_CPPFLAGS += -DHAVE_GETHRTIME |
|
255 |
endif |
|
256 |
||
257 |
OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)/bin -I$(LAUNCHER_PLATFORM_SRC)/bin |
|
258 |
OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3 |
|
259 |
||
260 |
OTHER_CPPFLAGS += -DPROGNAME='"$(PROGRAM)"' |
|
261 |
VERSION_DEFINES += -DFULL_VERSION='"$(FULL_VERSION)"' |
|
262 |
||
263 |
VERSION_DEFINES += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \ |
|
264 |
-DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' |
|
265 |
||
266 |
||
267 |
||
268 |
$(OBJDIR)/main.$(OBJECT_SUFFIX): $(LAUNCHER_SHARE_SRC)/bin/main.c |
|
269 |
@$(prep-target) |
|
270 |
$(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$(OBJDIR)/main.$(OBJECT_SUFFIX) \ |
|
271 |
$(VERSION_DEFINES) $< |
|
272 |
||
273 |
# |
|
274 |
# Default dependencies |
|
275 |
# |
|
276 |
||
277 |
all: build |
|
278 |
||
279 |
build: program |
|
280 |
||
281 |
debug: |
|
282 |
$(MAKE) VARIANT=DBG build |
|
283 |
||
284 |
fastdebug: |
|
285 |
$(MAKE) VARIANT=DBG FASTDEBUG=true build |
|
286 |
||
287 |
.PHONY: all build program clean clobber debug fastdebug |