J. Duke | 686d76f | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 1 | # |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 2 | # Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
J. Duke | 686d76f | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 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 |
Kelly O'Hair | 136614e | 2010-05-25 15:51:26 -0700 | [diff] [blame] | 7 | # published by the Free Software Foundation. Oracle designates this |
J. Duke | 686d76f | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 8 | # particular file as subject to the "Classpath" exception as provided |
Kelly O'Hair | 136614e | 2010-05-25 15:51:26 -0700 | [diff] [blame] | 9 | # by Oracle in the LICENSE file that accompanied this code. |
J. Duke | 686d76f | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 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 | # |
Kelly O'Hair | 136614e | 2010-05-25 15:51:26 -0700 | [diff] [blame] | 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. |
J. Duke | 686d76f | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 24 | # |
| 25 | |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 26 | ### |
| 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'Hair | 228c216 | 2012-09-18 11:29:16 -0700 | [diff] [blame] | 30 | |
Alan Burlison | 731eb07 | 2016-09-21 14:20:27 +0200 | [diff] [blame] | 31 | # The shell code below will be executed on /usr/bin/make on Solaris, but not in GNU Make. |
| 32 | # /usr/bin/make lacks basically every other flow control mechanism. |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 33 | .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 Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 34 | |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 35 | # The .FEATURES variable is likely to be unique for GNU Make. |
| 36 | ifeq ($(.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) |
| 40 | endif |
| 41 | |
| 42 | # Assume we have GNU Make, but check version. |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 43 | ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), ) |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 44 | $(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) |
| 47 | endif |
| 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). |
| 51 | ifneq ($(findstring :, $(MAKE)), ) |
| 52 | MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE))) |
Kelly O'Hair | ec348ed | 2013-01-04 21:04:03 -0800 | [diff] [blame] | 53 | endif |
| 54 | |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 55 | # Locate this Makefile |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 56 | ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),) |
| 57 | makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST))) |
Kelly O'Hair | fa892cf | 2008-08-06 14:57:13 -0700 | [diff] [blame] | 58 | else |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 59 | makefile_path := $(lastword $(MAKEFILE_LIST)) |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 60 | endif |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 61 | topdir := $(strip $(patsubst %/, %, $(dir $(makefile_path)))) |
Magnus Ihse Bursie | c4ced97 | 2014-11-27 15:41:56 +0100 | [diff] [blame] | 62 | |
Magnus Ihse Bursie | 1eb8d0b | 2015-03-26 16:17:30 +0100 | [diff] [blame] | 63 | # ... and then we can include the real makefile |
| 64 | include $(topdir)/make/Init.gmk |