1 #
   2 # Copyright (c) 2012, 2016, 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 # This code will cause FreeBSD make to print an error message and abort, 
  32 # but GNU Make will treat it as a variable assignment
  33 .error ===You are not using GNU Make/gmake, this is a requirement. Check your path.===
  34 
  35 # The shell code below will be executed on /usr/ccs/bin/make on Solaris and 
  36 # by OpenBSD make, but not in GNU Make.
  37 # /usr/ccs/bin/make lacks basically every other flow control mechanism.
  38 .TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU Make/gmake, this is a requirement. Check your path. 1>&2
  39 
  40 # This will make the rest of the file part of a conditional block on BSD make,
  41 # but GNU Make will treat it as an assignment.
  42 .if =GNU_ONLY
  43 
  44 # This will cause /usr/ccs/bin/make on Solaris to exit.
  45 .TEST_FOR_NON_GNUMAKE:sh=exit 1
  46 
  47 ### Now we can be reasonably sure we're actually running GNU Make.
  48 
  49 # The .FEATURES variable is likely to be unique for GNU Make.
  50 ifeq ($(.FEATURES), )
  51   $(info Error: '$(MAKE)' does not seem to be GNU Make, which is a requirement.)
  52   $(info Check your path, or upgrade to GNU Make 3.81 or newer.)
  53   $(error Cannot continue)
  54 endif
  55 
  56 # Assume we have GNU Make, but check version.
  57 ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
  58   $(info Error: This version of GNU Make is too low ($(MAKE_VERSION)).)
  59   $(info Check your path, or upgrade to GNU Make 3.81 or newer.)
  60   $(error Cannot continue)
  61 endif
  62 
  63 # In Cygwin, the MAKE variable gets prepended with the current directory if the
  64 # make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe).
  65 ifneq ($(findstring :, $(MAKE)), )
  66   MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE)))
  67 endif
  68 
  69 # Locate this Makefile
  70 ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),)
  71   makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST)))
  72 else
  73   makefile_path := $(lastword $(MAKEFILE_LIST))
  74 endif
  75 topdir := $(strip $(patsubst %/, %, $(dir $(makefile_path))))
  76 
  77 # ... and then we can include the real makefile
  78 include $(topdir)/make/Init.gmk
  79 
  80 .endif =GNU_ONLY