common/makefiles/devkit/Makefile

changeset 740
c0fa87863427
child 839
174a54ce39c4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/makefiles/devkit/Makefile	Tue Jun 18 11:30:36 2013 +0200
     1.3 @@ -0,0 +1,123 @@
     1.4 +#
     1.5 +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Oracle designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Oracle in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 +# or visit www.oracle.com if you need additional information or have any
    1.26 +# questions.
    1.27 +#
    1.28 +
    1.29 +##########################################################################################
    1.30 +#
    1.31 +# This Makefile, together with Tools.gmk, can be used to compile a set of 
    1.32 +# gcc based cross compilation, portable, self contained packages, capable 
    1.33 +# of building OpenJDK.
    1.34 +# 
    1.35 +# In addition to the makefiles, access to Oracle Linux installation 
    1.36 +# media is required. This has been tested against Oracle Enterprise Linux 
    1.37 +# 5.5. Set variables RPM_DIR_x86_64 and RPM_DIR_i686 respectively to point
    1.38 +# to directory containing the RPMs.
    1.39 +#
    1.40 +# By default this Makefile will build crosstools for:
    1.41 +# * i686-unknown-linux-gnu
    1.42 +# * x86_64-unknown-linux-gnu
    1.43 +# The x86_64 version of the compilers will work in multi arch mode and will
    1.44 +# be able to compile 32bit binaries with the -m32 flag. This makes the
    1.45 +# explicit cross compiler for i686 somewhat redundant and is a known issue.
    1.46 +#
    1.47 +# To build the full set of crosstools, use a command line looking like this:
    1.48 +#
    1.49 +# make tars  RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/
    1.50 +#
    1.51 +# To create a x86_64 package without the redundant i686 cross compiler, do 
    1.52 +# like this:
    1.53 +#
    1.54 +# make tars platforms=x86_64-unknown-linux-gnu RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/
    1.55 +
    1.56 +#
    1.57 +# Main makefile which iterates over all host and target platforms.
    1.58 +#
    1.59 +
    1.60 +os		:= $(shell uname -o)
    1.61 +cpu 		:= x86_64
    1.62 +#$(shell uname -p)
    1.63 +
    1.64 +#
    1.65 +# This wrapper script can handle exactly these platforms
    1.66 +#
    1.67 +platforms	:= $(foreach p,x86_64 i686,$(p)-unknown-linux-gnu)
    1.68 +#platforms	:= $(foreach p,x86_64,$(p)-unknown-linux-gnu)
    1.69 +
    1.70 +# Figure out what platform this is building on.
    1.71 +me		:= $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu)
    1.72 +
    1.73 +$(info Building on platform $(me))
    1.74 +
    1.75 +all compile	: $(platforms)
    1.76 +
    1.77 +ifeq (,$(SKIP_ME))
    1.78 +$(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
    1.79 +endif
    1.80 +
    1.81 +OUTPUT_ROOT	= $(abspath ../../../build/devkit)
    1.82 +RESULT		= $(OUTPUT_ROOT)/result
    1.83 +
    1.84 +submakevars	= HOST=$@ BUILD=$(me)				\
    1.85 +			RESULT=$(RESULT) PREFIX=$(RESULT)/$@    \
    1.86 +			OUTPUT_ROOT=$(OUTPUT_ROOT)
    1.87 +$(platforms)	:
    1.88 +		@echo 'Building compilers for $@'
    1.89 +		@echo 'Targets: $(platforms)'
    1.90 +		for p in $@ $(filter-out $@,$(platforms)); do	\
    1.91 +			$(MAKE) -f Tools.gmk all $(submakevars)	\
    1.92 +				TARGET=$$p || exit 1	;	\
    1.93 +		done
    1.94 +		@echo 'Building ccache program for $@'
    1.95 +		$(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@
    1.96 +		@echo 'All done"'
    1.97 +
    1.98 +$(foreach a,i686 x86_64,$(eval $(a) : $(filter $(a)%,$(platforms))))
    1.99 +
   1.100 +ia32		:  i686
   1.101 +today		:= $(shell date +%Y%m%d)
   1.102 +
   1.103 +
   1.104 +define Mktar
   1.105 +$(1)_tar	= $$(RESULT)/sdk-$(1)-$$(today).tar.gz
   1.106 +$$($(1)_tar)	: PLATFORM = $(1)
   1.107 +TARFILES	+= $$($(1)_tar)
   1.108 +$$($(1)_tar)	: $(1) $$(shell find $$(RESULT)/$(1))
   1.109 +endef
   1.110 +
   1.111 +$(foreach p,$(platforms),$(eval $(call Mktar,$(p))))
   1.112 +
   1.113 +tars		: all $(TARFILES)
   1.114 +onlytars	: $(TARFILES)
   1.115 +%.tar.gz	:
   1.116 +		@echo 'Creating compiler package $@'
   1.117 +		cd $(RESULT)/$(PLATFORM) && tar -czf $@ *
   1.118 +		touch $@
   1.119 +
   1.120 +clean		:
   1.121 +	rm -rf build result
   1.122 +
   1.123 +FORCE		:
   1.124 +.PHONY		: $(configs) $(platforms)
   1.125 +
   1.126 +

mercurial