annotate make/Makefile @ 113:1c130e7b7a2e

6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building) Reviewed-by: jjg, iris
author ohair
date Wed, 02 Sep 2009 09:20:17 -0700
parents 5182bcc9c60c
children 91006f157c46
rev   line source
duke@0 1 #
xdono@97 2 # Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 #
duke@0 5 # This code is free software; you can redistribute it and/or modify it
duke@0 6 # under the terms of the GNU General Public License version 2 only, as
duke@0 7 # published by the Free Software Foundation. Sun designates this
duke@0 8 # particular file as subject to the "Classpath" exception as provided
duke@0 9 # by Sun in the LICENSE file that accompanied this code.
duke@0 10 #
duke@0 11 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 14 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 15 # accompanied this code).
duke@0 16 #
duke@0 17 # You should have received a copy of the GNU General Public License version
duke@0 18 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 20 #
duke@0 21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 22 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 23 # have any questions.
duke@0 24 #
duke@0 25
duke@0 26 #
duke@0 27 # Makefile for building the corba workspace.
duke@0 28 #
duke@0 29
duke@0 30 BUILDDIR=.
duke@0 31 include $(BUILDDIR)/common/Defs.gmk
duke@0 32 include $(BUILDDIR)/common/CancelImplicits.gmk
duke@0 33
duke@0 34 #----- commands
duke@0 35
duke@0 36 CHMOD = chmod
duke@0 37 CP = cp
duke@0 38 ECHO = echo # FIXME
duke@0 39 FIND = find
duke@0 40 MKDIR = mkdir
duke@0 41 SED = sed
duke@0 42 ZIP = zip
duke@0 43
duke@0 44 #----- locations and deliverables
duke@0 45
duke@0 46 TOPDIR=..
duke@0 47 SRC_BIN_DIR = $(TOPDIR)/src/share/bin
duke@0 48 SRC_CLASSES_DIR = $(TOPDIR)/src/share/classes
duke@0 49
duke@0 50 ifdef ALT_OUTPUTDIR
duke@0 51 OUTPUTDIR = $(ALT_OUTPUTDIR)
duke@0 52 BUILD_DIR = $(ALT_OUTPUTDIR)
duke@0 53 DIST_DIR = $(ALT_OUTPUTDIR)/dist
duke@0 54 else
duke@0 55 OUTPUTDIR = ..
duke@0 56 BUILD_DIR = $(TOPDIR)/build/$(PLATFORM)-$(ARCH)
duke@0 57 DIST_DIR = $(TOPDIR)/dist
duke@0 58 endif
duke@0 59 ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
duke@0 60
duke@0 61 CLASSES_DIR = $(BUILD_DIR)/classes
duke@0 62 GENSRC_DIR = $(BUILD_DIR)/gensrc
duke@0 63
duke@0 64 BIN_DIR = $(DIST_DIR)/bin
duke@0 65 LIB_DIR = $(DIST_DIR)/lib
duke@0 66
duke@0 67 #-----
duke@0 68
duke@0 69 ifndef JDK_MAJOR_VERSION
duke@0 70 JDK_MAJOR_VERSION = 1
duke@0 71 endif
duke@0 72
duke@0 73 ifndef JDK_MINOR_VERSION
duke@0 74 JDK_MINOR_VERSION = 7
duke@0 75 endif
duke@0 76
duke@0 77 ifndef JDK_MICRO_VERSION
duke@0 78 JDK_MICRO_VERSION = 0
duke@0 79 endif
duke@0 80
duke@0 81 ifndef JDK_VERSION
duke@0 82 JDK_VERSION = $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
duke@0 83 endif
duke@0 84
duke@0 85 ifndef MILESTONE
duke@0 86 MILESTONE = internal
duke@0 87 endif
duke@0 88
duke@0 89 # RELEASE is JDK_VERSION and -MILESTONE if MILESTONE is set
duke@0 90 ifneq ($(MILESTONE),fcs)
duke@0 91 RELEASE = $(JDK_VERSION)-$(MILESTONE)$(BUILD_VARIANT_RELEASE)
duke@0 92 else
duke@0 93 RELEASE = $(JDK_VERSION)$(BUILD_VARIANT_RELEASE)
duke@0 94 endif
duke@0 95
duke@0 96 # FULL_VERSION is RELEASE and -BUILD_NUMBER if BUILD_NUMBER is set
duke@0 97 ifdef BUILD_NUMBER
duke@0 98 FULL_VERSION = $(RELEASE)-$(BUILD_NUMBER)
duke@0 99 else
duke@0 100 BUILD_NUMBER = b00
duke@0 101 USER_RELEASE_SUFFIX := $(shell echo $(USER)_`date '+%d_%b_%Y_%H_%M' | tr "A-Z" "a-z"`)
duke@0 102 FULL_VERSION = $(RELEASE)-$(USER_RELEASE_SUFFIX)-$(BUILD_NUMBER)
duke@0 103 endif
duke@0 104
duke@0 105 #----- useful macros
duke@0 106
duke@0 107 SOURCE_LEVEL = 5
duke@0 108 BOOTSTRAP_TARGET_LEVEL = 5
jjg@82 109
jjg@82 110 ifdef TARGET_CLASS_VERSION
jjg@82 111 TARGET_LEVEL = $(TARGET_CLASS_VERSION)
jjg@82 112 else
jjg@99 113 TARGET_LEVEL = 7
jjg@82 114 endif
duke@0 115
duke@0 116 ifndef TARGET_JAVA
duke@0 117 TARGET_JAVA = java
duke@0 118 endif
duke@0 119
duke@0 120 SELF = $(lastword $(MAKEFILE_LIST))
duke@0 121
duke@0 122 # for jdk, we generate the following:
duke@0 123 # dist/lib/classes.jar:
duke@0 124 # corba recompiled to run on the target JDK,
duke@0 125 # ready for inclusion in rt.jar
duke@0 126 # dist/lib/src.zip
duke@0 127 # .properties and .java files for classes in classes.jar,
duke@0 128 # ready for jdk src.zip
duke@0 129 # dist/lib/bin.zip
duke@0 130 # corba specific binaries: orb.idl, ir.idl
duke@0 131
duke@0 132 # Default target
duke@0 133 default: all
duke@0 134
duke@0 135 #----- classes.jar
duke@0 136
duke@0 137 CLASSES_JAR = $(LIB_DIR)/classes.jar
duke@0 138 $(CLASSES_JAR):
duke@0 139 $(MKDIR) -p $(@D)
duke@0 140 $(BOOT_JAR_CMD) -cf $@ -C $(CLASSES_DIR) .
duke@0 141
duke@0 142 #----- src.zip
duke@0 143
ohair@113 144 SRC_ZIP_FILES = $(shell $(FIND) $(SRC_CLASSES_DIR) \( -name \*-template \) -prune -o -type f -print )
duke@0 145
duke@0 146 SRC_ZIP = $(LIB_DIR)/src.zip
duke@0 147 $(SRC_ZIP): $(SRC_ZIP_FILES)
duke@0 148 abs_src_zip=`cd $(@D) ; pwd`/$(@F) ; \
ohair@113 149 ( cd $(SRC_CLASSES_DIR) ; $(FIND) . \( -name \*-template \) -prune -o -type f -print | $(ZIP) -q $$abs_src_zip -@ ) ; \
duke@0 150 ( cd $(GENSRC_DIR) ; $(FIND) . -type f -print | $(ZIP) -q $$abs_src_zip -@ ) ;
duke@0 151
duke@0 152 #----- bin.zip
duke@0 153
duke@0 154 BIN_ZIP_FILES = $(BUILD_DIR/lib/orb.idl $(BUILD_DIR)/lib/ir.idl
duke@0 155
duke@0 156 BIN_ZIP = $(LIB_DIR)/bin.zip
duke@0 157 $(BIN_ZIP): $(BIN_ZIP_FILES)
duke@0 158 abs_bin_zip=`cd $(@D) ; pwd`/$(@F) ; \
duke@0 159 ( cd $(BUILD_DIR) ; $(FIND) lib -name "*.idl" -print | $(ZIP) -q $$abs_bin_zip -@ ) ;
duke@0 160
duke@0 161 #
duke@0 162 # CORBA
duke@0 163 #
duke@0 164 SUBDIRS = tools javax org sun com
duke@0 165
duke@0 166 build:
duke@0 167 $(SUBDIRS-loop)
duke@0 168
duke@0 169 all : build $(CLASSES_JAR) $(SRC_ZIP) $(BIN_ZIP)
duke@0 170
duke@0 171 clean clobber:
duke@0 172 $(RM) -r $(BUILD_DIR)
duke@0 173 $(RM) -r $(DIST_DIR)
duke@0 174
duke@0 175 #-------------------------------------------------------------------
duke@0 176 #
duke@0 177 # Targets for Sun's internal JPRT build system
duke@0 178
duke@0 179 CD = cd
duke@0 180 ZIP = zip
duke@0 181
duke@0 182 JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip
duke@0 183
duke@0 184 jprt_build_product jprt_build_debug jprt_build_fastdebug: all
duke@0 185 ( $(CD) $(OUTPUTDIR) && \
duke@0 186 $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist )
duke@0 187
duke@0 188 #-------------------------------------------------------------------
duke@0 189
duke@0 190
duke@0 191 #
duke@0 192 # Phonies to avoid accidents.
duke@0 193 #
duke@0 194 .PHONY: all build clean clobber debug jprt_build_product jprt_build_debug jprt_build_fastdebug