jdk/makefiles/Makefile
changeset 14231 a0c23c1c010f
parent 13702 efd6a05935b2
child 20547 453837141fac
equal deleted inserted replaced
14104:8d9d430b4244 14231:a0c23c1c010f
     1 #
     1 #
     2 # Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2012, Oracle and/or its affiliates. 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.  Oracle designates this
     7 # published by the Free Software Foundation.  Oracle designates this
    21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    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
    22 # or visit www.oracle.com if you need additional information or have any
    23 # questions.
    23 # questions.
    24 #
    24 #
    25 
    25 
    26 # This must be the first rule
    26 # Locate this Makefile
    27 default: all
    27 ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
       
    28     makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
       
    29 else
       
    30     makefile_path:=$(lastword $(MAKEFILE_LIST))
       
    31 endif
       
    32 repo_dir:=$(patsubst %/makefiles/Makefile,%,$(makefile_path))
    28 
    33 
    29 # Inclusion of this pseudo-target will cause make to execute this file
    34 # What is the name of this subsystem (langtools, corba, etc)?
    30 # serially, regardless of -j. Recursively called makefiles will not be
    35 subsystem_name:=$(notdir $(repo_dir))
    31 # affected, however. This is required for correct dependency management.
       
    32 .NOTPARALLEL:
       
    33 
    36 
    34 include $(SPEC)
    37 # Try to locate top-level makefile
    35 include MakeBase.gmk
    38 top_level_makefile:=$(repo_dir)/../common/makefiles/Makefile
    36 include JavaCompilation.gmk
    39 ifneq ($(wildcard $(top_level_makefile)),)
    37 include NativeCompilation.gmk
    40   $(info Will run $(subsystem_name) target on top-level Makefile)
    38 
    41   $(info WARNING: This is a non-recommended way of building!)
    39 # Setup the java compilers for the JDK build.
    42   $(info ===================================================)
    40 include Setup.gmk
    43 else
    41 
    44   $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?)
    42 # Setup the build tools.
    45   $(error Build from top-level Makefile instead)
    43 include Tools.gmk
       
    44 
       
    45 import: $(BUILD_TOOLS) import-only
       
    46 import-only:
       
    47 #       Import (corba jaxp jaxws langtools hotspot)
       
    48 	+$(MAKE) -f Import.gmk
       
    49 
       
    50 gensrc: import gensrc-only
       
    51 gensrc-only:
       
    52 	+$(MAKE) -f GenerateJavaSources.gmk
       
    53 #       Ok, now gensrc is fully populated.
       
    54 
       
    55 gendata: gensrc gendata-only
       
    56 gendata-only:
       
    57 	+$(MAKE) -f GenerateData.gmk
       
    58 
       
    59 classes: gendata classes-only
       
    60 classes-only:
       
    61 	+$(MAKE) -f CompileJavaClasses.gmk
       
    62 #       The classes are now built and
       
    63 #       any javah files have now been generated.
       
    64 
       
    65 libs: classes libs-only
       
    66 libs-only:
       
    67 	+$(MAKE) -f CompileNativeLibraries.gmk
       
    68 
       
    69 launchers: libs launchers-only
       
    70 launchers-only:
       
    71 #       Finally compile the launchers.
       
    72 	+$(MAKE) -f CompileLaunchers.gmk
       
    73 
       
    74 genclasses: launchers genclasses-only
       
    75 genclasses-only:
       
    76 #	Generate classes that have other sources. Needs
       
    77 #       to execute launchers.
       
    78 	+$(MAKE) -f GenerateClasses.gmk
       
    79 
       
    80 demos: genclasses demos-only
       
    81 demos-only:
       
    82 #       Now we have a complete jdk, which you can run.
       
    83 #       It is not yet wrapped up as an installed image.
       
    84 #       The demos are compiled against this jdk.
       
    85 ifndef NO_DEMOS
       
    86 	+$(MAKE) -f CompileDemos.gmk
       
    87 endif
    46 endif
    88 
    47 
    89 samples: demos samples-only
    48 all:
    90 samples-only:
    49 	@$(MAKE) -f $(top_level_makefile) $(subsystem_name)
    91 #	Now copy the sample sources into the jdk.
       
    92 ifndef NO_SAMPLES
       
    93 	+$(MAKE) -f CopySamples.gmk
       
    94 endif
       
    95 
       
    96 # The all target builds the JDK, but not the images
       
    97 all: import gensrc gendata classes libs launchers genclasses demos samples
       
    98 
       
    99 .PHONY: all images install overlay-images import-only gensrc-only gendata-only classes-only 
       
   100 .PHONY: libs-only launchers-only genclasses-only demos-only samples-only
       
   101 
       
   102 # Create the final jdk and jre images, to be wrapped up
       
   103 # into packages, or installed.
       
   104 images:
       
   105 	+$(MAKE) -f CreateJars.gmk
       
   106 	+$(MAKE) -f Images.gmk 
       
   107 
       
   108 overlay-images:
       
   109 	+$(MAKE) -f CompileLaunchers.gmk OVERLAY_IMAGES=true
       
   110 	+$(MAKE) -f Images.gmk overlay-images
       
   111 
       
   112 BINARIES:=$(shell if test -d $(IMAGES_OUTPUTDIR)/j2sdk-image/bin; then cd $(IMAGES_OUTPUTDIR)/j2sdk-image/bin && $(LS) ; fi)
       
   113 INSTALLDIR:=openjdk-$(RELEASE)
       
   114 
       
   115 # Install the jdk image, in a very crude way. Not taking into
       
   116 # account, how to install properly on macosx or windows etc.
       
   117 install: images
       
   118 	echo Installing jdk image into $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
       
   119 	echo and creating $(words $(BINARIES)) links from $(INSTALL_PREFIX)/bin into the jdk.
       
   120 	$(MKDIR) -p $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
       
   121 	$(RM) -r $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)/*
       
   122 	$(CP) -rp $(IMAGES_OUTPUTDIR)/j2sdk-image/* $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
       
   123 	$(RM) $(addprefix $(INSTALL_PREFIX)/bin/,$(BINARIES))
       
   124 	$(foreach b,$(BINARIES),$(LN) -s $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)/bin/$b $(INSTALL_PREFIX)/bin/$b &&) true