make/devkit/Makefile
changeset 21759 e24e22311718
parent 20363 fa7663fc5d50
child 23428 3c8a05bf4656
equal deleted inserted replaced
21510:0b432ae58dd5 21759:e24e22311718
       
     1 #
       
     2 # Copyright (c) 2013, 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 #
       
    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
       
    30 # of building OpenJDK.
       
    31 #
       
    32 # In addition to the makefiles, access to Oracle Linux installation
       
    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
       
    35 # to directory containing the RPMs.
       
    36 #
       
    37 # By default this Makefile will build crosstools for:
       
    38 # * i686-unknown-linux-gnu
       
    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 #
       
    44 # To build the full set of crosstools, use a command line looking like this:
       
    45 #
       
    46 # make tars RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/
       
    47 #
       
    48 # To create a x86_64 package without the redundant i686 cross compiler, do
       
    49 # like this:
       
    50 #
       
    51 # make tars platforms=x86_64-unknown-linux-gnu RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/
       
    52 
       
    53 #
       
    54 # Main makefile which iterates over all host and target platforms.
       
    55 #
       
    56 
       
    57 os := $(shell uname -o)
       
    58 cpu := x86_64
       
    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 
       
    67 # Figure out what platform this is building on.
       
    68 me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu)
       
    69 
       
    70 $(info Building on platform $(me))
       
    71 
       
    72 all compile : $(platforms)
       
    73 
       
    74 ifeq (,$(SKIP_ME))
       
    75   $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
       
    76 endif
       
    77 
       
    78 OUTPUT_ROOT = $(abspath ../../../build/devkit)
       
    79 RESULT = $(OUTPUT_ROOT)/result
       
    80 
       
    81 submakevars = HOST=$@ BUILD=$(me) \
       
    82     RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \
       
    83     OUTPUT_ROOT=$(OUTPUT_ROOT)
       
    84 $(platforms) :
       
    85 	@echo 'Building compilers for $@'
       
    86 	@echo 'Targets: $(platforms)'
       
    87 	for p in $@ $(filter-out $@,$(platforms)); do \
       
    88 	  $(MAKE) -f Tools.gmk all $(submakevars) \
       
    89 	      TARGET=$$p || exit 1 ; \
       
    90 	done
       
    91 	@echo 'Building ccache program for $@'
       
    92 	$(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@
       
    93 	@echo 'All done"'
       
    94 
       
    95 $(foreach a,i686 x86_64,$(eval $(a) : $(filter $(a)%,$(platforms))))
       
    96 
       
    97 ia32 : i686
       
    98 today := $(shell date +%Y%m%d)
       
    99 
       
   100 
       
   101 define Mktar
       
   102   $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz
       
   103   $$($(1)_tar) : PLATFORM = $(1)
       
   104   TARFILES += $$($(1)_tar)
       
   105   $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1))
       
   106 endef
       
   107 
       
   108 $(foreach p,$(platforms),$(eval $(call Mktar,$(p))))
       
   109 
       
   110 tars : all $(TARFILES)
       
   111 onlytars : $(TARFILES)
       
   112 %.tar.gz :
       
   113 	@echo 'Creating compiler package $@'
       
   114 	cd $(RESULT)/$(PLATFORM) && tar -czf $@ *
       
   115 	touch $@
       
   116 
       
   117 clean :
       
   118 	rm -rf build result
       
   119 
       
   120 FORCE :
       
   121 .PHONY : $(configs) $(platforms)