1 #
   2 # Copyright (c) 2012, 2015, 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 ### 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 ###
  30 
  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.
  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
  34 
  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.
  43 ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
  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)))
  53 endif
  54 
  55 # Locate this Makefile
  56 ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),)
  57   makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST)))
  58 else
  59   makefile_path := $(lastword $(MAKEFILE_LIST))
  60 endif
  61 topdir := $(strip $(patsubst %/, %, $(dir $(makefile_path))))
  62 
  63 # ... and then we can include the real makefile
  64 include $(topdir)/make/Init.gmk