make/devkit/Makefile
changeset 48839 042834d56fbf
parent 47253 92fd0e04e0e1
child 49204 564802b01ded
equal deleted inserted replaced
48838:27621e6afcc8 48839:042834d56fbf
     1 #
     1 #
     2 # Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2013, 2018, 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 ##########################################################################################
    26 ################################################################################
    27 #
    27 #
    28 # This Makefile, together with Tools.gmk, can be used to compile a set of
    28 # This Makefile, together with Tools.gmk, can be used to compile a set of
    29 # gcc based cross compilation, portable, self contained packages, capable
    29 # gcc based cross compilation, portable, self contained packages, capable
    30 # of building OpenJDK.
    30 # of building OpenJDK.
    31 #
    31 #
    32 # In addition to the makefiles, access to Oracle Linux installation
    32 # In addition to the makefiles, access to Oracle Linux installation
    33 # media is required. This has been tested against Oracle Enterprise Linux
    33 # media is required. This has been tested against Oracle Enterprise Linux
    34 # 5.5. Set variables RPM_DIR_x86_64 and RPM_DIR_i686 respectively to point
    34 # 6.4.
    35 # to directory containing the RPMs.
       
    36 #
    35 #
    37 # By default this Makefile will build crosstools for:
    36 # By default this Makefile will build a native toolchain for the current
    38 # * i686-unknown-linux-gnu
    37 # platform if called with something like this:
    39 # * x86_64-unknown-linux-gnu
       
    40 # The x86_64 version of the compilers will work in multi arch mode and will
       
    41 # be able to compile 32bit binaries with the -m32 flag. This makes the
       
    42 # explicit cross compiler for i686 somewhat redundant and is a known issue.
       
    43 #
    38 #
    44 # To build the full set of crosstools, use a command line looking like this:
    39 # make tars
    45 #
    40 #
    46 # make tars RPM_DIR_x86_64=/tmp/oel64-x86_64/Packages/ RPM_DIR_i686=/tmp/oel64-i686/Packages/
    41 # To build the full set of crosstools for additional platforms, use a command
       
    42 # line looking like this:
    47 #
    43 #
    48 # To create a x86_64 package without the redundant i686 cross compiler, do
    44 # make tars platforms="x86_64-unknown-linux-gnu sparc64-unknown-linux-gnu"
    49 # like this:
       
    50 #
    45 #
    51 # make tars platforms=x86_64-unknown-linux-gnu RPM_DIR_x86_64=/tmp/oel64-x86_64/Packages/ RPM_DIR_i686=/tmp/oel64-i686/Packages/
    46 # This is the makefile which iterates over all host and target platforms.
    52 
       
    53 #
       
    54 # Main makefile which iterates over all host and target platforms.
       
    55 #
    47 #
    56 
    48 
    57 os := $(shell uname -o)
    49 os := $(shell uname -o)
    58 cpu := x86_64
    50 cpu := $(shell uname -p)
    59 #$(shell uname -p)
       
    60 
       
    61 #
       
    62 # This wrapper script can handle exactly these platforms
       
    63 #
       
    64 platforms := $(foreach p,x86_64 i686,$(p)-unknown-linux-gnu)
       
    65 #platforms := $(foreach p,x86_64,$(p)-unknown-linux-gnu)
       
    66 
    51 
    67 # Figure out what platform this is building on.
    52 # Figure out what platform this is building on.
    68 me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu)
    53 me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu)
    69 
    54 
    70 $(info Building on platform $(me))
    55 $(info Building on platform $(me))
       
    56 
       
    57 #
       
    58 # By default just build for the current platform, which is assumed to be Linux
       
    59 #
       
    60 platforms := $(me)
       
    61 host_platforms := $(platforms)
       
    62 target_platforms := $(platforms)
       
    63 $(info host_platforms $(host_platforms))
       
    64 $(info target_platforms $(target_platforms))
    71 
    65 
    72 all compile : $(platforms)
    66 all compile : $(platforms)
    73 
    67 
    74 ifeq (,$(SKIP_ME))
    68 ifeq (,$(SKIP_ME))
    75   $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
    69   $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
    76 endif
    70 endif
    77 
    71 
    78 OUTPUTDIR = $(abspath ../../build/devkit)
    72 OUTPUT_ROOT = $(abspath ../../build/devkit)
    79 RESULT = $(OUTPUTDIR)/result
    73 RESULT = $(OUTPUT_ROOT)/result
    80 
    74 
    81 submakevars = HOST=$@ BUILD=$(me) \
    75 submakevars = HOST=$@ BUILD=$(me) \
    82     RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \
    76     RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \
    83     OUTPUTDIR=$(OUTPUTDIR)
    77     OUTPUT_ROOT=$(OUTPUT_ROOT)
    84 $(platforms) :
    78 $(host_platforms) :
    85 	@echo 'Building compilers for $@'
    79 	@echo 'Building compilers for $@'
    86 	@echo 'Targets: $(platforms)'
    80 	@echo 'Targets: $(target_platforms)'
    87 	for p in $@ $(filter-out $@,$(platforms)); do \
    81 	for p in $(filter $@, $(target_platforms)) $(filter-out $@, $(target_platforms)); do \
       
    82 	  $(MAKE) -f Tools.gmk download-rpms $(submakevars) TARGET=$$p && \
    88 	  $(MAKE) -f Tools.gmk all $(submakevars) \
    83 	  $(MAKE) -f Tools.gmk all $(submakevars) \
    89 	      TARGET=$$p || exit 1 ; \
    84 	      TARGET=$$p || exit 1 ; \
    90 	done
    85 	done
    91 	@echo 'Building ccache program for $@'
    86 	@echo 'Building ccache program for $@'
    92 	$(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@
    87 	$(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@
    93 	@echo 'All done"'
    88 	@echo 'All done"'
    94 
    89 
    95 $(foreach a,i686 x86_64,$(eval $(a) : $(filter $(a)%,$(platforms))))
       
    96 
       
    97 ia32 : i686
       
    98 today := $(shell date +%Y%m%d)
    90 today := $(shell date +%Y%m%d)
    99 
       
   100 
    91 
   101 define Mktar
    92 define Mktar
   102   $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz
    93   $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz
   103   $$($(1)_tar) : PLATFORM = $(1)
    94   $$($(1)_tar) : PLATFORM = $(1)
   104   TARFILES += $$($(1)_tar)
    95   TARFILES += $$($(1)_tar)
   105   $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1))
    96   $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1))
   106 endef
    97 endef
   107 
    98 
   108 $(foreach p,$(platforms),$(eval $(call Mktar,$(p))))
    99 $(foreach p,$(host_platforms),$(eval $(call Mktar,$(p))))
   109 
   100 
   110 tars : all $(TARFILES)
   101 tars : all $(TARFILES)
   111 onlytars : $(TARFILES)
   102 onlytars : $(TARFILES)
   112 %.tar.gz :
   103 %.tar.gz :
   113 	@echo 'Creating compiler package $@'
   104 	@echo 'Creating compiler package $@'
   114 	cd $(RESULT)/$(PLATFORM) && tar -czf $@ *
   105 	cd $(RESULT)/$(PLATFORM) && tar -czf $@ *
   115 	touch $@
   106 	touch $@
   116 
   107 
   117 clean :
   108 clean :
   118 	rm -rf build result
   109 	rm -rf $(addprefix ../../build/devkit/, result $(host_platforms))
       
   110 dist-clean: clean
       
   111 	rm -rf $(addprefix ../../build/devkit/, src download)
   119 
   112 
   120 FORCE :
   113 FORCE :
   121 .PHONY : $(configs) $(platforms)
   114 .PHONY : all compile tars $(configs) $(host_platforms) clean dist-clean