jdk/make/javax/crypto/Makefile
changeset 3353 ddbd63234844
parent 3332 b9c68d909f98
child 4665 d14dc3d9e1fa
equal deleted inserted replaced
3333:111dede48a15 3353:ddbd63234844
     1 #
     1 #
     2 # Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
     2 # Copyright 2007-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     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
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Sun designates this
     7 # published by the Free Software Foundation.  Sun designates this
    42 # sure any implicit compilations didn't use any incorrect flags.
    42 # sure any implicit compilations didn't use any incorrect flags.
    43 #
    43 #
    44 # For OpenJDK, the jar files built here are installed directly into the
    44 # For OpenJDK, the jar files built here are installed directly into the
    45 # OpenJDK.
    45 # OpenJDK.
    46 #
    46 #
    47 # For JDK, the binaries use pre-built/pre-signed/pre-obfuscated binary
    47 # For JDK, the binaries use pre-built/pre-signed binary files stored in
    48 # files stored in the closed workspace that are not shipped in the
    48 # the closed workspace that are not shipped in the OpenJDK workspaces.
    49 # OpenJDK workspaces.  We still build the JDK files here to verify the
    49 # We still build the JDK files here to verify the files compile, and in
    50 # files compile, and in preparation for possible signing and
    50 # preparation for possible signing.  Developers working on JCE in JDK
    51 # obfuscation.  Developers working on JCE in JDK must sign the JCE files
    51 # must sign the JCE files before testing.  The JCE signing key is kept
    52 # before testing: obfuscation is optional during development.  The JCE
    52 # separate from the JDK workspace to prevent its disclosure.
    53 # signing key is kept separate from the JDK workspace to prevent its
       
    54 # disclosure.  The obfuscation tool has not been licensed for general
       
    55 # usage.
       
    56 #
    53 #
    57 # SPECIAL NOTE TO JCE/JDK developers:  The source files must eventually
    54 # SPECIAL NOTE TO JCE/JDK developers:  The source files must eventually
    58 # be built, obfuscated, signed, and the resulting jar files *MUST BE
    55 # be built and signed, and the resulting jar files *MUST BE CHECKED INTO
    59 # CHECKED INTO THE CLOSED PART OF THE WORKSPACE*.  This separate step
    56 # THE CLOSED PART OF THE WORKSPACE*.  This separate step *MUST NOT BE
    60 # *MUST NOT BE FORGOTTEN*, otherwise a bug fixed in the source code will
    57 # FORGOTTEN*, otherwise a bug fixed in the source code will not be
    61 # not be reflected in the shipped binaries.  The "release" target should
    58 # reflected in the shipped binaries.  The "release" target should be
    62 # be used to generate the required files.
    59 # used to generate the required files.
    63 #
    60 #
    64 # There are a number of targets to help both JDK/OpenJDK developers.
    61 # There are a number of targets to help both JDK/OpenJDK developers.
    65 #
    62 #
    66 # Main Targets (JDK/OPENJDK):
    63 # Main Targets (JDK/OPENJDK):
    67 #
    64 #
    68 #     all/clobber/clean		The usual.
    65 #     all/clobber/clean        The usual.
    69 #				    If OpenJDK, installs
    66 #                                  If OpenJDK: builds/installs the
    70 #					jce.jar/limited policy files.
    67 #                                      jce.jar/limited policy files.
    71 #				    If JDK, installs prebuilt
    68 #                                  If JDK: builds but does not install.
    72 #					jce.jar/limited policy files.
    69 #                                     During full tops-down builds,
    73 #
    70 #                                     prebuilt/presigned jce.jar &
    74 #     jar			Builds/installs jce.jar
    71 #                                     limited policy files are copied
    75 #				    If OpenJDK, does not sign
    72 #                                     in by make/java/redist/Makefile.
    76 #				    If JDK, tries to sign
    73 #                                     If you are working in this directory
       
    74 #                                     and want to install the prebuilts,
       
    75 #                                     use the "install-prebuilt" target.
       
    76 #
       
    77 #     jar                      Builds/installs jce.jar
       
    78 #                                  If OpenJDK, does not sign
       
    79 #                                  If JDK, tries to sign
    77 #
    80 #
    78 # Other lesser-used Targets (JDK/OPENJDK):
    81 # Other lesser-used Targets (JDK/OPENJDK):
    79 #
    82 #
    80 #     build-jar			Builds jce.jar (does not sign/install)
    83 #     build-jar                Builds jce.jar (does not sign/install)
    81 #
    84 #
    82 #     build-policy		Builds policy files (does not sign/install)
    85 #     build-policy             Builds policy files (does not sign/install)
    83 #
    86 #
    84 #     install-jar		Alias for "jar" above
    87 #     install-jar              Alias for "jar" above
    85 #
    88 #
    86 #     install-limited		Builds/installs limited policy files
    89 #     install-limited          Builds/installs limited policy files
    87 #				    If OpenJDK, does not sign
    90 #                                  If OpenJDK, does not sign
    88 #				    If JDK, tries to sign
    91 #                                  If JDK, tries to sign
    89 #     install-unlimited		Builds/nstalls unlimited policy files
    92 #     install-unlimited        Builds/nstalls unlimited policy files
    90 #				    If OpenJDK, does not sign
    93 #                                  If OpenJDK, does not sign
    91 #				    If JDK, tries to sign
    94 #                                  If JDK, tries to sign
    92 #
    95 #
    93 # Other targets (JDK only):
    96 # Other targets (JDK only):
    94 #
    97 #
    95 #     sign			Alias for sign-jar and sign-policy
    98 #     sign                     Alias for sign-jar and sign-policy
    96 #	  sign-jar		Builds/signs jce.jar file (no install)
    99 #          sign-jar            Builds/signs jce.jar file (no install)
    97 #	  sign-policy		Builds/signs policy files (no install)
   100 #          sign-policy         Builds/signs policy files (no install)
    98 #
   101 #
    99 #     obfus			Builds/obfuscates/signs jce.jar
   102 #     release                  Builds all targets in preparation
   100 #
   103 #                              for workspace integration.
   101 #     release			Builds all targets in preparation
   104 #
   102 #				for workspace integration.
   105 #     install-prebuilt         Installs the pre-built jar files
   103 #
       
   104 #     install-prebuilt		Installs the pre-built jar files
       
   105 #
   106 #
   106 # This makefile was written to support parallel target execution.
   107 # This makefile was written to support parallel target execution.
   107 #
   108 #
   108 
   109 
   109 BUILDDIR = ../..
   110 BUILDDIR = ../..
   110 PACKAGE = javax.crypto
   111 PACKAGE = javax.crypto
   111 PRODUCT = sun
   112 PRODUCT = sun
   112 
   113 
   113 #
   114 #
   114 # The following is for when we need to do postprocessing
   115 # The following is for when we need to do postprocessing
   115 # (signing/obfuscation) against a read-only build.  If the OUTPUTDIR
   116 # (signing) against a read-only build.  If the OUTPUTDIR
   116 # isn't writable, the build currently crashes out.
   117 # isn't writable, the build currently crashes out.
   117 #
   118 #
   118 ifndef OPENJDK
   119 ifndef OPENJDK
   119   ifdef ALT_JCE_BUILD_DIR
   120   ifdef ALT_JCE_BUILD_DIR
   120     # =====================================================
   121     # =====================================================
   167 endif # OPENJDK
   168 endif # OPENJDK
   168 
   169 
   169 #
   170 #
   170 # We use a variety of subdirectories in the $(TEMPDIR) depending on what
   171 # We use a variety of subdirectories in the $(TEMPDIR) depending on what
   171 # part of the build we're doing.  Both OPENJDK/JDK builds are initially
   172 # part of the build we're doing.  Both OPENJDK/JDK builds are initially
   172 # done in the unsigned area.  When files are signed or obfuscated in JDK,
   173 # done in the unsigned area.  When files are signed in JDK, they will be
   173 # they will be placed in the appropriate areas.
   174 # placed in the appropriate areas.
   174 #
   175 #
   175 UNSIGNED_DIR = $(TEMPDIR)/unsigned
   176 UNSIGNED_DIR = $(TEMPDIR)/unsigned
   176 
   177 
   177 include Defs-jce.gmk
   178 include Defs-jce.gmk
   178 
   179 
   179 
   180 
   180 # =====================================================
   181 # =====================================================
   181 # Build the unsigned jce.jar file.  Signing/obfuscation comes later.
   182 # Build the unsigned jce.jar file.  Signing comes later.
   182 #
   183 #
   183 
   184 
   184 JAR_DESTFILE = $(LIBDIR)/jce.jar
   185 JAR_DESTFILE = $(LIBDIR)/jce.jar
   185 
   186 
   186 #
   187 #
   361 	    $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar
   362 	    $(UNSIGNED_POLICY_BUILDDIR)/limited/local_policy.jar
   362 	$(call sign-file, $<)
   363 	$(call sign-file, $<)
   363 
   364 
   364 
   365 
   365 # =====================================================
   366 # =====================================================
   366 # Obfuscate/sign/install the JDK build.  Not needed for OpenJDK.
   367 # Create the Release Engineering files.  Signed builds,
   367 #
   368 # unlimited policy file distribution, etc.
   368 
   369 #
   369 OBFUS_DIR = $(JCE_BUILD_DIR)/obfus/jce
       
   370 
   370 
   371 CLOSED_DIR = $(BUILDDIR)/closed/javax/crypto
   371 CLOSED_DIR = $(BUILDDIR)/closed/javax/crypto
   372 
   372 
   373 obfus: $(OBFUS_DIR)/jce.jar
   373 release: $(SIGNED_DIR)/jce.jar sign-policy $(CLOSED_DIR)/doc/COPYRIGHT.html \
   374 	$(release-warning)
       
   375 
       
   376 ifndef ALT_JCE_BUILD_DIR
       
   377 $(OBFUS_DIR)/jce.jar: build-jar $(JCE_MANIFEST_FILE) $(OBFUS_DIR)/framework.dox
       
   378 else
       
   379 #
       
   380 # We have to remove the build dependency, otherwise, we'll try to rebuild it
       
   381 # which we can't do on a read-only filesystem.
       
   382 #
       
   383 $(OBFUS_DIR)/jce.jar: $(JCE_MANIFEST_FILE) $(OBFUS_DIR)/framework.dox
       
   384 	@if [ ! -d $(CLASSDESTDIR) ] ; then \
       
   385 	    $(ECHO) "Couldn't find $(CLASSDESTDIR)"; \
       
   386 	    exit 1; \
       
   387 	fi
       
   388 endif
       
   389 	@$(ECHO) ">>>Obfuscating JCE framework..."
       
   390 	$(presign)
       
   391 	$(preobfus)
       
   392 	$(prep-target)
       
   393 	$(CD) $(OBFUS_DIR); \
       
   394 	$(OBFUSCATOR) -fv framework.dox
       
   395 	@$(CD) $(OBFUS_DIR); $(java-vm-cleanup)
       
   396 	@#
       
   397 	@# The sun.security.internal classes are currently not obfuscated
       
   398 	@# due to an obfus problem. Manually copy them to the build directory
       
   399 	@# so that they are included in the jce.jar file.
       
   400 	@#
       
   401 	$(CP) -r $(CLASSDESTDIR)/sun $(OBFUS_DIR)/build
       
   402 	$(BOOT_JAR_CMD) cmf $(JCE_MANIFEST_FILE) $@	\
       
   403 	    -C $(OBFUS_DIR)/build javax			\
       
   404 	    -C $(OBFUS_DIR)/build sun			\
       
   405 	    $(BOOT_JAR_JFLAGS)
       
   406 	$(sign-target)
       
   407 	@$(java-vm-cleanup)
       
   408 
       
   409 $(OBFUS_DIR)/framework.dox: $(CLOSED_DIR)/obfus/framework.dox
       
   410 	@$(ECHO) ">>>Creating framework.dox"
       
   411 	$(prep-target)
       
   412 	$(SED) "s:@@TEMPDIR@@:$(ABS_TEMPDIR):" $< > $@
       
   413 
       
   414 #
       
   415 # The current obfuscator has a limitation in that it currently only
       
   416 # supports up to v49 class file format.  Force v49 classfiles in our
       
   417 # builds for now.
       
   418 #
       
   419 SOURCE_LANGUAGE_VERSION = 5
       
   420 TARGET_CLASS_VERSION = 5
       
   421 
       
   422 
       
   423 # =====================================================
       
   424 # Create the Release Engineering files.  Obfuscated builds,
       
   425 # unlimited policy file distribution, etc.
       
   426 #
       
   427 
       
   428 release: $(OBFUS_DIR)/jce.jar sign-policy $(CLOSED_DIR)/doc/COPYRIGHT.html \
       
   429          $(CLOSED_DIR)/doc/README.txt
   374          $(CLOSED_DIR)/doc/README.txt
   430 	$(RM) -r \
   375 	$(RM) -r \
   431 	    $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy              \
   376 	    $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy              \
   432 	    $(JCE_BUILD_DIR)/release/jce.jar                         \
   377 	    $(JCE_BUILD_DIR)/release/jce.jar                         \
   433 	    $(JCE_BUILD_DIR)/release/US_export_policy.jar            \
   378 	    $(JCE_BUILD_DIR)/release/US_export_policy.jar            \
   434 	    $(JCE_BUILD_DIR)/release/local_policy.jar                \
   379 	    $(JCE_BUILD_DIR)/release/local_policy.jar                \
   435 	    $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy.zip
   380 	    $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy.zip
   436 	$(MKDIR) -p $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy
   381 	$(MKDIR) -p $(JCE_BUILD_DIR)/release/UnlimitedJCEPolicy
   437 	$(CP) $(OBFUS_DIR)/jce.jar $(JCE_BUILD_DIR)/release
   382 	$(CP) $(SIGNED_DIR)/jce.jar $(JCE_BUILD_DIR)/release
   438 	$(CP) \
   383 	$(CP) \
   439 	    $(SIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar   \
   384 	    $(SIGNED_POLICY_BUILDDIR)/limited/US_export_policy.jar   \
   440 	    $(SIGNED_POLICY_BUILDDIR)/limited/local_policy.jar       \
   385 	    $(SIGNED_POLICY_BUILDDIR)/limited/local_policy.jar       \
   441 	    $(JCE_BUILD_DIR)/release
   386 	    $(JCE_BUILD_DIR)/release
   442 	$(CP) \
   387 	$(CP) \
   528 	    $(JCE_BUILD_DIR)
   473 	    $(JCE_BUILD_DIR)
   529 
   474 
   530 .PHONY: build-jar jar build-policy unlimited limited install-jar \
   475 .PHONY: build-jar jar build-policy unlimited limited install-jar \
   531 	install-limited install-unlimited
   476 	install-limited install-unlimited
   532 ifndef OPENJDK
   477 ifndef OPENJDK
   533 .PHONY: sign sign-jar sign-policy obfus release install-prebuilt
   478 .PHONY: sign sign-jar sign-policy release install-prebuilt
   534 endif
   479 endif