source: trunk/openjdk/jdk/make/common/Program.gmk

Last change on this file was 448, checked in by dmik, 9 years ago

Remove SYM file generation on OS/2.

This doesn't make any practical sense as there is embedded HLL debug
info which is much more verbose than SYM and doesn't require separate
files (it is generated when -g option is passed to gcc).

This commint also removes the dependency on mapsym.exe and wmapsym.cmd.

File size: 8.4 KB
Line 
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#
37ifeq ($(COMPILE_APPROACH),batch)
38 override COMPILE_APPROACH = normal
39endif
40
41ifndef LAUNCHER_PLATFORM_SRC
42LAUNCHER_PLATFORM_SRC = $(PLATFORM_SRC)
43endif
44
45ifndef LAUNCHER_SHARE_SRC
46LAUNCHER_SHARE_SRC = $(SHARE_SRC)
47endif
48
49ACTUAL_PROGRAM_NAME = $(PROGRAM)$(EXE_SUFFIX)
50ACTUAL_PROGRAM_DIR = $(BINDIR)
51ACTUAL_PROGRAM = $(ACTUAL_PROGRAM_DIR)/$(ACTUAL_PROGRAM_NAME)
52
53JVMCFG = $(LIBDIR)/$(LIBARCH)/jvm.cfg
54
55# Make sure the default rule is all
56program_default_rule: all
57
58program: $(ACTUAL_PROGRAM)
59
60include $(JDK_TOPDIR)/make/common/Rules.gmk
61
62ifdef NEVER_ACT_AS_SERVER_CLASS_MACHINE
63SERVERCLASS=-DNEVER_ACT_AS_SERVER_CLASS_MACHINE
64endif
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#
75ifneq (,$(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
93endif
94ifeq ($(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
101endif
102ifeq ($(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
109endif
110
111#
112# Launcher specific files.
113#
114FILES_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#
124ifeq ($(PLATFORM), windows)
125
126# J2SE name required here
127RC_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)
133ifndef LOCAL_RESOURCE_FILE
134 $(RC) $(RC_FLAGS) $(CC_OBJECT_OUTPUT_FLAG)$(@) $(VERSIONINFO_RESOURCE)
135endif
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
149ifeq ($(ARCH_DATA_MODEL), 32)
150 STACK_SIZE=327680
151else
152# We need more Stack for Windows 64bit
153 STACK_SIZE=1048576
154endif
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
164else # PLATFORM == windows
165
166ifeq ($(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
174else # 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#
180LIBTHREAD = -lthread
181ifeq ($(USE_PTHREADS),true)
182 THREADLIBS = -lpthread $(LIBTHREAD)
183else # USE_PTHREADS
184 THREADLIBS = $(LIBTHREAD)
185endif # 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
198endif # PLATFORM == os2
199
200endif # PLATFORM == windows
201
202clean::
203ifeq ($(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
213endif
214ifeq ($(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)
220endif
221
222
223clobber::
224 $(RM) $(ACTUAL_PROGRAM)
225
226#
227# Now include make dependencies (created during compilation, see Rules.gmk)
228#
229ifeq ($(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))
232files := $(shell $(LS) $(OBJDIR)/*.$(DEPEND_SUFFIX) 2>/dev/null)
233ifneq ($(strip $(files)),)
234include $(files)
235endif # files
236endif # INCREMENTAL_BUILD
237
238ifdef JAVA_ARGS
239OTHER_CPPFLAGS += -DJAVA_ARGS='$(JAVA_ARGS)'
240OTHER_CPPFLAGS += -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"'
241endif
242
243ifeq ($(filter-out windows os2, $(PLATFORM)),)
244ifdef RELEASE
245OTHER_CPPFLAGS += -DVERSION='"$(RELEASE)"'
246endif
247endif
248
249
250ifneq ($(filter-out windows os2, $(PLATFORM)),)
251HAVE_GETHRTIME=true
252endif
253
254ifeq ($(HAVE_GETHRTIME),true)
255OTHER_CPPFLAGS += -DHAVE_GETHRTIME
256endif
257
258OTHER_INCLUDES += -I$(LAUNCHER_SHARE_SRC)/bin -I$(LAUNCHER_PLATFORM_SRC)/bin
259OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3
260
261OTHER_CPPFLAGS += -DPROGNAME='"$(PROGRAM)"'
262VERSION_DEFINES += -DFULL_VERSION='"$(FULL_VERSION)"'
263
264VERSION_DEFINES += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
265 -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"'
266
267# Names of arch directories
268LIBARCH_DEFINES = -DLIBARCHNAME='"$(LIBARCH)"'
269ifeq ($(PLATFORM), solaris)
270 LIBARCH_DEFINES += -DLIBARCH32NAME='"$(LIBARCH32)"'
271 LIBARCH_DEFINES += -DLIBARCH64NAME='"$(LIBARCH64)"'
272endif
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#
290ifeq ($(ZERO_BUILD), true)
291JVMCFG_ARCH = zero
292else
293JVMCFG_ARCH = $(ARCH)
294endif
295
296$(JVMCFG): $(LAUNCHER_PLATFORM_SRC)/bin/$(JVMCFG_ARCH)/jvm.cfg
297 $(install-file)
298
299#
300# Default dependencies
301#
302
303all: build
304
305build: program
306
307debug:
308 $(MAKE) VARIANT=DBG build
309
310fastdebug:
311 $(MAKE) VARIANT=DBG FASTDEBUG=true build
312
313.PHONY: all build program clean clobber debug fastdebug
Note: See TracBrowser for help on using the repository browser.