blob: 2460cd414d84c1f93493f0ddd523dd8743720fd1 [file] [log] [blame]
J. Duke686d76f2007-12-01 00:00:00 +00001#
Magnus Ihse Bursie1eb8d0b2015-03-26 16:17:30 +01002# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
J. Duke686d76f2007-12-01 00:00:00 +00003# 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
Kelly O'Hair136614e2010-05-25 15:51:26 -07007# published by the Free Software Foundation. Oracle designates this
J. Duke686d76f2007-12-01 00:00:00 +00008# particular file as subject to the "Classpath" exception as provided
Kelly O'Hair136614e2010-05-25 15:51:26 -07009# by Oracle in the LICENSE file that accompanied this code.
J. Duke686d76f2007-12-01 00:00:00 +000010#
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#
Kelly O'Hair136614e2010-05-25 15:51:26 -070021# 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.
J. Duke686d76f2007-12-01 00:00:00 +000024#
25
Magnus Ihse Bursie1eb8d0b2015-03-26 16:17:30 +010026###
27### This file is just a very small wrapper needed to run the real make/Init.gmk.
28### It also performs some sanity checks on make.
29###
Kelly O'Hair228c2162012-09-18 11:29:16 -070030
Magnus Ihse Bursie1eb8d0b2015-03-26 16:17:30 +010031# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU Make.
Magnus Ihse Bursie1a8ec8e2013-11-14 10:53:23 +010032# /usr/ccs/bin/make lacks basically every other flow control mechanism.
Magnus Ihse Bursie1eb8d0b2015-03-26 16:17:30 +010033.TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU Make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
Magnus Ihse Bursie1a8ec8e2013-11-14 10:53:23 +010034
Magnus Ihse Bursie1eb8d0b2015-03-26 16:17:30 +010035# The .FEATURES variable is likely to be unique for GNU Make.
36ifeq ($(.FEATURES), )
37 $(info Error: '$(MAKE)' does not seem to be GNU Make, which is a requirement.)
38 $(info Check your path, or upgrade to GNU Make 3.81 or newer.)
39 $(error Cannot continue)
40endif
41
42# Assume we have GNU Make, but check version.
Magnus Ihse Bursie1a8ec8e2013-11-14 10:53:23 +010043ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
Magnus Ihse Bursie1eb8d0b2015-03-26 16:17:30 +010044 $(info Error: This version of GNU Make is too low ($(MAKE_VERSION)).)
45 $(info Check your path, or upgrade to GNU Make 3.81 or newer.)
46 $(error Cannot continue)
47endif
48
49# In Cygwin, the MAKE variable gets prepended with the current directory if the
50# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe).
51ifneq ($(findstring :, $(MAKE)), )
52 MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE)))
Kelly O'Hairec348ed2013-01-04 21:04:03 -080053endif
54
Magnus Ihse Bursie1a8ec8e2013-11-14 10:53:23 +010055# Locate this Makefile
Magnus Ihse Bursie1eb8d0b2015-03-26 16:17:30 +010056ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),)
57 makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST)))
Kelly O'Hairfa892cf2008-08-06 14:57:13 -070058else
Magnus Ihse Bursie1eb8d0b2015-03-26 16:17:30 +010059 makefile_path := $(lastword $(MAKEFILE_LIST))
Magnus Ihse Bursie1a8ec8e2013-11-14 10:53:23 +010060endif
Magnus Ihse Bursie1eb8d0b2015-03-26 16:17:30 +010061topdir := $(strip $(patsubst %/, %, $(dir $(makefile_path))))
Magnus Ihse Bursiec4ced972014-11-27 15:41:56 +010062
Magnus Ihse Bursie1eb8d0b2015-03-26 16:17:30 +010063# ... and then we can include the real makefile
64include $(topdir)/make/Init.gmk