1 #
   2 # Copyright (c) 1998, 2008, Oracle and/or its affiliates. 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.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # 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 are 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 # get the absolute path to the jar command.
  48 PREFIX          = 1.2
  49 JAVADOCFLAGS    += $(NO_PROPRIETARY_API_WARNINGS) $(LANGUAGE_VERSION)
  50 SWINGPKG        = javax/swing
  51 LOCAL_JAVAC_FLAGS = $(OTHER_JAVACFLAGS)
  52 # since JAVADOC_CMD runs on ALT_BOOTDIR, the doclet and all its classes must be compiled to match
  53 DOCLET_JAVAC_FLAGS = -source 6 -target 6
  54 
  55 include FILES.gmk
  56 include $(BUILDDIR)/common/Release.gmk
  57 
  58 DOCLETSRC    = $(BUILDDIR)/tools/swing-beans
  59 DOCLETDST    = $(TEMPDIR)
  60 
  61 FILES_java   = GenSwingBeanInfo.java GenDocletBeanInfo.java DocBeanInfo.java
  62 FILES_class  = $(FILES_java:%.java=$(DOCLETDST)/%.class)
  63 FAKESRC      = $(TOPDIR)/src/share/classes
  64 BEANSRCDIR  =  $(TEMPDIR)/$(PREFIX)src
  65 BEANCLASSDIR = $(TEMPDIR)/$(PREFIX)classes
  66 FILES_beans =  $(BEANS:%=$(BEANSRCDIR)/%BeanInfo.java) \
  67                $(BEANS_TEXT:%=$(BEANSRCDIR)/text/%BeanInfo.java)  \
  68                $(BEANSRCDIR)/SwingBeanInfoBase.java \
  69                $(BEANSRCDIR)/BeanInfoUtils.java
  70                
  71 FILES_bclass = $(FILES_beans:$(BEANSRCDIR)/%.java=$(BEANCLASSDIR)/$(SWINGPKG)/%.class)
  72 DOCLETFLAGS  = -doclet GenDocletBeanInfo
  73 LOCAL_CLASSPATH = "$(CLASSBINDIR)$(CLASSPATH_SEPARATOR)$(BEANCLASSDIR)$(CLASSPATH_SEPARATOR)."
  74 
  75 #
  76 # Main target.
  77 #
  78 make-swing-beans: mkdoclet mkbeaninfo mkclasses mkpackaging
  79 
  80 #
  81 # Make the doclet.
  82 #
  83 mkdoclet: $(DOCLETDST) $(FILES_class) .SwingBeanInfo
  84 
  85 $(OBJDIR) $(BEANCLASSDIR) $(BEANSRCDIR) $(DOCLETDST)::
  86         @$(ECHO) "Making directory..." $@
  87         @$(MKDIR) -p $@
  88 
  89 $(DOCLETDST)/%.class: $(DOCLETSRC)/%.java
  90         $(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) $(DOCLET_JAVAC_FLAGS) -classpath "$(CLASSBINDIR)$(CLASSPATH_SEPARATOR)$(DOCLETSRC)" -d $(DOCLETDST) $?
  91         @$(java-vm-cleanup)
  92 
  93 # To run, the doclet needs SwingBeanInfoBase class.  Also Notice the lie
  94 # here, SwingBeanInfoBase.class goes elswhere.
  95 
  96 .SwingBeanInfo: $(OBJDIR) $(BEANCLASSDIR) $(BEANSRCDIR) $(SWINGPKG)/BeanInfoUtils.class $(SWINGPKG)/SwingBeanInfoBase.class 
  97 
  98 $(SWINGPKG)/BeanInfoUtils.class: $(BEANSRCDIR)/BeanInfoUtils.java
  99         $(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) $(DOCLET_JAVAC_FLAGS) -d $(BEANCLASSDIR) $<
 100         @$(java-vm-cleanup)
 101 
 102 $(SWINGPKG)/SwingBeanInfoBase.class: $(BEANSRCDIR)/SwingBeanInfoBase.java $(BEANSRCDIR)/BeanInfoUtils.java
 103         $(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) $(DOCLET_JAVAC_FLAGS) -classpath $(BEANCLASSDIR) -d $(BEANCLASSDIR) $<
 104         @$(java-vm-cleanup)
 105 
 106 #
 107 # Stage 1: Generate *BeanInfo.java files.
 108 #
 109 mkbeaninfo: $(BEANSRCDIR) .delete.beanlist $(FILES_beans) .javadoc.beanlist
 110 
 111 .delete.beanlist: 
 112         @$(RM) $(TEMPDIR)/.beans.list
 113 
 114 .javadoc.beanlist:
 115         if [ -s $(TEMPDIR)/.beans.list ]; \
 116         then $(JAVADOC_CMD) $(DOCLETFLAGS) -x $(DEBUG_FLAG) -d $(BEANSRCDIR) -t $(DOCLETSRC)/SwingBeanInfo.template -docletpath $(DOCLETDST) \
 117             $(shell if [ -s $(TEMPDIR)/.beans.list ]; then $(CAT) $(TEMPDIR)/.beans.list; fi); \
 118         fi
 119         @$(java-vm-cleanup)
 120 
 121 $(BEANSRCDIR)/text/%BeanInfo.java: $(FAKESRC)/$(SWINGPKG)/text/%.java
 122         @$(ECHO) $< >> $(TEMPDIR)/.beans.list
 123 
 124 $(BEANSRCDIR)/%BeanInfo.java: $(FAKESRC)/$(SWINGPKG)/%.java
 125         @$(ECHO) $< >> $(TEMPDIR)/.beans.list
 126 
 127 $(BEANSRCDIR)/SwingBeanInfoBase.java: $(DOCLETSRC)/beaninfo/SwingBeanInfoBase.java
 128         $(CP) $< $@
 129 
 130 $(BEANSRCDIR)/BeanInfoUtils.java: $(DOCLETSRC)/beaninfo/BeanInfoUtils.java
 131         $(CP) $< $@
 132 
 133 #
 134 # Compile the generated *BeanInfo.java files.
 135 #
 136 mkclasses: .delete.classlist $(BEANCLASSDIR)/$(SWINGPKG)/SwingBeanInfoBase.class \
 137         $(BEANCLASSDIR)/$(SWINGPKG)/text/JTextComponentBeanInfo.class \
 138         .create.classlist $(FILES_bclass) .compile.classlist
 139 
 140 $(BEANCLASSDIR)/$(SWINGPKG)/SwingBeanInfoBase.class:: \
 141         $(BEANSRCDIR)/SwingBeanInfoBase.java
 142 
 143 $(BEANCLASSDIR)/$(SWINGPKG)/text/JTextComponentBeanInfo.class:: \
 144         $(BEANSRCDIR)/JTextComponentBeanInfo.java
 145 
 146 $(FILES_bclass):: $(FILES_beans)
 147 
 148 # all the sources are in one directory, so make sure that the list does
 149 # not have the /text direcotry in it. Kludgy, this is...
 150 .create.classlist:
 151         @$(ECHO) $(subst /text/,/,$(FILES_beans)) >> $(TEMPDIR)/.classes.list
 152 
 153 .delete.classlist:
 154         @$(ECHO) "Deleting classes.list..."
 155         @$(RM) $(TEMPDIR)/.classes.list
 156 
 157 .compile.classlist:
 158         if [ -s $(TEMPDIR)/.classes.list ] ; then \
 159             $(JAVAC_CMD) $(LOCAL_JAVAC_FLAGS) -classpath $(LOCAL_CLASSPATH) -d $(BEANCLASSDIR) \
 160             $(shell if [ -s $(TEMPDIR)/.classes.list ] ; then $(CAT) $(TEMPDIR)/.classes.list; fi ) ; \
 161         fi
 162         @$(java-vm-cleanup)
 163 
 164 #
 165 # Packaging
 166 #
 167 mkpackaging: 
 168         $(RM) -r $(BEANCLASSDIR)/$(SWINGPKG)/beaninfo/images
 169         $(MKDIR) -p $(BEANCLASSDIR)/$(SWINGPKG)/beaninfo/images
 170         $(CP) $(DOCLETSRC)/beaninfo/images/*.gif $(BEANCLASSDIR)/$(SWINGPKG)/beaninfo/images
 171         $(BOOT_JAR_CMD) cf $(TEMPDIR)/tmp.jar \
 172              -C $(BEANCLASSDIR) javax \
 173              -C $(BEANCLASSDIR) sun \
 174              $(BOOT_JAR_JFLAGS)
 175         $(MV) $(TEMPDIR)/tmp.jar $(JDK_IMAGE_DIR)/lib/dt.jar
 176         @$(java-vm-cleanup)
 177 
 178 #
 179 # Cleanliness.
 180 #
 181 swingbeans.clean swingbeans.clobber::
 182         $(RM) -r 1.2src 1.2classes
 183         $(RM) -r java javax
 184         $(RM) *.class
 185         $(RM) $(TEMPDIR)/.beans.list $(TEMPDIR)/.classes.list beaninfo.jar
 186 
 187 #
 188 # Utility.
 189 #
 190 
 191 
 192 #
 193 # Debugging targets for looking at variables.
 194 #
 195 show-vars:
 196         @$(ECHO) FILES_beans = $(FILES_beans)
 197         @$(ECHO) FILES_bclass = $(FILES_bclass)
 198 
 199 .PRECIOUS: $(FILES_beans) 
 200 
 201 .PHONY: swing-1.2-beans swing-1.2-beans-debug \
 202         make-swing-beans mkdoclet .SwingBeanInfo mkbeaninfo .delete.beanlist \
 203         .javadoc.beanlist mkclasses .create.classlist .delete.classlist \
 204         .compile.classlist mkpackaging mkpackaging swingbeans.clean \
 205         swingbeans.clobber show-vars