SwingBeans.gmk 6.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
#
# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

#
# Makefile to build the BeanInfo generation tool (ie, a doclet), and
# then the beaninfo itself.  Swing versions prior to 1.2 are no longer
# built.
#
# This makefile could be a lot simpler if we made it more regular.
#

# identify this as a swingbeans product - used only to identify a
# unique name for OBJDIR
PRODUCT = swing-beans

#
# Main targets provided by this makefile.
# 
swing-1.2-beans:
	$(MAKE) DEBUG_FLAG=false make-swing-beans
swing-1.2-beans-debug:
	$(MAKE) DEBUG_FLAG=true make-swing-beans


# get the absolute path to the jar command.
PREFIX          = 1.2
JAVADOCFLAGS    += $(NO_PROPRIETARY_API_WARNINGS) $(LANGUAGE_VERSION)
SWINGPKG        = javax/swing
LOCAL_JAVAC_FLAGS = $(OTHER_JAVACFLAGS)
# since JAVADOC_CMD runs on ALT_BOOTDIR, the doclet and all its classes must be compiled to match
DOCLET_JAVAC_FLAGS = -source 6 -target 6

include FILES.gmk
include $(BUILDDIR)/common/Release.gmk

DOCLETSRC    = $(BUILDDIR)/../make/tools/swing-beans
DOCLETDST    = $(TEMPDIR)

FILES_java   = GenSwingBeanInfo.java GenDocletBeanInfo.java DocBeanInfo.java
FILES_class  = $(FILES_java:%.java=$(DOCLETDST)/%.class)
FAKESRC	     = $(JDK_TOPDIR)/src/share/classes
BEANSRCDIR  =  $(TEMPDIR)/$(PREFIX)src
BEANCLASSDIR = $(TEMPDIR)/$(PREFIX)classes
FILES_beans =  $(BEANS:%=$(BEANSRCDIR)/%BeanInfo.java) \
	       $(BEANS_TEXT:%=$(BEANSRCDIR)/text/%BeanInfo.java)  \
	       $(BEANSRCDIR)/SwingBeanInfoBase.java \
	       $(BEANSRCDIR)/BeanInfoUtils.java
               
FILES_bclass = $(FILES_beans:$(BEANSRCDIR)/%.java=$(BEANCLASSDIR)/$(SWINGPKG)/%.class)
DOCLETFLAGS  = -doclet GenDocletBeanInfo
LOCAL_CLASSPATH = "$(CLASSBINDIR)$(CLASSPATH_SEPARATOR)$(BEANCLASSDIR)$(CLASSPATH_SEPARATOR)."

#
# Main target.
#
make-swing-beans: mkdoclet mkbeaninfo mkclasses mkpackaging

#
# Make the doclet.
#
mkdoclet: $(DOCLETDST) $(FILES_class) .SwingBeanInfo

$(OBJDIR) $(BEANCLASSDIR) $(BEANSRCDIR) $(DOCLETDST)::
	@$(ECHO) "Making directory..." $@
	@$(MKDIR) -p $@

$(DOCLETDST)/%.class: $(DOCLETSRC)/%.java
	$(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) $(DOCLET_JAVAC_FLAGS) -classpath "$(CLASSBINDIR)$(CLASSPATH_SEPARATOR)$(DOCLETSRC)" -d $(DOCLETDST) $?
	@$(java-vm-cleanup)

# To run, the doclet needs SwingBeanInfoBase class.  Also Notice the lie
# here, SwingBeanInfoBase.class goes elswhere.

.SwingBeanInfo: $(OBJDIR) $(BEANCLASSDIR) $(BEANSRCDIR) $(SWINGPKG)/BeanInfoUtils.class $(SWINGPKG)/SwingBeanInfoBase.class 

$(SWINGPKG)/BeanInfoUtils.class: $(BEANSRCDIR)/BeanInfoUtils.java
	$(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) $(DOCLET_JAVAC_FLAGS) -d $(BEANCLASSDIR) $<
	@$(java-vm-cleanup)

$(SWINGPKG)/SwingBeanInfoBase.class: $(BEANSRCDIR)/SwingBeanInfoBase.java $(BEANSRCDIR)/BeanInfoUtils.java
	$(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) $(DOCLET_JAVAC_FLAGS) -classpath $(BEANCLASSDIR) -d $(BEANCLASSDIR) $<
	@$(java-vm-cleanup)

#
# Stage 1: Generate *BeanInfo.java files.
#
mkbeaninfo: $(BEANSRCDIR) .delete.beanlist $(FILES_beans) .javadoc.beanlist

.delete.beanlist: 
	@$(RM) $(TEMPDIR)/.beans.list

