jdk/make/modules/tools/Makefile
author mchung
Fri, 18 Dec 2009 11:36:23 -0800
changeset 4524 697144bd8b04
child 4681 7d382dfe6e55
permissions -rw-r--r--
6909572: Add a new target for building modules Summary: Add a new "modules" build target that builds jdk and jre module image Reviewed-by: alanb, ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4524
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     1
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     2
# Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     4
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     7
# published by the Free Software Foundation.  Sun designates this
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
     9
# by Sun in the LICENSE file that accompanied this code.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    10
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    15
# accompanied this code).
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    16
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    20
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    23
# have any questions.
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    24
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    25
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    26
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    27
# Makefile for building the classanalyzer tool
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    28
#
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    29
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    30
BUILDDIR = ../..
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    31
PACKAGE = com.sun.classanalyzer
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    32
PRODUCT = tools
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    33
PROGRAM = classanalyzer
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    34
include $(BUILDDIR)/common/Defs.gmk
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    35
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    36
BUILDTOOL_SOURCE_ROOT = src
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    37
BUILDTOOL_MAIN        = $(PKGDIR)/ClassAnalyzer.java
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    38
BUILTTOOL_MAINCLASS   = $(subst /,.,$(BUILDTOOL_MAIN:%.java=%))
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    39
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    40
BUILDTOOL_MAIN_SOURCE_FILE = $(BUILDTOOL_SOURCE_ROOT)/$(BUILDTOOL_MAIN)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    41
BUILDTOOL_MANIFEST_FILE    = $(BUILDTOOLCLASSDIR)/$(PROGRAM)_manifest.mf
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    42
BUILDTOOL_JAR_FILE         = $(BUILDTOOLJARDIR)/$(PROGRAM).jar
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    43
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    44
FILES_java := $(shell $(CD) $(BUILDTOOL_SOURCE_ROOT) \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    45
    && $(FIND) $(PKGDIR) $(SCM_DIRS_prune) -o -type f -print)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    46
FILES_class = $(FILES_java:%.java=$(BUILDTOOLCLASSDIR)/%.class)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    47
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    48
all build: $(BUILDTOOL_JAR_FILE) tool_info
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    49
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    50
$(BUILDTOOL_MANIFEST_FILE): $(BUILDTOOL_MAIN_SOURCE_FILE)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    51
	@$(prep-target)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    52
	$(ECHO) "Main-Class: $(BUILTTOOL_MAINCLASS)" > $@
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    53
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    54
$(BUILDTOOLCLASSDIR)/%.class : $(BUILDTOOL_SOURCE_ROOT)/%.java
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    55
	@$(prep-target)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    56
	$(JAVAC_CMD) \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    57
            -sourcepath $(BUILDTOOL_SOURCE_ROOT) \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    58
            -d $(BUILDTOOLCLASSDIR) $<
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    59
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    60
$(BUILDTOOL_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) $(FILES_class)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    61
	@$(prep-target)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    62
	$(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    63
	    -C $(BUILDTOOLCLASSDIR) $(PKGDIR) \
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    64
	    $(BOOT_JAR_JFLAGS) || $(RM) $@
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    65
	$(java-vm-cleanup)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    66
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    67
# Printing out a build tool information line
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    68
define printBuildToolSetting
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    69
if [ "$2" != "" ] ; then $(PRINTF) "%-25s %s\n" "$1:" "$2"; fi
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    70
endef
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    71
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    72
# Print out the build tool information
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    73
tool_info:
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    74
	@$(ECHO) "========================================================="
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    75
	@$(call printBuildToolSetting,BUILDTOOL,$(PROGRAM))
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    76
	@$(call printBuildToolSetting,PACKAGE,$(PACKAGE))
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    77
	@$(call printBuildToolSetting,BUILDTOOL_SOURCE_ROOT,$(BUILDTOOL_SOURCE_ROOT))
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    78
	@$(call printBuildToolSetting,BUILTTOOL_MAINCLASS,$(BUILTTOOL_MAINCLASS))
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    79
	@$(call printBuildToolSetting,BUILDTOOL_JAR_FILE,$(BUILDTOOL_JAR_FILE))
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    80
	@$(ECHO) "========================================================="
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    81
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    82
clean clobber::
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    83
	@$(RM) -rf $(BUILDTOOLCLASSDIR)/$(PKGDIR)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    84
	@$(RM) $(BUILDTOOL_MANIFEST_FILE)
697144bd8b04 6909572: Add a new target for building modules
mchung
parents:
diff changeset
    85
	@$(RM) $(BUILDTOOL_JAR_FILE)