2
|
1 |
#
|
|
2 |
# Copyright 1995-2007 Sun Microsystems, Inc. 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. Sun designates this
|
|
8 |
# particular file as subject to the "Classpath" exception as provided
|
|
9 |
# by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
# CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
# have any 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 |
OTHER_CPPFLAGS += -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 += -z 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 |
JLI_LCF = $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/jli.lcf
|
|
96 |
ifdef STATIC_JLI
|
|
97 |
LDFLAGS += -libpath:$(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static
|
|
98 |
else
|
|
99 |
LDFLAGS += -libpath:$(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)
|
|
100 |
endif
|
|
101 |
OTHER_LDLIBS += jli.lib
|
|
102 |
endif
|
|
103 |
|
|
104 |
#
|
|
105 |
# Launcher specific files.
|
|
106 |
#
|
|
107 |
FILES_o = \
|
|
108 |
$(OBJDIR)/main.$(OBJECT_SUFFIX)
|
|
109 |
|
|
110 |
# We either need to import (copy) binaries in, or build them
|
|
111 |
ifneq ($(IMPORT_NATIVE_BINARIES),true)
|
|
112 |
COMPILE_IT=true
|
|
113 |
else
|
|
114 |
COMPILE_IT=false
|
|
115 |
endif
|
|
116 |
|
|
117 |
ifeq ($(COMPILE_IT),true)
|
|
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) $(JLI_LCF)
|
|
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
|
|
165 |
|
|
166 |
#
|
|
167 |
# Note that we have to link -lthread even when USE_PTHREADS is true.
|
|
168 |
# This is becuase checkForCorrectLibthread() croaks otherwise.
|
|
169 |
#
|
|
170 |
LIBTHREAD = -lthread
|
|
171 |
ifeq ($(USE_PTHREADS),true)
|
|
172 |
THREADLIBS = -lpthread $(LIBTHREAD)
|
|
173 |
else # USE_PTHREADS
|
|
174 |
THREADLIBS = $(LIBTHREAD)
|
|
175 |
endif # USE_PTHREADS
|
|
176 |
|
|
177 |
#
|
|
178 |
# This rule only applies on unix. It supports quantify and its ilk.
|
|
179 |
#
|
|
180 |
$(ACTUAL_PROGRAM):: $(FILES_o)
|
|
181 |
@$(prep-target)
|
|
182 |
@set -- $?; \
|
|
183 |
$(ECHO) Rebuilding $@ because of $$1 $$2 $$3 $$4 $$5 $$6 $${7:+...};
|
|
184 |
@$(MKDIR) -p $(TEMPDIR)
|
|
185 |
$(LINK_PRE_CMD) $(CC) $(CC_OBJECT_OUTPUT_FLAG)$@ $(LDFLAGS) \
|
|
186 |
$(FILES_o) $(THREADLIBS) $(LDLIBS)
|
|
187 |
|
|
188 |
endif # PLATFORM
|
|
189 |
|
|
190 |
else # COMPILE_IT
|
|
191 |
|
|
192 |
$(ACTUAL_PROGRAM):: $(JVMCFG)
|
|
193 |
|
|
194 |
# Copies in the file from the JDK_IMPORT_PATH area
|
|
195 |
$(ACTUAL_PROGRAM_DIR)/%: $(JDK_IMPORT_PATH)/jre/bin/%
|
|
196 |
@$(install-import-file)
|
|
197 |
$(ACTUAL_PROGRAM_DIR)/%: $(JDK_IMPORT_PATH)/bin/%
|
|
198 |
@$(install-import-file)
|
|
199 |
|
|
200 |
endif # COMPILE_IT
|
|
201 |
|
|
202 |
|
|
203 |
clean::
|
|
204 |
ifeq ($(PLATFORM), windows)
|
|
205 |
$(RM) $(OBJDIR)/$(PROGRAM).rc
|
|
206 |
$(RM) $(OBJDIR)/$(PROGRAM).ico
|
|
207 |
$(RM) $(OBJDIR)/$(PROGRAM).lcf
|
|
208 |
$(RM) $(OBJDIR)/$(PROGRAM).map
|
|
209 |
$(RM) $(OBJDIR)/$(PROGRAM).exp
|
|
210 |
$(RM) $(OBJDIR)/$(PROGRAM).lib
|
|
211 |
$(RM) $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX)
|
|
212 |
$(RM) $(OBJDIR)/$(PROGRAM).ilk
|
|
213 |
$(RM) *.pdb
|
|
214 |
endif
|
|
215 |
|
|
216 |
|
|
217 |
clobber::
|
|
218 |
$(RM) $(ACTUAL_PROGRAM)
|
|
219 |
|
|
220 |
#
|
|
221 |
# Now include make dependencies (created during compilation, see Rules.gmk)
|
|
222 |
#
|
|
223 |
ifeq ($(INCREMENTAL_BUILD),true)
|
|
224 |
# Workaround: gnumake sometimes says files is empty when it shouldn't
|
|
225 |
# was: files := $(foreach file, $(wildcard */$(ARCH)/*.$(DEPEND_SUFFIX)), $(file))
|
|
226 |
files := $(shell $(LS) $(OBJDIR)/*.$(DEPEND_SUFFIX) 2>/dev/null)
|
|
227 |
ifneq ($(strip $(files)),)
|
|
228 |
include $(files)
|
|
229 |
endif # files
|
|
230 |
endif # INCREMENTAL_BUILD
|
|
231 |
|
|
232 |
ifdef JAVA_ARGS
|
|
233 |
OTHER_CPPFLAGS += -DJAVA_ARGS=$(JAVA_ARGS)
|
|
234 |
OTHER_CPPFLAGS += -DLAUNCHER_NAME=\"$(LAUNCHER_NAME)\"
|
|
235 |
endif
|
|
236 |
|
|
237 |
ifeq ($(PLATFORM), windows)
|
|
238 |
ifdef RELEASE
|
|
239 |
OTHER_CPPFLAGS += -DVERSION="$(RELEASE)"
|
|
240 |
endif
|
|
241 |
endif
|
|
242 |
|
|
243 |
|
|
244 |
ifneq ($(PLATFORM), windows)
|
|
245 |
HAVE_GETHRTIME=true
|
|
246 |
endif
|
|
247 |
|
|
248 |
ifeq ($(HAVE_GETHRTIME),true)
|
|
249 |
OTHER_CPPFLAGS += -DHAVE_GETHRTIME
|
|
250 |
endif
|
|
251 |
|
|
252 |
OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)/bin -I$(LAUNCHER_PLATFORM_SRC)/bin
|
|
253 |
OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3
|
|
254 |
|
|
255 |
# this may not be necessary...
|
|
256 |
ifeq ($(PLATFORM), windows)
|
|
257 |
OTHER_CPPFLAGS += -DPROGNAME="\"$(PROGRAM)\""
|
|
258 |
VERSION_DEFINES += -DFULL_VERSION="\"$(FULL_VERSION)\""
|
|
259 |
else
|
|
260 |
OTHER_CPPFLAGS += -DPROGNAME='"$(PROGRAM)"'
|
|
261 |
VERSION_DEFINES += -DFULL_VERSION='"$(FULL_VERSION)"'
|
|
262 |
endif
|
|
263 |
|
|
264 |
VERSION_DEFINES += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
|
|
265 |
-DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"'
|
|
266 |
|
|
267 |
|
|
268 |
|
|
269 |
$(OBJDIR)/main.$(OBJECT_SUFFIX): $(LAUNCHER_SHARE_SRC)/bin/main.c
|
|
270 |
@$(prep-target)
|
|
271 |
$(COMPILE.c) $(CC_OBJECT_OUTPUT_FLAG)$(OBJDIR)/main.$(OBJECT_SUFFIX) \
|
|
272 |
$(VERSION_DEFINES) $<
|
|
273 |
|
|
274 |
#
|
|
275 |
# How to install jvm.cfg.
|
|
276 |
#
|
|
277 |
$(JVMCFG): $(LAUNCHER_PLATFORM_SRC)/bin/$(ARCH)/jvm.cfg
|
|
278 |
$(install-file)
|
|
279 |
|
|
280 |
#
|
|
281 |
# Default dependencies
|
|
282 |
#
|
|
283 |
|
|
284 |
all: build
|
|
285 |
|
|
286 |
build: program
|
|
287 |
|
|
288 |
debug:
|
|
289 |
$(MAKE) VARIANT=DBG build
|
|
290 |
|
|
291 |
fastdebug:
|
|
292 |
$(MAKE) VARIANT=DBG FASTDEBUG=true build
|
|
293 |
|
|
294 |
.PHONY: all build program clean clobber debug fastdebug
|