J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | # |
| 2 | # Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | # |
| 5 | # This code is free software; you can redistribute it and/or modify it |
| 6 | # under the terms of the GNU General Public License version 2 only, as |
| 7 | # published by the Free Software Foundation. Sun designates this |
| 8 | # particular file as subject to the "Classpath" exception as provided |
| 9 | # by Sun in the LICENSE file that accompanied this code. |
| 10 | # |
| 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | # version 2 for more details (a copy is included in the LICENSE file that |
| 15 | # accompanied this code). |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License version |
| 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | # |
| 21 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | # CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | # have any questions. |
| 24 | # |
| 25 | |
| 26 | # |
| 27 | # Makefile to build the BeanInfo generation tool (ie, a doclet), and |
| 28 | # then the beaninfo itself. Swing versions prior to 1.2 is no longer |
| 29 | # built. |
| 30 | # |
| 31 | # This makefile could be a lot simpler if we made it more regular. |
| 32 | # |
| 33 | |
| 34 | # identify this as a swingbeans product - used only to identify a |
| 35 | # unique name for OBJDIR |
| 36 | PRODUCT = swing-beans |
| 37 | |
| 38 | # |
| 39 | # Main targets provided by this makefile. |
| 40 | # |
| 41 | swing-1.2-beans: |
| 42 | $(MAKE) DEBUG_FLAG=false make-swing-beans |
| 43 | swing-1.2-beans-debug: |
| 44 | $(MAKE) DEBUG_FLAG=true make-swing-beans |
| 45 | |
| 46 | |
| 47 | LOCAL_JAVADOC = $(JAVADOC_CMD) $(JAVADOCFLAGS) |
| 48 | # get the absolute path to the jar command. |
| 49 | PREFIX = 1.2 |
| 50 | JAVADOCFLAGS = $(LANGUAGE_VERSION) |
| 51 | SWINGPKG = javax/swing |
| 52 | LOCAL_JAVAC_FLAGS = $(OTHER_JAVACFLAGS) |
| 53 | |
| 54 | include FILES.gmk |
| 55 | include $(BUILDDIR)/common/Release.gmk |
| 56 | |
| 57 | DOCLETSRC = $(BUILDDIR)/tools/swing-beans |
| 58 | DOCLETDST = $(TEMPDIR) |
| 59 | |
| 60 | FILES_java = GenSwingBeanInfo.java GenDocletBeanInfo.java DocBeanInfo.java |
| 61 | FILES_class = $(FILES_java:%.java=$(DOCLETDST)/%.class) |
| 62 | FAKESRC = $(TOPDIR)/src/share/classes |
| 63 | BEANSRCDIR = $(TEMPDIR)/$(PREFIX)src |
| 64 | BEANCLASSDIR = $(TEMPDIR)/$(PREFIX)classes |
| 65 | FILES_beans = $(BEANS:%=$(BEANSRCDIR)/%BeanInfo.java) \ |
| 66 | $(BEANS_TEXT:%=$(BEANSRCDIR)/text/%BeanInfo.java) \ |
| 67 | $(BEANSRCDIR)/SwingBeanInfoBase.java \ |
| 68 | $(BEANSRCDIR)/BeanInfoUtils.java |
| 69 | |
| 70 | FILES_bclass = $(FILES_beans:$(BEANSRCDIR)/%.java=$(BEANCLASSDIR)/$(SWINGPKG)/%.class) |
| 71 | DOCLETFLAGS = -doclet GenDocletBeanInfo |
| 72 | LOCAL_CLASSPATH = "$(CLASSBINDIR)$(CLASSPATH_SEPARATOR)$(BEANCLASSDIR)$(CLASSPATH_SEPARATOR)." |
| 73 | |
| 74 | # |
| 75 | # Main target. |
| 76 | # |
| 77 | make-swing-beans: mkdoclet mkbeaninfo mkclasses mkpackaging |
| 78 | |
| 79 | # |
| 80 | # Make the doclet. |
| 81 | # |
| 82 | mkdoclet: $(DOCLETDST) $(FILES_class) .SwingBeanInfo |
| 83 | |
| 84 | $(OBJDIR) $(BEANCLASSDIR) $(BEANSRCDIR) $(DOCLETDST):: |
| 85 | @$(ECHO) "Making directory..." $@ |
| 86 | @$(MKDIR) -p $@ |
| 87 | |
| 88 | $(DOCLETDST)/%.class: $(DOCLETSRC)/%.java |
| 89 | $(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) -classpath "$(CLASSBINDIR)$(CLASSPATH_SEPARATOR)$(DOCLETSRC)" -d $(DOCLETDST) $? |
| 90 | @$(java-vm-cleanup) |
| 91 | |
| 92 | # To run, the doclet needs SwingBeanInfoBase class. Also Notice the lie |
| 93 | # here, SwingBeanInfoBase.class goes elswhere. |
| 94 | |
| 95 | .SwingBeanInfo: $(OBJDIR) $(BEANCLASSDIR) $(BEANSRCDIR) $(SWINGPKG)/BeanInfoUtils.class $(SWINGPKG)/SwingBeanInfoBase.class |
| 96 | |
| 97 | $(SWINGPKG)/BeanInfoUtils.class: $(BEANSRCDIR)/BeanInfoUtils.java |
| 98 | $(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) -d $(BEANCLASSDIR) $< |
| 99 | @$(java-vm-cleanup) |
| 100 | |
| 101 | $(SWINGPKG)/SwingBeanInfoBase.class: $(BEANSRCDIR)/SwingBeanInfoBase.java $(BEANSRCDIR)/BeanInfoUtils.java |
| 102 | $(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) -classpath $(BEANCLASSDIR) -d $(BEANCLASSDIR) $< |
| 103 | @$(java-vm-cleanup) |
| 104 | |
| 105 | # |
| 106 | # Stage 1: Generate *BeanInfo.java files. |
| 107 | # |
| 108 | mkbeaninfo: $(BEANSRCDIR) .delete.beanlist $(FILES_beans) .javadoc.beanlist |
| 109 | |
| 110 | .delete.beanlist: |
| 111 | @$(RM) $(TEMPDIR)/.beans.list |
| 112 | |
| 113 | .javadoc.beanlist: |
| 114 | if [ -s $(TEMPDIR)/.beans.list ]; \ |
| 115 | then $(LOCAL_JAVADOC) $(DOCLETFLAGS) -x $(DEBUG_FLAG) -d $(BEANSRCDIR) -t $(DOCLETSRC)/SwingBeanInfo.template -docletpath $(DOCLETDST) \ |
| 116 | $(shell if [ -s $(TEMPDIR)/.beans.list ]; then $(CAT) $(TEMPDIR)/.beans.list; fi); \ |
| 117 | fi |
| 118 | @$(java-vm-cleanup) |
| 119 | |
| 120 | $(BEANSRCDIR)/text/%BeanInfo.java: $(FAKESRC)/$(SWINGPKG)/text/%.java |
| 121 | @$(ECHO) $< >> $(TEMPDIR)/.beans.list |
| 122 | |
| 123 | $(BEANSRCDIR)/%BeanInfo.java: $(FAKESRC)/$(SWINGPKG)/%.java |
| 124 | @$(ECHO) $< >> $(TEMPDIR)/.beans.list |
| 125 | |
| 126 | $(BEANSRCDIR)/SwingBeanInfoBase.java: $(DOCLETSRC)/beaninfo/SwingBeanInfoBase.java |
| 127 | $(CP) $< $@ |
| 128 | |
| 129 | $(BEANSRCDIR)/BeanInfoUtils.java: $(DOCLETSRC)/beaninfo/BeanInfoUtils.java |
| 130 | $(CP) $< $@ |
| 131 | |
| 132 | # |
| 133 | # Compile the generated *BeanInfo.java files. |
| 134 | # |
| 135 | mkclasses: .delete.classlist $(BEANCLASSDIR)/$(SWINGPKG)/SwingBeanInfoBase.class \ |
| 136 | $(BEANCLASSDIR)/$(SWINGPKG)/text/JTextComponentBeanInfo.class \ |
| 137 | .create.classlist $(FILES_bclass) .compile.classlist |
| 138 | |
| 139 | $(BEANCLASSDIR)/$(SWINGPKG)/SwingBeanInfoBase.class:: \ |
| 140 | $(BEANSRCDIR)/SwingBeanInfoBase.java |
| 141 | |
| 142 | $(BEANCLASSDIR)/$(SWINGPKG)/text/JTextComponentBeanInfo.class:: \ |
| 143 | $(BEANSRCDIR)/JTextComponentBeanInfo.java |
| 144 | |
| 145 | $(FILES_bclass):: $(FILES_beans) |
| 146 | |
| 147 | # all the sources are in one directory, so make sure that the list does |
| 148 | # not have the /text direcotry in it. Kludgy, this is... |
| 149 | .create.classlist: |
| 150 | @$(ECHO) $(subst /text/,/,$(FILES_beans)) >> $(TEMPDIR)/.classes.list |
| 151 | |
| 152 | .delete.classlist: |
| 153 | @$(ECHO) "Deleting classes.list..." |
| 154 | @$(RM) $(TEMPDIR)/.classes.list |
| 155 | |
| 156 | .compile.classlist: |
| 157 | if [ -s $(TEMPDIR)/.classes.list ] ; then \ |
| 158 | $(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) -classpath $(LOCAL_CLASSPATH) -d $(BEANCLASSDIR) \ |
| 159 | $(shell if [ -s $(TEMPDIR)/.classes.list ] ; then $(CAT) $(TEMPDIR)/.classes.list; fi ) ; \ |
| 160 | fi |
| 161 | @$(java-vm-cleanup) |
| 162 | |
| 163 | # |
| 164 | # Packaging |
| 165 | # |
| 166 | mkpackaging: |
| 167 | $(RM) -r $(BEANCLASSDIR)/$(SWINGPKG)/beaninfo/images |
| 168 | $(MKDIR) -p $(BEANCLASSDIR)/$(SWINGPKG)/beaninfo/images |
| 169 | $(CP) $(DOCLETSRC)/beaninfo/images/*.gif $(BEANCLASSDIR)/$(SWINGPKG)/beaninfo/images |
| 170 | $(BOOT_JAR_CMD) cf $(TEMPDIR)/tmp.jar \ |
| 171 | -C $(BEANCLASSDIR) javax \ |
| 172 | -C $(BEANCLASSDIR) sun \ |
| 173 | $(JAR_JFLAGS) |
| 174 | $(MV) $(TEMPDIR)/tmp.jar $(JDK_IMAGE_DIR)/lib/dt.jar |
| 175 | @$(java-vm-cleanup) |
| 176 | |
| 177 | # |
| 178 | # Cleanliness. |
| 179 | # |
| 180 | swingbeans.clean swingbeans.clobber:: |
| 181 | $(RM) -r 1.2src 1.2classes |
| 182 | $(RM) -r java javax |
| 183 | $(RM) *.class |
| 184 | $(RM) $(TEMPDIR)/.beans.list $(TEMPDIR)/.classes.list beaninfo.jar |
| 185 | |
| 186 | # |
| 187 | # Utility. |
| 188 | # |
| 189 | |
| 190 | |
| 191 | # |
| 192 | # Debugging targets for looking at variables. |
| 193 | # |
| 194 | show-vars: |
| 195 | @$(ECHO) FILES_beans = $(FILES_beans) |
| 196 | @$(ECHO) FILES_bclass = $(FILES_bclass) |
| 197 | |
| 198 | .PRECIOUS: $(FILES_beans) |
| 199 | |
| 200 | .PHONY: swing-1.2-beans swing-1.2-beans-debug \ |
| 201 | make-swing-beans mkdoclet .SwingBeanInfo mkbeaninfo .delete.beanlist \ |
| 202 | .javadoc.beanlist mkclasses .create.classlist .delete.classlist \ |
| 203 | .compile.classlist mkpackaging mkpackaging swingbeans.clean \ |
| 204 | swingbeans.clobber show-vars |