|
| 1 | +ifndef __CHECKS_MAKEFILE__ |
| 2 | + |
| 3 | +__CHECKS_MAKEFILE__ := included |
| 4 | + |
| 5 | +################################################################################ |
| 6 | +# Default checks # |
| 7 | +################################################################################ |
| 8 | +# The .FEATURES variable is likely to be unique for GNU Make. |
| 9 | +ifeq ($(.FEATURES), ) |
| 10 | + $(info Error: '$(MAKE)' does not seem to be GNU Make, which is a requirement.) |
| 11 | + $(info Check your path, or upgrade to GNU Make 3.81 or newer.) |
| 12 | + $(error Cannot continue) |
| 13 | +endif |
| 14 | + |
| 15 | +# Assume we have GNU Make, but check version. |
| 16 | +ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), ) |
| 17 | + $(info Error: This version of GNU Make is too low ($(MAKE_VERSION)).) |
| 18 | + $(info Check your path, or upgrade to GNU Make 3.81 or newer.) |
| 19 | + $(error Cannot continue) |
| 20 | +endif |
| 21 | + |
| 22 | +# In Cygwin, the MAKE variable gets prepended with the current directory if the |
| 23 | +# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe). |
| 24 | +ifneq ($(findstring :, $(MAKE)), ) |
| 25 | + MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE))) |
| 26 | +endif |
| 27 | + |
| 28 | +# Locate this Makefile |
| 29 | +ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),) |
| 30 | + makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST))) |
| 31 | +else |
| 32 | + makefile_path := $(lastword $(MAKEFILE_LIST)) |
| 33 | +endif |
| 34 | +topdir := $(strip $(patsubst %/, %, $(dir $(makefile_path)))) |
| 35 | + |
| 36 | +endif |
0 commit comments