.javadoc.beanlist:
	if [ -s $(TEMPDIR)/.beans.list ]; \
	then $(JAVADOC_CMD) $(DOCLETFLAGS) -x $(DEBUG_FLAG) -d $(BEANSRCDIR) -t $(DOCLETSRC)/SwingBeanInfo.template -docletpath $(DOCLETDST) \
	    $(shell if [ -s $(TEMPDIR)/.beans.list ]; then $(CAT) $(TEMPDIR)/.beans.list; fi); \
	fi
	@$(java-vm-cleanup)

$(BEANSRCDIR)/text/%BeanInfo.java: $(FAKESRC)/$(SWINGPKG)/text/%.java
	@$(ECHO) $< >> $(TEMPDIR)/.beans.list

$(BEANSRCDIR)/%BeanInfo.java: $(FAKESRC)/$(SWINGPKG)/%.java
	@$(ECHO) $< >> $(TEMPDIR)/.beans.list

$(BEANSRCDIR)/SwingBeanInfoBase.java: $(DOCLETSRC)/beaninfo/SwingBeanInfoBase.java
	$(CP) $< $@

$(BEANSRCDIR)/BeanInfoUtils.java: $(DOCLETSRC)/beaninfo/BeanInfoUtils.java
	$(CP) $< $@

#
# Compile the generated *BeanInfo.java files.
#
mkclasses: .delete.classlist $(BEANCLASSDIR)/$(SWINGPKG)/SwingBeanInfoBase.class \
	$(BEANCLASSDIR)/$(SWINGPKG)/text/JTextComponentBeanInfo.class \
	.create.classlist $(FILES_bclass) .compile.classlist

$(BEANCLASSDIR)/$(SWINGPKG)/SwingBeanInfoBase.class:: \
	$(BEANSRCDIR)/SwingBeanInfoBase.java

$(BEANCLASSDIR)/$(SWINGPKG)/text/JTextComponentBeanInfo.class:: \
	$(BEANSRCDIR)/JTextComponentBeanInfo.java

$(FILES_bclass):: $(FILES_beans)

# all the sources are in one directory, so make sure that the list does
# not have the /text direcotry in it. Kludgy, this is...
.create.classlist:
	@$(ECHO) $(subst /text/,/,$(FILES_beans)) >> $(TEMPDIR)/.classes.list

.delete.classlist:
	@$(ECHO) "Deleting classes.list..."
	@$(RM) $(TEMPDIR)/.classes.list

.compile.classlist:
	if [ -s $(TEMPDIR)/.classes.list ] ; then \
	    $(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) -classpath $(LOCAL_CLASSPATH) -d $(BEANCLASSDIR) \
	    $(shell if [ -s $(TEMPDIR)/.classes.list ] ; then $(CAT) $(TEMPDIR)/.classes.list; fi ) ; \
	fi
	@$(java-vm-cleanup)

#
# Packaging
#
mkpackaging: 
	$(RM) -r $(BEANCLASSDIR)/$(SWINGPKG)/beaninfo/images
	$(MKDIR) -p $(BEANCLASSDIR)/$(SWINGPKG)/beaninfo/images
	$(CP) $(DOCLETSRC)/beaninfo/images/*.gif $(BEANCLASSDIR)/$(SWINGPKG)/beaninfo/images
	$(BOOT_JAR_CMD) cf $(TEMPDIR)/tmp.jar \
	     -C $(BEANCLASSDIR) javax \
	     -C $(BEANCLASSDIR) sun \
	     $(BOOT_JAR_JFLAGS)
	$(MV) $(TEMPDIR)/tmp.jar $(JDK_IMAGE_DIR)/lib/dt.jar
	@$(java-vm-cleanup)

#
# Cleanliness.
#
swingbeans.clean swingbeans.clobber::
	$(RM) -r 1.2src 1.2classes
	$(RM) -r java javax
	$(RM) *.class
	$(RM) $(TEMPDIR)/.beans.list $(TEMPDIR)/.classes.list beaninfo.jar

#
# Utility.
#


#
# Debugging targets for looking at variables.
#
show-vars:
	@$(ECHO) FILES_beans = $(FILES_beans)
	@$(ECHO) FILES_bclass = $(FILES_bclass)

.PRECIOUS: $(FILES_beans) 

.PHONY: swing-1.2-beans swing-1.2-beans-debug \
	make-swing-beans mkdoclet .SwingBeanInfo mkbeaninfo .delete.beanlist \
	.javadoc.beanlist mkclasses .create.classlist .delete.classlist \
	.compile.classlist mkpackaging mkpackaging swingbeans.clean \
	swingbeans.clobber show-vars