Makefile revision 193:0f60cf26c5b5
1#
2# Copyright (c) 2007, 2009, 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# Makefile for building the corba workspace.
28#
29
30BUILDDIR=.
31include $(BUILDDIR)/common/Defs.gmk
32include $(BUILDDIR)/common/CancelImplicits.gmk
33
34#----- commands
35
36CHMOD = chmod
37CP = cp
38ECHO = echo # FIXME
39FIND = find
40MKDIR = mkdir
41SED = sed
42ZIP = zip
43
44#-----  locations and deliverables
45
46TOPDIR=..
47SRC_BIN_DIR = $(TOPDIR)/src/share/bin
48SRC_CLASSES_DIR = $(TOPDIR)/src/share/classes
49
50ifdef ALT_OUTPUTDIR
51  OUTPUTDIR = $(ALT_OUTPUTDIR)
52  BUILD_DIR = $(ALT_OUTPUTDIR)
53  DIST_DIR = $(ALT_OUTPUTDIR)/dist
54else
55  OUTPUTDIR = ..
56  BUILD_DIR = $(TOPDIR)/build/$(PLATFORM)-$(ARCH)
57  DIST_DIR = $(TOPDIR)/dist
58endif
59ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
60
61CLASSES_DIR = $(BUILD_DIR)/classes
62GENSRC_DIR = $(BUILD_DIR)/gensrc
63
64LIB_DIR = $(DIST_DIR)/lib
65
66#-----
67
68ifndef JDK_MAJOR_VERSION
69  JDK_MAJOR_VERSION = 1
70endif
71
72ifndef JDK_MINOR_VERSION
73  JDK_MINOR_VERSION = 7
74endif
75
76ifndef JDK_MICRO_VERSION
77  JDK_MICRO_VERSION = 0
78endif
79
80ifndef JDK_VERSION
81  JDK_VERSION = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
82endif
83
84ifndef MILESTONE
85  MILESTONE = internal
86endif
87
88# RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set
89ifneq ($(MILESTONE),fcs)
90  RELEASE       = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE)
91else
92  RELEASE       = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE)
93endif
94
95# FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set
96ifdef BUILD_NUMBER
97  FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER)
98else
99  BUILD_NUMBER = b00
100  USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`)
101  FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER)
102endif
103
104#----- useful macros
105
106SOURCE_LEVEL = 5
107BOOTSTRAP_TARGET_LEVEL = 5
108
109ifdef TARGET_CLASS_VERSION
110    TARGET_LEVEL = $(TARGET_CLASS_VERSION)
111else
112    TARGET_LEVEL = 7
113endif
114
115ifndef TARGET_JAVA
116  TARGET_JAVA = java
117endif
118
119SELF = $(lastword $(MAKEFILE_LIST))
120
121# for jdk, we generate the following:
122# dist/lib/classes.jar:
123#       corba recompiled to run on the target JDK,
124#       ready for inclusion in rt.jar
125# dist/lib/src.zip
126#       .properties and .java files for classes in classes.jar,
127#       ready for jdk src.zip
128# dist/lib/bin.zip
129#       corba specific binaries: orb.idl, ir.idl
130
131# Default target
132default: all
133
134#----- classes.jar
135
136CLASSES_JAR = $(LIB_DIR)/classes.jar
137$(CLASSES_JAR):
138	$(MKDIR) -p $(@D)
139	$(BOOT_JAR_CMD) -cf $@ -C $(CLASSES_DIR) .
140
141#----- src.zip
142
143SRC_ZIP_FILES = $(shell $(FIND) $(SRC_CLASSES_DIR) \( -name \*-template \) -prune -o -type f -print )
144
145SRC_ZIP = $(LIB_DIR)/src.zip
146$(SRC_ZIP): $(SRC_ZIP_FILES)
147	abs_src_zip=`cd $(@D) ; pwd`/$(@F) ; \
148	( cd $(SRC_CLASSES_DIR) ; $(FIND) . \( -name \*-template \) -prune -o -type f -print | $(ZIP) -q $$abs_src_zip -@ ) ; \
149	( cd $(GENSRC_DIR) ; $(FIND) . -type f -print | $(ZIP) -q $$abs_src_zip -@ ) ;
150
151#----- bin.zip
152
153BIN_ZIP_FILES = $(BUILD_DIR/lib/orb.idl $(BUILD_DIR)/lib/ir.idl
154
155BIN_ZIP = $(LIB_DIR)/bin.zip
156$(BIN_ZIP): $(BIN_ZIP_FILES)
157	abs_bin_zip=`cd $(@D) ; pwd`/$(@F) ; \
158	( cd $(BUILD_DIR) ; $(FIND) lib -name "*.idl" -print | $(ZIP) -q $$abs_bin_zip -@ ) ;
159
160#
161# CORBA
162#
163SUBDIRS = tools javax org sun com
164
165build:
166	$(SUBDIRS-loop)
167
168all : build $(CLASSES_JAR) $(SRC_ZIP) $(BIN_ZIP)
169
170clean clobber:
171	$(RM) -r $(BUILD_DIR)
172	$(RM) -r $(DIST_DIR)
173
174#-------------------------------------------------------------------
175#
176# Targets for Sun's internal JPRT build system
177
178CD = cd
179ZIP = zip
180
181JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip
182
183jprt_build_product jprt_build_debug jprt_build_fastdebug: all
184	( $(CD) $(OUTPUTDIR) && \
185	  $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist )
186
187#-------------------------------------------------------------------
188
189
190#
191# Phonies to avoid accidents.
192#
193.PHONY: all build clean clobber debug jprt_build_product jprt_build_debug jprt_build_fastdebug
194