1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/make/common/BuildToolJar.gmk Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,71 @@ 1.4 +# 1.5 +# Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved. 1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 +# 1.8 +# This code is free software; you can redistribute it and/or modify it 1.9 +# under the terms of the GNU General Public License version 2 only, as 1.10 +# published by the Free Software Foundation. Sun designates this 1.11 +# particular file as subject to the "Classpath" exception as provided 1.12 +# by Sun in the LICENSE file that accompanied this code. 1.13 +# 1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 +# version 2 for more details (a copy is included in the LICENSE file that 1.18 +# accompanied this code). 1.19 +# 1.20 +# You should have received a copy of the GNU General Public License version 1.21 +# 2 along with this work; if not, write to the Free Software Foundation, 1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 +# 1.24 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 +# CA 95054 USA or visit www.sun.com if you need additional information or 1.26 +# have any questions. 1.27 +# 1.28 + 1.29 +# Input: BUILDDIR PACKAGE PKGDIR PROGRAM BUILDTOOL_SOURCE_ROOT BUILDTOOL_MAIN 1.30 + 1.31 +BUILDTOOL_MAIN_SOURCE_FILE = $(BUILDTOOL_SOURCE_ROOT)/$(BUILDTOOL_MAIN) 1.32 +BUILDTOOL_MANIFEST_FILE = $(BUILDTOOLCLASSDIR)/$(PROGRAM)_manifest.mf 1.33 +BUILDTOOL_JAR_FILE = $(BUILDTOOLJARDIR)/$(PROGRAM).jar 1.34 +BUILDTOOL_ALL_FILES := $(shell $(CD) $(BUILDTOOL_SOURCE_ROOT) \ 1.35 + && $(FIND) $(PKGDIR) $(SCM_DIRS_prune) -o -type f -print) 1.36 +BUILTTOOL_MAINCLASS = $(subst /,.,$(BUILDTOOL_MAIN:%.java=%)) 1.37 + 1.38 +all build: $(BUILDTOOL_JAR_FILE) tool_info 1.39 + 1.40 +$(BUILDTOOL_MANIFEST_FILE): $(BUILDTOOL_MAIN_SOURCE_FILE) 1.41 + @$(prep-target) 1.42 + $(ECHO) "Main-Class: $(BUILTTOOL_MAINCLASS)" > $@ 1.43 + 1.44 +$(BUILDTOOL_JAR_FILE): $(BUILDTOOL_MANIFEST_FILE) \ 1.45 + $(BUILDTOOL_ALL_FILES:%=$(BUILDTOOL_SOURCE_ROOT)/%) 1.46 + @$(prep-target) 1.47 + @$(MKDIR) -p $(BUILDTOOLCLASSDIR) 1.48 + $(BOOT_JAVAC_CMD) -d $(BUILDTOOLCLASSDIR) \ 1.49 + -sourcepath $(BUILDTOOL_SOURCE_ROOT) $(BUILDTOOL_MAIN_SOURCE_FILE) 1.50 + $(BOOT_JAR_CMD) cfm $@ $(BUILDTOOL_MANIFEST_FILE) \ 1.51 + -C $(BUILDTOOLCLASSDIR) $(PKGDIR) \ 1.52 + $(JAR_JFLAGS) || $(RM) $@ 1.53 + @$(java-vm-cleanup) 1.54 + 1.55 +# Printing out a build tool information line 1.56 +define printBuildToolSetting 1.57 +if [ "$2" != "" ] ; then $(PRINTF) "%-25s %s\n" "$1:" "$2"; fi 1.58 +endef 1.59 + 1.60 +# Print out the build tool information 1.61 +tool_info: 1.62 + @$(ECHO) "=========================================================" 1.63 + @$(call printBuildToolSetting,BUILDTOOL,$(PROGRAM)) 1.64 + @$(call printBuildToolSetting,PACKAGE,$(PACKAGE)) 1.65 + @$(call printBuildToolSetting,BUILDTOOL_SOURCE_ROOT,$(BUILDTOOL_SOURCE_ROOT)) 1.66 + @$(call printBuildToolSetting,BUILTTOOL_MAINCLASS,$(BUILTTOOL_MAINCLASS)) 1.67 + @$(call printBuildToolSetting,BUILDTOOL_JAR_FILE,$(BUILDTOOL_JAR_FILE)) 1.68 + @$(ECHO) "=========================================================" 1.69 + 1.70 +clean clobber:: 1.71 + $(RM) -r $(BUILDTOOLCLASSDIR)/$(PKGDIR) 1.72 + $(RM) $(BUILDTOOL_MANIFEST_FILE) 1.73 + $(RM) $(BUILDTOOL_JAR_FILE) 1.74 +