langtools/make/Makefile
author martin
Sun, 09 Mar 2008 21:56:42 -0700
changeset 40 18b856569127
parent 10 06bc494ca11e
child 1650 980a667baa29
permissions -rw-r--r--
4499288: (cs spec) Charset terminology problems Reviewed-by: mr, iris
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
#
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
# Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
#
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
# published by the Free Software Foundation.  Sun designates this
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
# by Sun in the LICENSE file that accompanied this code.
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
# have any questions.
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
# Makefile for langtools: wrapper around Ant build.xml file
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
# On Solaris, the 'make' utility from Sun will not work with these makefiles.
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
#    This little rule is only understood by Sun's make, and is harmless
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
#    when seen by the GNU make tool. If using Sun's make, this causes the
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
#    make command to fail.
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
# Minimal platform defs
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
# Need FullPath because we can't rely on gnumake abspath, until we use v3.81
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
SYSTEM_UNAME := $(shell uname)
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
ifeq ($(SYSTEM_UNAME), Windows_NT)
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
DEV_NULL = NUL
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
else
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
DEV_NULL = NUL
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
USING_CYGWIN = true
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
else
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
DEV_NULL = /dev/null
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
endif 
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
ifdef USING_CYGWIN
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
define FullPath
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
$(shell cygpath -a -s -m $1 2> $(DEV_NULL))
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
endef
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
else
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
define FullPath
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
$(shell cd $1 2> $(DEV_NULL) && pwd)
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
endef
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
# Makefile args
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
ifdef QUIET
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
  ANT_OPTIONS += -quiet
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
ifdef VERBOSE
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
  ANT_OPTIONS += -verbose -diagnostics
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
ifdef JDK_VERSION
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
  ANT_OPTIONS += -Djdk.version=$(JDK_VERSION)
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
endif 
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
ifdef FULL_VERSION
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
  ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
endif 
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
ifdef MILESTONE
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
  ANT_OPTIONS += -Dmilestone=$(MILESTONE)
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
ifdef BUILD_NUMBER
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
  ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER)
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
else
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
  ifdef JDK_BUILD_NUMBER
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER)
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
  endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
ifeq ($(VARIANT), DBG)
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
  ANT_OPTIONS += -Djavac.debug=true
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
else
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
  ifeq ($(VARIANT), OPT)
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    ANT_OPTIONS += -Djavac.debug=false
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
  endif
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
# Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
# and the somewhat misnamed CLASS_VERSION (-target NN)
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
ifdef TARGET_CLASS_VERSION
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
  ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
else
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
  ifdef JAVAC_TARGET_ARG 
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
  endif
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
endif 
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
ifdef ALT_BOOTDIR
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
  ANT_OPTIONS += -Dboot.java.home=$(ALT_BOOTDIR)
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
  ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
ifdef ALT_OUTPUTDIR
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
  OUTPUTDIR = $(ALT_OUTPUTDIR)
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
  ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
  ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
else
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
  OUTPUTDIR = ..
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
#ABS_OUTPUTDIR = $(abspath $(OUTPUTDIR))
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
ANT_TMPDIR = $(ABS_OUTPUTDIR)/build/ant-tmp
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
ANT_OPTS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)'
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
ifdef FINDBUGS_HOME
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
  ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME)
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
ifdef ANT_HOME
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
  ANT = $(ANT_HOME)/bin/ant
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
  ifneq ($(shell test -x $(ANT) && echo OK), OK)
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
    $(error $(ANT) not found -- please update ANT_HOME)
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
  endif
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
else
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
  ANT = ant
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
  ifneq ($(shell test -x "`which $(ANT)`" && echo OK), OK)
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
    $(error 'ant' not found -- please set ANT_HOME or put 'ant' on your PATH)
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
  endif
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
endif
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
# Default target and expected 'do everything' target
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
all: build
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
# Standard make clobber target
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
clobber: clean
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
# All ant targets of interest
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
ANT_TARGETS = build clean sanity post-sanity diagnostics # for now
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
# Create a make target for each
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
$(ANT_TARGETS):
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
	@ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
	$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $(OUTPUTDIR)/build/ant-diagnostics.log
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
	$(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
#-------------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
# Targets for Sun's internal JPRT build system
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
CD = cd
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
ZIP = zip
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
jprt_build_product jprt_build_debug jprt_build_fastdebug: all
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
	( $(CD) $(OUTPUTDIR) && \
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
	  $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist )
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
#-------------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
# Declare these phony (not filenames)
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
.PHONY: $(ANT_TARGETS) all clobber \
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
	jprt_build_product jprt_build_debug jprt_build_fastdebug